> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corvic.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Your Own Code

> Call Corvic's MCP tools from Python, TypeScript, or an agent framework.

Any MCP client library can call Corvic. Use an [access token](https://docs.corvic.ai/mcp-connect/access-tokens.md) and send it as a Bearer header.

```python Python theme={null}
import asyncio, os
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client

URL = "https://api.corvic.ai/mcp"
HEADERS = {"Authorization": f"Bearer {os.environ['CORVIC_TOKEN']}"}

async def main():
    async with streamablehttp_client(URL, headers=HEADERS) as (read, write, _):
        async with ClientSession(read, write) as session:
            await session.initialize()
            tools = await session.list_tools()
            print([t.name for t in tools.tools])
            rooms = await session.call_tool("list_rooms", {})
            print(rooms.content)

asyncio.run(main())
```

```typescript TypeScript theme={null}
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const transport = new StreamableHTTPClientTransport(new URL("https://api.corvic.ai/mcp"), {
  requestInit: { headers: { Authorization: `Bearer ${process.env.CORVIC_TOKEN}` } },
});
const client = new Client({ name: "my-app", version: "1.0.0" });
await client.connect(transport);

const { tools } = await client.listTools();
console.log(tools.map((t) => t.name));
console.log(await client.callTool({ name: "list_rooms", arguments: {} }));
```

## Agent frameworks

Frameworks that speak MCP, such as the OpenAI Agents SDK, LangChain and LangGraph, CrewAI, and LlamaIndex, take the same two values: the URL `https://api.corvic.ai/mcp` and the `Authorization` header. Register Corvic as a streamable HTTP MCP server and its tools appear to your agent.

## Good habits

* **Start small.** List tools first, then read a few rows before fetching a whole table.
* **Expect long calls.** `query`, `ask_memory`, and lens readings run models and can take minutes. Use `start_extraction` and `get_extraction` for long documents.
* **Poll runs.** `run_pipeline` returns at once; poll `get_pipeline` for status.
* **Mind metering.** Calls that run models or pipelines are billed; reads are not. See [Room tools](https://docs.corvic.ai/mcp-connect/room-tools.md#conventions).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.