Choose an integration
Connection values
Create a connection with the tools, account, expiry, and budget your agent needs.Runtime environment
connection returned by the server SDK:
Create a connection with the Node SDK
Create a connection with the Node SDK
Trusted backend
Keep the package pins shown in Python examples. Some adapters require MCP
1.x; the raw Python example uses MCP 2.x. If you add a per-run budget, pass
one
loop_id across every paid call in that run.OpenAI
OpenAI can call Locus Pro as a hosted MCP tool. The Responses API and Agents SDK accept the rawlcac_… token; the managed Agents API uses a bearer header value.
These examples allow calls without per-call approval. Set tool and spending
limits on the connection before running them. For human approval, use
require_approval: "always" and handle the approval request in your application.
OpenAI setup and examples
OpenAI setup and examples
Responses API
- TypeScript preset
- Python
Agents SDK
- TypeScript
- Python
Agents API (managed)
The managed Agents API connects directly to Locus using a service-origin MCP tool. Itsauthorization field takes the full Bearer lcac_… value. This raw configuration works without a Locus SDK preset.- Python
Approval and scope
OpenAI presets default torequireApproval: "never". Set it to "always" if your application should ask before each call. The connection’s Locus tool and spending limits apply in either case.Anthropic
Use Anthropic’s hosted MCP connector when the Messages API should call Locus directly. Use the Claude Agent SDK HTTP transport when MCP should run in your application.Anthropic setup and examples
Anthropic setup and examples
Messages API
The hosted connector expects the rawlcac_… value in authorization_token.- TypeScript preset
- Python
Claude Agent SDK
The runtime transport expects the completeAuthorization header:- TypeScript preset
- Python
@anthropic-ai/claude-agent-sdk 0.2.70 or later for the corrected Streamable HTTP Accept header behavior.Vercel AI SDK
Use@ai-sdk/mcp when your Vercel AI SDK agent should discover and execute Locus tools through Streamable HTTP.
Vercel setup and example
Vercel setup and example
Create the MCP client
Tool results
CheckisError when calling MCP directly, or use parseMcpToolResult(). Store paid results before generating an answer so an interrupted turn does not repeat the purchase.Google Gen AI and ADK
Google supports Locus Pro through two paths: hosted remote MCP in the Gen AI Interactions API, or a runtimeMcpToolset in Google ADK.
Google setup and examples
Google setup and examples
LangChain
LangChain’s MCP adapters discover Locus tools and expose them as normal LangChain tools. Use the same scoped connection in Python or TypeScript.LangChain setup and examples
LangChain setup and examples
- TypeScript
- Python
estimate_cost, use the { provider, endpoint, body } form for compatibility with older TypeScript adapters.LlamaIndex
Both LlamaIndex Python and LlamaIndexTS include MCP tool adapters. They convert Locus tool schemas into framework-native callable tools.LlamaIndex setup and examples
LlamaIndex setup and examples
- Python
- TypeScript
Install the Python adapter
CrewAI and AutoGen
CrewAI and AutoGen both accept authenticated Streamable HTTP MCP servers. Give each deployment its own Locus agent connection.CrewAI and AutoGen setup
CrewAI and AutoGen setup
- CrewAI
- AutoGen
Install CrewAI
Mastra
Mastra’sMCPClient supports authenticated Streamable HTTP and converts MCP tools into Mastra tools.
Mastra setup and example
Mastra setup and example
Raw MCP and custom frameworks
Use the official MCP clients when your runtime has no framework adapter. Locus uses Streamable HTTP and standard bearer authorization.Raw MCP setup and custom adapters
Raw MCP setup and custom adapters
- TypeScript
- Python
This example uses the stable
@modelcontextprotocol/sdk package:Custom frameworks
A custom adapter needs four operations:- Connect with the MCP URL and authorization header.
- Call
tools/listand map each JSON Schema into the framework’s tool type. - Route tool calls back to MCP
tools/callwithout changing arguments. - Treat a resolved result with
isError: trueas a failed tool call.
parseMcpToolResult() when the adapter is written in TypeScript. It preserves Locus billing metadata, artifacts, retry guidance, and application errors.