Connect an AI agent (MCP)
Connect an AI agent (MCP)
Labric hosts a Model Context Protocol server that exposes the Labric API as tools any MCP-compatible agent can call — Claude, Cursor, or your own agent framework.
Endpoint
The server speaks streamable HTTP:
Authentication
Authenticate with a Labric API key, exactly as you would against the REST API:
The MCP server holds no data of its own — every tool call forwards your key to the Labric API, which enforces scopes and row-level security. A read-scoped key can only call read tools.
Connecting
Claude Code
Python (Anthropic SDK)
The simplest way to give a Python agent access to Labric is the Anthropic API’s MCP connector — declare the server in the request and Claude discovers and calls the tools itself, with no client-side MCP plumbing:
On long multi-tool tasks the API pauses the tool loop periodically (response.stop_reason == "pause_turn"); resume by appending the response content as an assistant message and calling again.
Python (any MCP client)
To call tools directly from a script — your own agent framework, or no LLM at all — use any MCP client library over streamable HTTP, for example FastMCP:
If your agent framework only speaks stdio, FastMCP can also proxy the remote server: build the same transport, then create_proxy(transport, name="labric").run(transport="stdio").
Other MCP clients
Any client that supports streamable HTTP transport with custom headers works. A typical JSON configuration:
Available tools
The tools mirror the API Reference one-to-one — each is generated from the same API schema, with the same name and description. Browse the reference for the full list; any agent can also discover them at runtime by listing the server’s tools.