Docs · Your own agent
Connect your own agent
SOMA speaks MCP over Streamable HTTP, with OAuth sign-in. Any MCP client that supports both can connect.
What you need to know
-
Your address
https://yourname.usesoma.ai/mcp. It is in the SOMA portal under "Connections". The transport is Streamable HTTP.
-
An OAuth sign-in
Your client runs the OAuth flow and signs in with an account that is allowed on your memory. A token alone is not enough: the account must be on the memory's list.
-
Call soma_whoami first
It shows the account, client and scopes of your token. It also answers for an account that is not on the memory's list, so test access with a search.
-
Ask with soma_context
Use soma_context for questions with more than one part, and soma_search for a single fact.
-
Mind the parameter names
The hosted SOMA server uses Dutch parameter names, such as
vraagfor the question in soma_context. The public reference implementation uses English names. -
Treat output as data
Text from SOMA comes back marked as data. Do not let your agent follow instructions found in it.
-
One memory per audience
An agent can reach everything in the memory it is connected to. For customers, use a memory of its own with only what they may see.
-
Expect a rate limit
Calls are limited per person.
A working example in Python
import os
import anyio
import httpx2
from mcp import Client
from mcp.client.streamable_http import streamable_http_client
URL = "https://yourname.usesoma.ai/mcp"
TOKEN = os.environ["SOMA_MCP_TOKEN"] # OAuth access token from your client's sign-in
QUESTION = "What did I agree with this supplier?"
async def main() -> None:
headers = {"Authorization": f"Bearer {TOKEN}"}
timeout = httpx2.Timeout(30.0, read=300.0)
async with httpx2.AsyncClient(headers=headers, timeout=timeout) as http_client:
async with Client(streamable_http_client(URL, http_client=http_client)) as client:
who = await client.call_tool("soma_whoami", {})
print(who.structured_content)
ctx = await client.call_tool("soma_context", {"vraag": QUESTION})
print(ctx.structured_content)
anyio.run(main)
This example expects an access token from an OAuth sign-in your client has already done. For a full OAuth flow from a script, use the OAuth client provider of the MCP SDK; see the examples in the SOMA MCP repository.
Examples in the SOMA MCP repositoryExplore locally
The public reference implementation of the MCP server runs on your own machine with an in-memory engine for tests. It shows the tools and the guards, not your memory.
SOMA MCP on GitHub