Docs⌘ K  Search
Docs/Build/MCP server
Hosted MCP v0.5.17

MCP Server

Connect any MCP-compatible AI agent to Hebbrix memory, temporal graph, reasoning, and Outcome Memory tools through one hosted endpoint.

Quick setup

Add the hosted Hebbrix endpoint to your client's MCP server configuration, save, and reconnect. Guest access does not require an account, API key, local process, or package installation.

The MIT-licensed repositoryis the MCP-to-REST adapter. Durable storage, retrieval, graph processing, reasoning, and Outcome Memory run in the Hebbrix cloud backend; the backend is not presented as an open-source, self-hostable component.
MCP client configuration
{
  "mcpServers": {
    "hebbrix": {
      "url": "https://mcp.hebbrix.com/mcp"
    }
  }
}
Client configuration formats vary. Some clients expose an MCP settings form while others use a JSON file. In either case, select a remote or hosted MCP server and usehttps://mcp.hebbrix.com/mcp as the URL.
Serving several end users? Your application, not the model, decides whose memory a session reads. Read End users, scope and authorization below before you give an agent these tools.

Connection details

SettingValue
Server URLhttps://mcp.hebbrix.com/mcp
TransportHosted HTTPS MCP
Guest authenticationNot required
MCP release companionv0.5.17
Tool surfaceDiscover the current tool list by connecting your MCP client

End users, scope and authorization

Hebbrix cannot tell which of your users is talking to the agent; only your application can. The rules:

  1. The account API key is the principal. Every tool call authenticates as the account that owns the key, and that account can read and write every memory in its collections. Keep the key on your server.
  2. A user_id is a scope selector, not proof of identity. user_id, agent_id and run_id are filters the API applies exactly, whoever sends them: writes are stored under them, and search, ask, list and export return only that scope. A collection that holds end-user data refuses an unscoped read (end_user_scope_required, surfaced as an MCP error).
  3. Bind the authenticated user's scope before the agent sees a tool. Pin user_id (and agent_id / run_id if you use them) for the MCP session from your own authentication. Remove the scope arguments from the tool schemas the model sees, and reject a tool call in which the model supplies one. Never take user_id from end-user input or let a model choose it.
  4. Reads by ID need your authorization boundary too. A memory ID is not a secret or a capability: hebbrix_get (and GET /v1/memories/{id}) return any memory of the account unless the scope is passed. Pin the scope, so the server applies it to every ID-addressed tool (hebbrix_get, hebbrix_update, hebbrix_forget, hebbrix_history, hebbrix_graph_status then return not found for another user's memory), or check the memory's owner in your application before showing it.

With a pin in place, a tool argument that differs from a pinned value is refused (error_code: "scope_pinned", isError: true), and a tool that cannot be narrowed to a pinned field refuses (unsupported_scope) rather than read wider. The API has no end-user-bound keys: the boundary between your end users is set by the application that holds the key, so keep the key out of end-user-controlled code. The same rules for direct API calls, with an example, are in multi-tenancy.

Hosted server: your gateway pins the user per session

Your application's server is the gateway: it authenticates the end user, then opens that user's MCP session to https://mcp.hebbrix.com/mcp with the account key and X-Hebbrix-User-Id set to the authenticated user. The hosted server is stateless and reads the pin from every request, so set the header on every request of the session; a client created with fixed headers, as below, does.

Python (hosted server, scope pinned by your gateway)
# Runs on your server, never in the browser. pip install mcp
import os
from contextlib import asynccontextmanager

from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client

HEBBRIX_MCP_URL = "https://mcp.hebbrix.com/mcp"
HEBBRIX_API_KEY = os.environ["HEBBRIX_API_KEY"]  # the account key: server-side only

# Scope belongs to the application. The model never sees or sets these.
SCOPE_ARGUMENTS = {"user_id", "agent_id", "run_id", "collection_id"}


@asynccontextmanager
async def memory_session(authenticated_user_id: str):
    """One MCP session per authenticated end-user session.

    authenticated_user_id comes from your own sign-in (session cookie, OAuth
    token, ...), never from the request body, a tool argument or the model.
    """
    headers = {
        "Authorization": f"Bearer {HEBBRIX_API_KEY}",
        "X-Hebbrix-User-Id": authenticated_user_id,  # pinned for every request
    }
    async with streamablehttp_client(HEBBRIX_MCP_URL, headers=headers) as (read, write, _):
        async with ClientSession(read, write) as session:
            await session.initialize()
            yield session


def tools_for_model(tools):
    """The tool list the model sees: scope arguments removed from every schema."""
    exposed = []
    for tool in tools:
        schema = dict(tool.inputSchema or {})
        schema["properties"] = {
            name: spec
            for name, spec in (schema.get("properties") or {}).items()
            if name not in SCOPE_ARGUMENTS
        }
        schema["required"] = [
            name for name in schema.get("required", []) if name not in SCOPE_ARGUMENTS
        ]
        exposed.append({"name": tool.name, "description": tool.description,
                        "input_schema": schema})
    return exposed


async def call_tool_for_model(session: ClientSession, name: str, arguments: dict):
    """Forward a model's tool call; reject any attempt to choose the scope."""
    overrides = SCOPE_ARGUMENTS & set(arguments)
    if overrides:
        return {"isError": True,
                "error": f"scope is set by the application: {sorted(overrides)}"}
    return await session.call_tool(name, arguments)


# In a request handler, after your own authentication:
#   async with memory_session(current_user.id) as session:
#       tools = tools_for_model((await session.list_tools()).tools)
#       ... run the model with `tools`; route each tool call through
#       call_tool_for_model(session, call.name, call.arguments)

Two layers hold the scope: your application drops and rejects scope arguments from the model, and the pinned header makes the server refuse any tool argument that differs from it and apply the pinned user to every tool, so hebbrix_get with another user's memory ID returns not found. If you put a reverse proxy between an MCP client you do not control and the hosted server, the proxy must do the same on every request: authenticate the end user, remove any Authorization, Cookie and X-Hebbrix-* headers the client sent, then add the account key and X-Hebbrix-User-Id for the authenticated user. A request that reaches the server without the header is not pinned.

Local server: one process per end user

A local (stdio) server reads its pin from the environment when it starts, so run one process per end-user session and set HEBBRIX_USER_ID from your authentication (HEBBRIX_AGENT_ID and HEBBRIX_RUN_ID pin the other fields):

Python (local server, scope pinned per process)
import os

from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client


def hebbrix_server_for(authenticated_user_id: str) -> StdioServerParameters:
    return StdioServerParameters(
        command="uvx",
        args=["hebbrix-mcp"],
        env={
            "PATH": os.environ["PATH"],
            "HEBBRIX_API_KEY": os.environ["HEBBRIX_API_KEY"],
            "HEBBRIX_USER_ID": authenticated_user_id,  # fixed for this process
        },
    )


# async with stdio_client(hebbrix_server_for(current_user.id)) as (read, write):
#     async with ClientSession(read, write) as session:
#         await session.initialize()
#         ... expose tools_for_model(...) and call_tool_for_model(...) as above

Never share one local process between end users: its pin is the user it was started for. For one person on their own machine, the same pin is a client config entry:

Local server pinned to one user
{
  "mcpServers": {
    "hebbrix": {
      "command": "uvx",
      "args": ["hebbrix-mcp"],
      "env": { "HEBBRIX_API_KEY": "mem_sk_...", "HEBBRIX_USER_ID": "user-123" }
    }
  }
}

What the MCP server exposes

MCP 0.5.17 exposes 38 tools covering memory, temporal graph, grounded reasoning, procedures, account workflows, and learning from explicitly reported outcomes. Your client lists them all after it connects. Representative tools include:

  • hebbrix_remember stores durable memory from an agent interaction.
  • hebbrix_ask answers using memory and temporal graph evidence.
  • hebbrix_graph_query queries entities, relationships, timelines, and current truth.
  • hebbrix_graph_status reports whether asynchronous graph enrichment is processing, failed, ready, or temporarily unreadable. Readiness is based on durable projection acknowledgements. Its related-memory count is not an entity-relationship count: zero related memories does not mean there are no extracted edges.
  • hebbrix_choose_action records a decision receipt and chooses from measured outcome evidence.

Outcome evidence and action advice

hebbrix_context_schema enrolls a context contract before the first decision. Its fields use {"issue":{"values":["slow","errors"],"required":true}}.hebbrix_configure_policy sets the explicit per-action target, description, risk, priors and evidence window, with expected_revision for conflict detection. Both writes require an explicit owner instruction; an agent must not lower risk or alter context after seeing outcomes just to earn a favorable recommendation.

hebbrix_policy_advice reads a scoped evidence card, uncertainty, reported failures and an exploration suggestion. It does not create a decision. Opt-inadaptive_exploration: true on hebbrix_choose_action requires a configured posterior-sampling policy and eligible low-risk actions; its returned behavior probabilities describe the actual finite randomized policy.

hebbrix_confidence accepts policy_key, action_keyand context, and separates memory_support fromaction_confidence and ASK/REVIEW/ACT advice. Memory similarity alone cannot earn ACT. Reported outcomes are not independent verification, andauthorization_granted remains false. Use the separate permission and dispatch workflow for an actual guarded execution boundary, and the learning guidefor the complete configuration format. Discover the connected server's tool list; older installed adapters may not expose these helpers.

Grounding and safety contract

Retrieval tools return only evidence that the API marked as grounded. Each verified response includes the grounding state, evidence memory IDs, and a claim receipt. If the upstream response is malformed, missing its safety envelope, degraded, or ungrounded, the hosted adapter fails closed instead of presenting related text as an answer.

When GraphRAG synthesis abstains but authoritative search has verified evidence,hebbrix_ask returns it with synthesis_status: "retrieval_only". It does not silently discard recall or misrepresent retrieved text as model synthesis. Failed tool calls use MCP isError=true consistently over hosted HTTP and local stdio.

MCP responses expose request IDs, backend builds, grounding versions, and cache-path diagnostics. Ask includes separate reasoning and retrieval diagnostics when fallback is needed. Failure categories distinguish unknown facts from unavailable verification, service failures, quota limits, and malformed evidence receipts. These diagnostics contain no credentials or memory content; they do not bypass the evidence checks.

Memory content is always marked as untrusted data. Treat it as evidence for the user's question, never as instructions for the agent. A newly accepted but still-indexing write is reported as pending and is not mixed into verified search results. Even with wait_for_index=true, waiting is bounded: check the returnedsearchable receipt and poll hebbrix_get when it is false. Do not repeat an accepted write to make it searchable.

Verify the connection

  1. Reconnect your client and confirm that the Hebbrix tools appear.
  2. Ask the agent to remember a distinctive, non-sensitive fact.
  3. Start a fresh conversation and ask the agent to retrieve that fact.
  4. For graph validation, store two related facts and query their relationship or timeline.

Guest and account-scoped use

Guest access is the quickest way to evaluate the hosted MCP connection. Applications that need account-owned collections, explicit tenant scoping, API administration, billing, or production data controls should use an authenticated Hebbrix account and follow the authentication guide, then pin each end user's scope as described in End users, scope and authorization.

Coding-agent workflows

For code-change history, previous-error lookup, fix tracking, and the dedicated/v1/coding-agent/* API surface, continue to the coding-agent guide.

Ask the docs
reading · this page

Hi! I'm the Hebbrix docs assistant. Ask me anything about this page: setup, code examples, endpoints, pricing, or integrations.