Documentation Index
Fetch the complete documentation index at: https://docs.trysoma.ai/llms.txt
Use this file to discover all available pages before exploring further.
Soma ships with a high-performance, secure MCP server called Bridge.
Bridge can be used in 2 ways:
- As an MCP server you can give to your agent
- As a standard REST API endpoint that you can invoke directly from your workflow
For example, you can configure your agent, via your SDK of choice, to use Bridge as an MCP server:
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse';
const mcpClient = await createMCPClient({
transport: {
type: 'http',
// this is automatically injected by the Soma API server
url: process.env.SOMA_BRIDGE_MCP_URL,
headers: {
// this is automatically injected by the Soma API server
'X-Api-Key': process.env.SOMA_AGENT_API_KEY,
// this is automatically injected by the Soma API server
'Authorization': `Bearer ${process.env.SOMA_USER_ACCESS_TOKEN}`,
},
}
})
const tools = await mcpClient.tools();
const response = await generateText({
model: 'openai/gpt-4o',
tools,
stopWhen: stepCountIs(5),
messages: [
{
role: 'user',
content: [{ type: 'text', text: 'Find products under $100' }],
},
],
});
Read the Vercel AI SDK documentation for more details.from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain.agents import create_openai_tools_agent
import os
client = MultiServerMCPClient(
{
"soma": {
"transport": "http",
# this is automatically injected by the Soma API server
"url": os.getenv("SOMA_BRIDGE_MCP_URL"),
"headers": {
# this is automatically injected by the Soma API server
"X-Api-Key": os.getenv("SOMA_AGENT_API_KEY"),
# this is automatically injected by the Soma API server
"Authorization": `Bearer ${os.getenv("SOMA_USER_ACCESS_TOKEN")}`,
},
}
}
)
tools = await client.get_tools()
agent = create_agent(
"claude-sonnet-4-5-20250929",
tools
)
Read the Langchain documentation for more details.
Alternatively, you can invoke Bridge directly from your code, as if it were a standard REST API client.
import { type BridgeDefinition, getBridge } from "../soma/bridge";
// No need to pass in any credentials, they are automatically injected by the Soma API server
const bridge = getBridge(ctx);
const res = await bridge.gmailUser.sendEmail({
to: "test@example.com",
subject: "Test email",
body: "This is a test email",
});
from soma.bridge import Bridge, get_bridge
# Get bridge instance
# No need to pass in any credentials, they are automatically injected by the Soma API server
bridge = get_bridge(params.ctx)
await bridge.gmail_user.send_email(
to="test@example.com",
subject="Test email",
body="This is a test email",
)
To understand more about about MCP functions, please read: