BrainKB MCP

Model Context Protocol server for the BrainKB knowledge base.

This is an API host, not a web app. The protocol endpoint is /mcp and speaks MCP over streamable HTTP — it is meant for an MCP client, not a browser.

Register it with Claude Code:

claude mcp add --scope user --transport http brainkb https://mcp.sandbox.brainkb.org/mcp

Each caller authenticates per request with their own BrainKB credential — an Authorization: Bearer header, or a Personal Access Token via the login tools. There is no shared or ambient identity.

Ingesting a large RDF file. MCP tool arguments are written by the model, so a file passed through one has to be re-typed token by token — unusable above a few KB, and unsafe for RDF. Stream it here instead, and the server ingests it through the same API the tools use:

import requests
requests.post("https://mcp.sandbox.brainkb.org/upload",
              params={"filename": "review.ttl", "graph": "<graph_iri>"},
              headers={"Authorization": f"Bearer {TOKEN}"},
              data=open("review.ttl", "rb"))   # streamed off disk

Answers 202 with an upload_id and ingests in the background. Omit &graph to stage only, then call brainkb_ingest_upload. Up to 5 GB per file.

Opening /mcp in a browser returns Not Acceptable: Client must accept text/event-stream. That is the endpoint working correctly: a browser GET sends no Accept: text/event-stream, so the server refuses it.