Host a peer¶
A hosted peer is analects serve. It serves the four MCP tools (read, check,
write, review) over HTTP to people who sign in with GitHub, so they can use
Analects from claude.ai or any MCP client without running it themselves (D51).
For a small, trusted team, for now. A peer has no rate limits and no per-person settings beyond the dataset's. No production setup is chosen either: the host, the domain, TLS and backups of the peer's graph and sign-ins are yours to arrange. Both are open in the backlog.
It is a peer, not the dataset's database of record: - it keeps a graph of its own and pulls the dataset; - it stages each person's work as them; - it holds leases, so two people never sweep a channel or refresh a task at the same time; - it sends work back to the dataset as a pull request per person, signed by the peer for them.
CI verifies those bundles like anyone else's, and maintainers merge them.
1. List the peer and its people in the dataset¶
In the dataset's contributors.yaml:
contributors:
ann:
role: maintainer
github: ann-on-github # the GitHub login Ann signs in with
keys: ["ssh-ed25519 AAAA… ann"]
agents:
claude: {scopes: ["*"]} # a person on claude.ai writes as <handle>/claude
peers:
analects-host:
key: "ssh-ed25519 AAAA… peer" # the peer's public signing key
url: https://analects.example.org
- Only people listed with a
github:login can sign in. Removing someone signs them out on their next call. - A peer holds no role. It says who signed in. What they may do is theirs: their role, their agents and those agents' scopes.
Name the peer in dataset.yaml (peer: https://analects.example.org). With that set,
analects sweep claim, analects sweep brief --claim and analects refresh brief --claim on
anyone's machine claim through the peer. Each person signs in once with
analects peer login.
2. A GitHub OAuth app, and the peer's key¶
- Create an OAuth app at GitHub › Settings › Developer settings › OAuth Apps.
Its callback URL is
<url>/oauth/github/callback. - Make the peer's signing key with
ssh-keygen -t ed25519 -N "" -f /data/peer_key. Its.pubis thekey:above. - Make a token that can push branches and open pull requests on the dataset repository: a fine-grained token with contents and pull requests, read and write.
3. analects-serve.yaml¶
url: https://analects.example.org # the address people use; the OAuth issuer
host: 0.0.0.0
port: 8765
graph: /data/graph.db
dataset: /data/dataset # `git clone` of the dataset repository
state: /data/serve.db # sign-in state; tokens stored hashed
peer: analects-host
publish: {repo: owner/analects-data, base: main}
pull_minutes: 10
write_policy: confirm
fetch: off # or `record`: fetch only the pages a recorded research run cites (D55)
private_terms: []
Secrets go in the environment, never in the file:
- GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET;
- ANALECTS_PEER_KEY (the path of the private key);
- GITHUB_TOKEN_PUBLISH.
4. Run it¶
analects serve --config /data/analects-serve.yaml
# or
docker build -t analects-peer . && docker run -p 8765:8765 -v analects-data:/data -e … analects-peer
- To add it to claude.ai: Settings › Connectors › Add custom connector, with
the URL
<url>/mcp. Claude signs you in through GitHub. - To try it from your own machine first, run it on
127.0.0.1behind a tunnel (cloudflared tunnel --url http://127.0.0.1:8765). Use the tunnel's address asurl:and as the OAuth app's callback.
5. Browsing the data at /data¶
With Analects installed with the serve extra (the Docker image has it), the peer shows
what it holds in Datasette at <url>/data. You sign in there with GitHub too, and
only listed contributors get in.
It shows:
- a front page saying what the graph is about and what it holds: each type by
status and place, its totals, how well it is sourced, the scopes tracked. Give
it a title and a line of your own with title: and about: in the dataset's
dataset.yaml;
- a view per type ("Data centers — what we believe now"), faceted on region and
status, with a description of each column;
- current_values, every value with its standing;
- the evidence: claims, events and sources;
- an entity page, reached from any id: every value with the quote and source
behind it;
- the saved queries as forms.
Logs, leases, captures and the other internals are hidden, and SQL can still
read them (D54). analects views browse shows the same pages for a local graph, on
127.0.0.1.
It is read-only: no downloads of the database, and SQL answers questions only.
Turn it off with data: false in analects-serve.yaml.
It shows the whole graph, local-only rows included, to every listed contributor,
exactly as read op=sql does.
6. What a hosted call may not do¶
- Name a file on the host. A call's
db,dataset,into,pathandtext_fileare refused; a document is passed as text. - Rebuild a graph. A peer does not offer it.
- Touch the peer's copy of the dataset, unless you are a maintainer:
pull,bundle_export,publish,import,keep_localandscope_share.
write(op="publish") (maintainers) sends everyone's new work: a branch
peer/<handle>/<time> and a pull request per person. A decision on someone
else's work follows theirs, in a second pull request.