Skip to content

D51 — A hosted server is a peer, serving the same tools over HTTP

  • Status: Accepted — implements D47 (part 9); amends D2
  • Date: 2026-09-24
  • Origin: slice 28 build
  • Area: surfaces

Decision

  • kg serve --config kg-serve.yaml serves the four MCP tools over streamable HTTP at /mcp, behind OAuth (D51b). They are the same handlers kg mcp serves over stdio, so the two surfaces cannot drift. It adds no dependency: the MCP SDK brings Starlette and uvicorn.
  • It is a peer, not the dataset's database of record.
  • It keeps a graph of its own (WAL, with a busy timeout, since requests write at once).
  • It pulls the dataset on a timer.
  • It sends work back as pull requests (D51d).
  • Its places are fixed by its config:
  • the graph, the dataset clone, and its sign-in state (serve.db, apart from the graph);
  • settings come from the config, never from a personal ~/.kg/kg.yaml;
  • secrets come from the environment: the GitHub OAuth app's id and secret, the peer's key path, and a token that can push and open pull requests.
  • What a hosted call may not do:
  • name a file on the host (db, dataset, into, path, text_file);
  • rebuild a graph, which is not offered;
  • act on the host's copy of the dataset (pull, bundle_export, publish, import, keep_local, scope_share) unless the caller is a maintainer.
  • Every read works as it does locally: briefs, the queue, sql (still read-only), related.
  • It ships a Dockerfile and docs/HOSTING.md. Where to host it is decided after it is proven.

Why

claude.ai can only reach an MCP server over HTTP with OAuth. D2 put that path in its own late slice, and D47 said what shape it must take: a server that is a contributor like any other, so that the dataset — signed bundles in git — stays the source of truth, and nobody depends on the server for the history. The restrictions are what change when many people call one process: nothing personal about the host may leak into a request, and a request may not reach the host's files.

Alternatives

  • The hosted graph as the source of truth. Rejected in D47: it gives up local-first, and it needs infrastructure before the model of contribution is proven.
  • A separate web API. A second surface to keep in step. MCP over HTTP is what claude.ai speaks.