AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
mcp-registry: server.json + MCPB bundle builder for the official MCP Registry (#1922)
xerj-orge6a37fe35f51
diff --git a/.gitignore b/.gitignoreindex a1c287bf9..01624ae96 100644--- a/.gitignore+++ b/.gitignore@@ -193,3 +193,6 @@ __pycache__/# in site generation or in any CI gate, and its only output was# .dogfood/seo/evidence/, so it follows the captures out of the tree.scripts/seo/evidence/++# MCP Registry bundle build output (deploy/mcp-registry/build-mcpb.py)+/dist/diff --git a/deploy/mcp-registry/README.md b/deploy/mcp-registry/README.mdnew file mode 100644index 000000000..a4d6a8f94--- /dev/null+++ b/deploy/mcp-registry/README.md@@ -0,0 +1,80 @@+# Listing XERJ on the official MCP Registry++`server.json` at the repo root describes XERJ for+[registry.modelcontextprotocol.io](https://registry.modelcontextprotocol.io) as+`io.github.xerj-org/xerj`. XERJ ships no npm, PyPI, crates.io or OCI package,+so the registry entry points at an **MCP Bundle** (`.mcpb`) attached to the+GitHub Release. MCP clients that install from the registry (Claude Desktop and+others) download that bundle, check its SHA-256 and run `xerj mcp`.++| File | Role |+|---|---|+| `manifest.template.json` | MCPB manifest (spec 0.3); version and tool list are filled at build time, tools from `landing/docs/agents/schemas/mcp-tools.json` |+| `xerj-mcp.sh` | launcher: picks the macOS/Linux binary for this CPU and runs `xerj mcp` |+| `build-mcpb.py` | builds `dist/xerj-mcp-<version>.mcpb` from the release archives and rewrites `server.json` (version, URL, `fileSha256`) |++The bundle holds the five release binaries (macOS arm64/x86_64, Linux+arm64/x86_64 musl, Windows x86_64), about 150 MB. Entries are sorted and+timestamped at a fixed date, so the same inputs give the same hash. The+registry asset URL must contain `mcp`, which is why the file is+`xerj-mcp-<version>.mcpb`.++The bundle runs the MCP server only. It needs a XERJ node already running+(`xerj --insecure --data-dir ~/xerj-data`); the user sets its URL in the+client (`XERJ_URL`, default `http://localhost:9200`).++## Publish a version++`mcp-publisher login github` is interactive (GitHub device flow). `xerj-org` is a+GitHub **user** account, not an organization, so `io.github.xerj-org/*` is that+account's personal namespace: sign in to GitHub as `xerj-org` when you approve+the device code. Signing in as any other account grants only that account's+namespace, and publishing fails with a permission error.++```sh+V=1.0.0-rc.97+gh release download v$V -R xerj-org/xerj -D dist/mcpb-in \+ -p '*apple-darwin.tar.gz' -p '*linux-musl.tar.gz' \+ -p '*x86_64-pc-windows-msvc.zip' -p '*.sha256'+python3 deploy/mcp-registry/build-mcpb.py --version $V --assets dist/mcpb-in+gh release upload v$V dist/xerj-mcp-$V.mcpb -R xerj-org/xerj++# mcp-publisher: brew install mcp-publisher, or the release binary+curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher++./mcp-publisher validate+./mcp-publisher login github # device flow: open github.com/login/device, enter the code+./mcp-publisher publish+curl -s "https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.xerj-org/xerj"+```++Commit the rewritten `server.json` afterwards so the repo matches what the+registry holds. Each registry version is immutable; publish a new one per release.++## Optional: `org.xerj/xerj` via DNS instead of GitHub++To publish under the domain namespace, change `name` to `org.xerj/xerj`, then:++```sh+openssl genpkey -algorithm Ed25519 -out mcp-key.pem # keep private, never commit+echo "xerj.org. IN TXT \"v=MCPv1; k=ed25519; p=$(openssl pkey -in mcp-key.pem -pubout -outform DER | tail -c 32 | base64)\""+# add that TXT record on the apex xerj.org (not a subdomain), wait for DNS, then:+./mcp-publisher login dns --domain xerj.org --private-key "$(openssl pkey -in mcp-key.pem -noout -text | grep -A3 priv: | tail -n +2 | tr -d ' :\n')"+./mcp-publisher publish+```++## Other directories++- **Smithery** (`smithery mcp publish dist/xerj-mcp-<version>.mcpb -n xerj-org/xerj`):+ its CLI currently rejects a bundle whose manifest lists `tools`+ ([smithery-ai/cli#787](https://github.com/smithery-ai/cli/issues/787)). Build a+ separate copy with `--omit-tools --out dist/smithery` for it. Do not upload that copy as+ the registry asset, because its hash differs.+- **Glama** reads `glama.json` at the repo root to assign maintainers.++## Automating it later++`release.yml` could build and upload the bundle after the binaries, then publish+with GitHub OIDC (`mcp-publisher login github-oidc`, needs `permissions: id-token: write`).+The steps are the same as above; see the registry's+[GitHub Actions guide](https://github.com/modelcontextprotocol/registry/blob/main/docs/modelcontextprotocol-io/github-actions.mdx).diff --git a/deploy/mcp-registry/build-mcpb.py b/deploy/mcp-registry/build-mcpb.pynew file mode 100755index 000000000..8cac2457f--- /dev/null+++ b/deploy/mcp-registry/build-mcpb.py@@ -0,0 +1,153 @@+#!/usr/bin/env python3+"""Build the XERJ MCP Bundle (.mcpb) for one release and stamp server.json.++The official MCP Registry (registry.modelcontextprotocol.io) lists a server by+pointing at a package. XERJ ships no npm/PyPI/crates.io/OCI package, only+GitHub Release binaries, so the registry route is an MCPB bundle uploaded as+a release asset. The registry requires the asset URL to contain "mcp" and+server.json to carry the bundle's SHA-256; MCP clients verify that hash.++One cross-platform bundle holds the five release binaries:+ server/darwin-aarch64/xerj server/darwin-x86_64/xerj+ server/linux-aarch64/xerj server/linux-x86_64/xerj (musl, static)+ server/windows-x86_64/xerj.exe+server/xerj-mcp.sh picks the right one on macOS/Linux; Windows runs xerj.exe+directly (manifest platform_overrides). Every entry gets a fixed timestamp and+the list is sorted, so the same release inputs always give the same bytes and+the same hash.++Usage (from the repo root):+ gh release download v1.0.0-rc.97 -R xerj-org/xerj -D dist/mcpb-in \+ -p '*apple-darwin.tar.gz' -p '*linux-musl.tar.gz' \+ -p '*x86_64-pc-windows-msvc.zip' -p '*.sha256'+ python3 deploy/mcp-registry/build-mcpb.py --version 1.0.0-rc.97 --assets dist/mcpb-in+ gh release upload v1.0.0-rc.97 dist/xerj-mcp-1.0.0-rc.97.mcpb -R xerj-org/xerj+ mcp-publisher publish++Writes dist/xerj-mcp-<version>.mcpb and rewrites ./server.json (version,+package identifier, fileSha256). Standard library only.+"""+import argparse+import hashlib+import io+import json+import pathlib+import re+import sys+import tarfile+import zipfile++HERE = pathlib.Path(__file__).resolve().parent+ROOT = HERE.parent.parent+FIXED = (2020, 1, 1, 0, 0, 0)+TARGETS = {+ "darwin-aarch64": ("aarch64-apple-darwin", "tar.gz", "xerj"),+ "darwin-x86_64": ("x86_64-apple-darwin", "tar.gz", "xerj"),+ "linux-aarch64": ("aarch64-unknown-linux-musl", "tar.gz", "xerj"),+ "linux-x86_64": ("x86_64-unknown-linux-musl", "tar.gz", "xerj"),+ "windows-x86_64": ("x86_64-pc-windows-msvc", "zip", "xerj.exe"),+}+++def sha256(data: bytes) -> str:+ return hashlib.sha256(data).hexdigest()+++def check_sidecar(archive: pathlib.Path, data: bytes) -> None:+ side = archive.with_name(archive.name + ".sha256")+ if not side.exists():+ sys.exit(f"missing {side.name}: download the .sha256 files with the archives")+ want = side.read_text().split()[0].lower()+ if sha256(data) != want:+ sys.exit(f"{archive.name}: sha256 mismatch with {side.name}")+++def extract_binary(archive: pathlib.Path, member: str) -> bytes:+ data = archive.read_bytes()+ check_sidecar(archive, data)+ stage = archive.name.rsplit(".tar.gz", 1)[0].rsplit(".zip", 1)[0]+ name = f"{stage}/{member}"+ if archive.name.endswith(".zip"):+ with zipfile.ZipFile(io.BytesIO(data)) as z:+ return z.read(name)+ with tarfile.open(fileobj=io.BytesIO(data), mode="r:gz") as t:+ f = t.extractfile(name)+ if f is None:+ sys.exit(f"{archive.name}: {name} not found")+ return f.read()+++def tools_from_schema() -> list:+ schema = json.loads((ROOT / "landing/docs/agents/schemas/mcp-tools.json").read_text())+ out = []+ for tool in schema["tools"]:+ first = re.split(r"(?<=\.)\s", tool["description"].strip(), maxsplit=1)[0]+ out.append({"name": tool["name"], "description": first})+ return out+++def add(z: zipfile.ZipFile, name: str, data: bytes, mode: int) -> None:+ info = zipfile.ZipInfo(name, date_time=FIXED)+ info.external_attr = (0o100000 | mode) << 16+ info.create_system = 3+ info.compress_type = zipfile.ZIP_DEFLATED+ z.writestr(info, data, compresslevel=9)+++def main() -> None:+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)+ ap.add_argument("--version", required=True, help="release version without the leading v, e.g. 1.0.0-rc.97")+ ap.add_argument("--assets", required=True, type=pathlib.Path, help="folder holding the downloaded release archives")+ ap.add_argument("--out", type=pathlib.Path, default=ROOT / "dist")+ ap.add_argument("--server-json", type=pathlib.Path, default=ROOT / "server.json")+ ap.add_argument("--omit-tools", action="store_true",+ help="leave the manifest tools list empty (Smithery's CLI rejects declared tools) and do not touch server.json")+ a = ap.parse_args()+ v = a.version.lstrip("v")++ manifest = json.loads((HERE / "manifest.template.json").read_text())+ manifest["version"] = v+ if a.omit_tools:+ manifest.pop("tools", None)+ manifest["tools_generated"] = True+ else:+ manifest["tools"] = tools_from_schema()++ files = {+ "manifest.json": (json.dumps(manifest, indent=2, ensure_ascii=False).encode() + b"\n", 0o644),+ "server/xerj-mcp.sh": ((HERE / "xerj-mcp.sh").read_bytes(), 0o755),+ "LICENSE": ((ROOT / "LICENSE").read_bytes(), 0o644),+ }+ for folder, (triple, ext, member) in TARGETS.items():+ archive = a.assets / f"xerj-{v}-{triple}.{ext}"+ if not archive.exists():+ sys.exit(f"missing {archive}")+ files[f"server/{folder}/{member}"] = (extract_binary(archive, member), 0o755)++ a.out.mkdir(parents=True, exist_ok=True)+ bundle = a.out / f"xerj-mcp-{v}.mcpb"+ buf = io.BytesIO()+ with zipfile.ZipFile(buf, "w") as z:+ for name in sorted(files):+ data, mode = files[name]+ add(z, name, data, mode)+ bundle.write_bytes(buf.getvalue())+ digest = sha256(buf.getvalue())++ print(f"{bundle} {bundle.stat().st_size} bytes")+ print(f"sha256 {digest}")+ if a.omit_tools:+ return++ sj = json.loads(a.server_json.read_text())+ sj["version"] = v+ pkg = next(p for p in sj["packages"] if p["registryType"] == "mcpb")+ pkg["identifier"] = f"https://github.com/xerj-org/xerj/releases/download/v{v}/{bundle.name}"+ pkg["fileSha256"] = digest+ pkg.pop("version", None)+ a.server_json.write_text(json.dumps(sj, indent=2, ensure_ascii=False) + "\n")+ print(f"updated {a.server_json}")+++if __name__ == "__main__":+ main()diff --git a/deploy/mcp-registry/manifest.template.json b/deploy/mcp-registry/manifest.template.jsonnew file mode 100644index 000000000..3a1fdd23b--- /dev/null+++ b/deploy/mcp-registry/manifest.template.json@@ -0,0 +1,73 @@+{+ "manifest_version": "0.3",+ "name": "xerj",+ "display_name": "XERJ",+ "version": "@VERSION@",+ "description": "Local-first BM25, vector and hybrid search, code search and agent memory over your own indexed files.",+ "long_description": "XERJ is a local search engine with an Elasticsearch-compatible API. `xerj autoindex` indexes code, docs, logs, JSONL/CSV and PDFs; this bundle runs `xerj mcp`, the MCP stdio server that proxies search, memory, second-brain, field-map, code-search and Corpus Hub tools to a XERJ node. The node must already be running (`xerj --insecure --data-dir ~/xerj-data`); this bundle does not start one. Install the CLI with `curl -fsSL https://xerj.org/get | sh` to create and index data.",+ "author": {+ "name": "XERJ",+ "url": "https://xerj.org"+ },+ "repository": {+ "type": "git",+ "url": "https://github.com/xerj-org/xerj"+ },+ "homepage": "https://xerj.org",+ "documentation": "https://xerj.org/llms.txt",+ "support": "https://github.com/xerj-org/xerj/issues",+ "license": "Apache-2.0",+ "keywords": [+ "search",+ "code search",+ "bm25",+ "full-text search",+ "vector search",+ "hybrid search",+ "rag",+ "memory",+ "elasticsearch",+ "jsonl",+ "logs",+ "docs"+ ],+ "server": {+ "type": "binary",+ "entry_point": "server/xerj-mcp.sh",+ "mcp_config": {+ "command": "/bin/sh",+ "args": [+ "${__dirname}/server/xerj-mcp.sh"+ ],+ "env": {+ "XERJ_URL": "${user_config.xerj_url}"+ },+ "platform_overrides": {+ "win32": {+ "command": "${__dirname}/server/windows-x86_64/xerj.exe",+ "args": [+ "mcp"+ ]+ }+ }+ }+ },+ "user_config": {+ "xerj_url": {+ "type": "string",+ "title": "XERJ node URL",+ "description": "ES-compatible listener of a running XERJ node. For a loopback node the API key is read from <data-dir>/admin.key automatically.",+ "default": "http://localhost:9200",+ "required": true+ }+ },+ "tools_generated": false,+ "tools": [],+ "compatibility": {+ "platforms": [+ "darwin",+ "linux",+ "win32"+ ]+ }+}diff --git a/deploy/mcp-registry/xerj-mcp.sh b/deploy/mcp-registry/xerj-mcp.shnew file mode 100755index 000000000..ba5b06302--- /dev/null+++ b/deploy/mcp-registry/xerj-mcp.sh@@ -0,0 +1,19 @@+#!/bin/sh+# MCPB launcher for macOS and Linux: pick the bundled xerj binary for this+# CPU and run its MCP stdio server. Windows uses server/windows-x86_64/xerj.exe+# directly (manifest platform_overrides), so this script never runs there.+set -eu+here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)+case "$(uname -s)" in+ Darwin) os=darwin ;;+ Linux) os=linux ;;+ *) echo "xerj-mcp: unsupported OS $(uname -s)" >&2; exit 1 ;;+esac+case "$(uname -m)" in+ arm64|aarch64) arch=aarch64 ;;+ x86_64|amd64) arch=x86_64 ;;+ *) echo "xerj-mcp: unsupported CPU $(uname -m)" >&2; exit 1 ;;+esac+bin="$here/$os-$arch/xerj"+chmod +x "$bin" 2>/dev/null || true+exec "$bin" mcp "$@"diff --git a/glama.json b/glama.jsonnew file mode 100644index 000000000..25df36ca8--- /dev/null+++ b/glama.json@@ -0,0 +1,4 @@+{+ "$schema": "https://glama.ai/mcp/schemas/server.json",+ "maintainers": ["xerj-org"]+}diff --git a/server.json b/server.jsonnew file mode 100644index 000000000..dd9c4ce17--- /dev/null+++ b/server.json@@ -0,0 +1,36 @@+{+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",+ "name": "io.github.xerj-org/xerj",+ "title": "XERJ",+ "description": "Local-first BM25, vector and hybrid search, code search and agent memory over your indexed files.",+ "version": "1.0.0-rc.97",+ "websiteUrl": "https://xerj.org",+ "repository": {+ "url": "https://github.com/xerj-org/xerj",+ "source": "github"+ },+ "packages": [+ {+ "registryType": "mcpb",+ "identifier": "https://github.com/xerj-org/xerj/releases/download/v1.0.0-rc.97/xerj-mcp-1.0.0-rc.97.mcpb",+ "fileSha256": "45731b9b0bb53fc471a15d3c5720f222a8a5c2de6f939fab870c95de4cede32a",+ "transport": {+ "type": "stdio"+ },+ "environmentVariables": [+ {+ "name": "XERJ_URL",+ "description": "ES-compatible listener of a running XERJ node (start one with `xerj --insecure --data-dir ~/xerj-data`).",+ "default": "http://localhost:9200",+ "isRequired": false+ },+ {+ "name": "XERJ_AUTH",+ "description": "Authorization header for a node with auth on, e.g. 'ApiKey <key>'. Optional for a loopback node: the key is read from <data-dir>/admin.key.",+ "isRequired": false,+ "isSecret": true+ }+ ]+ }+ ]+}