Skip to content

Other MCP clients

Any MCP client that speaks the streamable HTTP transport and can send a request header can use a Spongram brain. This page gives the connection settings, what such a client receives without a Spongram plugin, and the limits to plan for.

Connection settings

Setting Value
URL https://spongram.example.com/mcp, without a trailing slash
Transport Streamable HTTP
Header Authorization: Bearer spt_brain_xxx
Accept header application/json, text/event-stream (MCP client libraries send it)

The brain key is created in the admin UI and shown once. It selects the brain: a client never names a group_id, and must not send one.

A typical declaration looks like this. The key names differ from one client to another; the three values do not:

{
  "mcp_servers": {
    "spongram": {
      "transport": "http",
      "url": "https://spongram.example.com/mcp",
      "headers": {"Authorization": "Bearer spt_brain_xxx"}
    }
  }
}

To check a server without a client, use the curl sequence in the MCP server overview.

Clients that only speak stdio

A client that can only start a local MCP process needs a bridge. The Claude Desktop bundle uses mcp-remote for this, and the same command works elsewhere:

npx -y mcp-remote@latest "https://spongram.example.com/mcp" \
  --header "Authorization: Bearer spt_brain_xxx"

The bridge runs on the user's machine, which needs Node.js and network access to npm.

The client header

X-Spongram-Client is recognised with two values only, claude-code and codex, which are sent by the corresponding plugins. Another client should not send it. Without it, the server treats the client as one with no project context: an active persona is delivered in full, and no client= tag is added to writes. The header never authorises anything. See client contract.

What a client receives

A handshake with sessions. initialize returns an Mcp-Session-Id header that the client sends back on later requests. The accepted protocol versions are 2024-11-05, 2025-03-26, 2025-06-18 and 2025-11-25. The session-less variant of the protocol is refused with HTTP 400, and clients then fall back to initialize.

Instructions. The instructions field of the initialize answer carries Spongram's behavioural contract: save durable facts without being asked, search before answering from history, tag every memory with a project. A client that passes server instructions to its model gets proactive memory without any plugin. A client that ignores them still gets the same guidance in the descriptions of add_memory, search_nodes and search_memory_facts.

A tool list that depends on the server's flags. The memory, search, skill and code-map tools are always listed. Persona and project-alias tools appear when their flags are on. With the Cloud control plane, the list is reduced to what the key may call. Read tools/list instead of hard-coding a list. See the tools reference.

Two response framings. Answers produced by Spongram are application/json. Answers forwarded from the memory engine are text/event-stream with a single message event. Both are valid streamable HTTP responses.

Results in two fields. On a server, a search result is in result.content[0].text as a JSON string and in result.structuredContent as an object, with identical content. Read either. The desktop edition and the synthetic tools return content[0].text only.

Asynchronous writes. add_memory answers as soon as the episode is stored in the ingestion queue. Entities and facts appear after the background extraction, seconds to minutes later. Do not read back immediately to verify a write; get_episodes shows the episode once it has been processed.

Tagging without a plugin

The Claude Code and Codex plugins compute a project for each session and tell the model which tags to write. A generic client has to do this itself, or leave it to the model and the server:

  • Best: have your integration put a source_description on every add_memory, starting with project=<slug> (lowercase letters, digits, -, _, .; 64 characters at most) or project=global, and a client=<your-client> tag for provenance.
  • Otherwise: the model follows the instructions and deduces a topic slug per conversation when topic scoping is on.
  • Fallback: a write that still arrives without a project= tag is filed by the server under project=desktop-inbox (topic scoping on) or project=global (topic scoping off).

On searches, pass scope: {"project": "<slug>"} when tools/list shows a scope argument, so the server keeps that project and project=global and drops the others. See tagging and scope.

Limits

Requests

  • One JSON-RPC message per POST. Send requests one at a time rather than as a batch.
  • No GET /mcp. Spongram opens no server-to-client stream and sends no unsolicited message. A client that tries to open one receives HTTP 405 and should carry on without it.
  • Rate limit. 100 requests per minute per brain by default (SPONGRAM_RATE_LIMIT_PER_MIN), counted over tool calls; the handshake and tools/list are free. Over the limit the answer is HTTP 429 with Retry-After. Several clients using the same key share one budget.
  • Request size. Spongram sets no size limit of its own on /mcp; a reverse proxy in front of it may. An episode_body longer than SPONGRAM_EPISODE_BODY_MAX_CHARS characters (10 000 by default) is split into several episodes before it is queued. Prefer several focused memories to one large document anyway: extraction is faster and more accurate on short episodes.
  • add_memory arguments. Only name, episode_body, source, source_description and uuid are kept. Anything else is removed without an error.

Responses

  • Slow answers arrive in one piece. While a forwarded tool runs for more than 15 seconds, the memory engine emits SSE keep-alive comments (: ping). Spongram reads the whole answer first, strips those comments and empty events, then replies. The client therefore sees no byte until the answer is complete, and the body always starts with event: or data:.
  • Set a generous timeout. A delete can wait up to 45 seconds behind an episode being written to the same brain before it even starts. Give the client, and any reverse proxy in front of Spongram, a response timeout comfortably above that.
  • Session expiry is handled for you. The memory engine forgets a session after 30 idle minutes. Spongram opens a new one, replays the call and returns the new id in the Mcp-Session-Id response header. Use the id from the latest response.
  • Check payloads for error. The memory engine reports some failures as a successful result whose payload is {"error": "..."}. See the error section of the overview.

Deletes

  • delete_episode is never retried by Spongram. If your connection drops during a delete, look at get_episodes before sending it again.
  • A delete refused with "a memory of this brain is being written" deleted nothing. Retry it later.
  • clear_graph erases the brain without confirmation. Do not expose it to a model without a human approval step in your client.

HTTP routes next to MCP

A brain key also opens read routes outside MCP, used by the plugins and the explorers, such as GET /v1/graph/data/episodes. See the HTTP API page.

One of them has a constraint worth knowing if you build a browser client. GET /v1/graph/stream is a server-sent event stream of new entities and episodes (events ready, nodes, episodes, ping, error, and activity when the Cortex activity flag is on). It requires the Authorization header like every other route.

Warning

Do not consume /v1/graph/stream with the browser EventSource API. EventSource cannot send an Authorization header, which would push you to put the brain key in the query string, where it ends up in logs and history. Use fetch() with the header and read the body as a ReadableStream.

Checklist

  1. POST /mcp with initialize returns 200 and an Mcp-Session-Id header.
  2. result.instructions contains the sentence that starts with "Spongram is this user's persistent, cross-session second brain".
  3. tools/list shows add_memory and search_nodes with long, directive descriptions.
  4. An add_memory returns "queued for processing".
  5. A minute later, get_episodes lists the episode and search_nodes finds its entities.

If step 4 succeeds and step 5 never does, the write was accepted but extraction is failing: see troubleshooting.