Skip to main content
Give your application search, research, enrichment, and other paid tools through one MCP connection. Your framework discovers and calls the tools; Locus enforces access and spending limits. These examples use a Locus Pro Enterprise Agent Connection. For a desktop or coding client, use interactive OAuth.

Choose an integration

Connection values

Create a connection with the tools, account, expiry, and budget your agent needs.
Runtime environment
Store the credential in your runtime’s secret manager. TypeScript presets use the connection returned by the server SDK:
Trusted backend
Create it on your trusted backend. Give the runtime its scoped credential, never the tenant secret key. Presets format each framework’s authorization fields.
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 raw lcac_… 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.

Responses API

Agents SDK

Agents API (managed)

The managed Agents API connects directly to Locus using a service-origin MCP tool. Its authorization field takes the full Bearer lcac_… value. This raw configuration works without a Locus SDK preset.

Approval and scope

OpenAI presets default to requireApproval: "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.

Messages API

The hosted connector expects the raw lcac_… value in authorization_token.

Claude Agent SDK

The runtime transport expects the complete Authorization header:
Use @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.

Create the MCP client

Keep the MCP client open for the agent’s lifetime and close it at shutdown.

Tool results

Check isError 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 runtime McpToolset in Google ADK.

Gen AI Interactions API

Remote MCP supports Streamable HTTP. Use a server name without hyphens; the Locus preset defaults to locus_pro.

Google ADK

The [mcp] extra installs the compatible MCP dependency.

LangChain

LangChain’s MCP adapters discover Locus tools and expose them as normal LangChain tools. Use the same scoped connection in Python or TypeScript.
For 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.
Install the Python adapter
These pins keep the adapter on its compatible MCP 1.x dependency.

CrewAI and AutoGen

CrewAI and AutoGen both accept authenticated Streamable HTTP MCP servers. Give each deployment its own Locus agent connection.
Install CrewAI
Refresh the worker’s tool list after changing your workspace catalog.

Mastra

Mastra’s MCPClient supports authenticated Streamable HTTP and converts MCP tools into Mastra tools.

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.
This example uses the stable @modelcontextprotocol/sdk package:

Custom frameworks

A custom adapter needs four operations:
  1. Connect with the MCP URL and authorization header.
  2. Call tools/list and map each JSON Schema into the framework’s tool type.
  3. Route tool calls back to MCP tools/call without changing arguments.
  4. Treat a resolved result with isError: true as a failed tool call.
Use parseMcpToolResult() when the adapter is written in TypeScript. It preserves Locus billing metadata, artifacts, retry guidance, and application errors.

Pi

Pi requires a custom extension. Use the raw MCP or REST API path; Locus’s Pi integration is experimental.