MCP Integration
Connect Claude Code, Cursor, Claude Desktop, ChatGPT, or any MCP-compatible client to the Sonzai Mind Layer.
The Mind Layer ships a hosted Streamable HTTP MCP endpoint at
https://api.sonz.ai/mcp/memory/{agent_id}. Point any MCP-compatible
client at it with your Sonzai API key — no local binary, no SSE port to
expose, no Go toolchain.
The server implements the Model Context Protocol spec and exposes 34 tools, 4 resources, and 3 guided prompts (see Tool catalogue below).
What you need
- A project API key — create one in your project settings.
- An agent ID — create an agent via the dashboard, the SDK, or by
running the
create-companionMCP prompt after first connect.
Pick your client
# Single command — registers the hosted MCP server with Claude Code:
claude mcp add --transport http sonzai \
https://api.sonz.ai/mcp/memory/AGENT_ID \
--header "Authorization: Bearer $SONZAI_API_KEY"
# Pick scope with --scope:
# local (default) — only this project, private to you
# project — writes .mcp.json (commit to share with team)
# user — across every project (~/.claude.json)
# Confirm the registration:
claude mcp listStreamable HTTP, not SSE
The 2026 MCP spec marks Streamable HTTP as the canonical remote transport. SSE is on a deprecation path across major clients — prefer HTTP for any new integration. The legacy SSE transport is still served by the local binary for backwards compatibility.
Authentication
| Endpoint | Auth | Scope |
|---|---|---|
POST /mcp/memory/{agent_id} | Authorization: Bearer sk-... | Single agent |
POST /mcp/memory (OAuth, beta) | OAuth 2.0 authorization-code | Project-scoped, agent picker |
The Bearer-key route is what every example above uses — it's pinned to a
specific agent and your project API key is the only secret. The
OAuth-mode route lets clients discover available agents via a picker UI;
it's currently in beta and exposed at the
/.well-known/oauth-authorization-server discovery endpoint.
Treat the API key like a password
The Bearer token is a project API key — it grants full access to every
agent in that project. Don't paste it into shared MCP configs that get
committed to public repos. Prefer per-developer local-scope
configurations when collaborating.
Tool catalogue
The MCP server groups its 34 tools into six categories. Each tool maps directly to a Platform API endpoint.
Agent Management (5)
list_agents— list agents with search and paginationget_agent— detailed agent info (personality, capabilities, status)create_agent— create agent with personality, Big5, seed memories, goalsupdate_agent— update agent profile (name, personality, bio, greeting)delete_agent— permanently delete an agent and all data
Chat (1)
chat— send a message and get a response with full context (memory, mood, personality, relationships)
Memory (5)
get_memory— get hierarchical memory treesearch_memories— natural-language memory searchlist_facts— list atomic facts by type (profile, preference, emotion, …)get_memory_timeline— chronological memory timelinereset_memory— delete all memories (irreversible)
Behavior (11)
get_personality/update_personality— Big5 traits, BFAS dimensionsget_mood/get_mood_history— 4D emotional state and historylist_goals/create_goal/update_goal— agent goalsget_habits— behavioral patterns with strength scoresget_relationships— love scores, narratives, chemistryget_interests— detected interests with confidenceget_diary— AI-generated diary entries
Sessions & State (5)
start_session/end_session— chat sessions for continuity and contextlist_custom_states/upsert_custom_state/get_custom_state— custom key-value entries
Generation & Events (7)
generate_character— generate full character from text descriptiongenerate_and_create_agent— generate + create in one steptrigger_event— affect mood, memory, or behaviorlist_notifications/schedule_wakeup— proactive outreachgenerate_bio— biography for an existing agentlist_voices— available TTS voices
Resources
Resources are read-only data exposed as MCP sonzai:// URIs.
| URI | Description |
|---|---|
sonzai://agents | All agents in the project |
sonzai://agents/{id}/profile | Agent profile (personality, capabilities, status) |
sonzai://agents/{id}/memory | Memory tree snapshot |
sonzai://agents/{id}/personality | Big5 traits, dimensions, preferences |
Guided prompts
Pre-built workflows your assistant can invoke by name.
create-companion
Generate a fully-populated agent from a one-line concept.
Args: concept — e.g. "a philosophical barista who reads tarot cards".
analyze-agent
Deep analysis of an agent's personality, mood, memories, and relationships.
Args: agent_id — UUID or name.
mind-layer-setup
Provision Sonzai as a persistent mind layer for any AI assistant.
Args: assistant_name, personality_description.
Architecture
Claude Code · Cursor · ChatGPT · VS Code · Claude Desktop
│
│ Streamable HTTP (JSON-RPC 2.0)
▼
https://api.sonz.ai/mcp/memory/{agent_id}
│
├─ Context Engine (memory, personality, behavior)
├─ AI Service (LLM generation)
└─ ScyllaDB · Redis · CockroachDBFor air-gapped or stdio-only clients the optional sonzai-mcp binary
sits on the user's machine and proxies stdio JSON-RPC ↔ HTTPS REST.
Next
- API Reference — every REST endpoint the MCP tools wrap
- Personality System and Memory & Context — what the tools control
Integration Guide
Connect your application to the Mind Layer. End-to-end guide with examples for REST API and official SDKs.
OpenClaw Integration
Replace OpenClaw's default memory with the Sonzai Mind Layer — persistent memory, personality evolution, mood tracking, and relationship modeling for every agent.