# Use Meteor from your agent framework

If you already build your agent with a framework, you don't have to wire Meteor's API endpoint by endpoint. The OpenAI Agents SDK, LangChain and the Vercel AI SDK ship an MCP client that connects to Meteor's remote server over **streamable HTTP**, with your API key in the `Authorization` header. Your agent gets the `met_*` tools —WhatsApp, CRM, scheduling, collections and your workspace's connectors— filtered by your key's scopes.

If what you are building is a product with agents inside, [AI agents for SaaS](https://meteor.com.co/en/soluciones/software) explains how much platform you skip.

## What you need

All three frameworks use the same values:

| Value | Setting |
|---|---|
| Server URL | `https://api.met.meteor.com.co/api/v1/mcp` |
| Transport | Streamable HTTP |
| Header | `Authorization: Bearer met_live_…` |
| Scopes | `mcp:use` to open the session, plus each tool's own: `contacts:read` for `met_list_contacts`, `channels:read` for `met_list_channels` |

- **Keep the key in an environment variable** (`MET_API_KEY` in the examples), never in the code.
- **While you test, use a read-only `met_test_` key.** It blocks sending and external actions, but not writes to your workspace. See [what test mode does and does not do](authentication.html#what-test-mode-does-and-does-not-do).
- **The model is yours.** Your agent decides with the model and the provider account it already uses; Meteor provides the tools.

The examples list the tools, call a read tool (`met_list_contacts`, which searches the CRM's contacts) and hand the server to an agent so it decides on its own. The full list is in [MCP server capabilities](../../mcp.html#capacidades).

## OpenAI Agents SDK (Python)

```bash
pip install openai-agents
```

`MCPServerStreamableHttp` takes the URL and the headers inside `params`. With `async with` it connects on entry and closes on exit.

```python
import asyncio
import os

from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp


async def main() -> None:
    async with MCPServerStreamableHttp(
        name="Meteor",
        params={
            "url": "https://api.met.meteor.com.co/api/v1/mcp",
            "headers": {"Authorization": f"Bearer {os.environ['MET_API_KEY']}"},
            "timeout": 30,
        },
        cache_tools_list=True,
    ) as meteor:
        tools = await meteor.list_tools()
        print([t.name for t in tools])  # the tools your key allows

        contacts = await meteor.call_tool("met_list_contacts", {"search": "Ana", "limit": 5})
        print(contacts.content)

        agent = Agent(
            name="Assistant",
            instructions="Use Meteor's tools to answer.",
            mcp_servers=[meteor],
        )
        result = await Runner.run(agent, "Which channels do I have connected?")
        print(result.final_output)


asyncio.run(main())
```

## OpenAI Agents SDK (TypeScript)

```bash
npm install @openai/agents
```

`MCPServerStreamableHttp` takes the URL in `url` and the headers in `requestInit`, the `fetch` options for every request.

```ts
import { Agent, run, MCPServerStreamableHttp } from '@openai/agents';

const meteor = new MCPServerStreamableHttp({
  name: 'Meteor',
  url: 'https://api.met.meteor.com.co/api/v1/mcp',
  requestInit: { headers: { Authorization: `Bearer ${process.env.MET_API_KEY}` } },
  cacheToolsList: true,
});

await meteor.connect();
try {
  const tools = await meteor.listTools();
  console.log(tools.map((t) => t.name)); // the tools your key allows

  const contacts = await meteor.callTool('met_list_contacts', { search: 'Ana', limit: 5 });
  console.log(contacts);

  const agent = new Agent({
    name: 'Assistant',
    instructions: "Use Meteor's tools to answer.",
    mcpServers: [meteor],
  });
  const result = await run(agent, 'Which channels do I have connected?');
  console.log(result.finalOutput);
} finally {
  await meteor.close();
}
```

## LangChain and LangGraph (Python)

Since `langchain` 1.4.0 the MCP client ships in the package, under `langchain.mcp` (LangChain's documentation marks it as beta). The headers go on FastMCP's streamable HTTP transport, which it uses underneath.

```bash
pip install "langchain[mcp]>=1.4.0"
```

```python
import asyncio
import os

from fastmcp.client import Client
from fastmcp.client.transports import StreamableHttpTransport
from langchain.agents import create_agent
from langchain.mcp import MCPAdapter


async def main() -> None:
    transport = StreamableHttpTransport(
        "https://api.met.meteor.com.co/api/v1/mcp",
        headers={"Authorization": f"Bearer {os.environ['MET_API_KEY']}"},
    )
    async with MCPAdapter(Client(transport)) as meteor:
        tools = await meteor.list_tools()  # LangChain tools
        print([t.name for t in tools])

        list_contacts = next(t for t in tools if t.name == "met_list_contacts")
        print(await list_contacts.ainvoke({"search": "Ana", "limit": 5}))

        agent = create_agent(os.environ["MODEL"], tools)  # the model your agent already uses
        result = await agent.ainvoke(
            {"messages": [{"role": "user", "content": "Which channels do I have connected?"}]}
        )
        print(result["messages"][-1].content)


asyncio.run(main())
```

The tools work while the `async with` block is still open: everything the agent uses goes inside it. `create_agent` builds a LangGraph graph; if you build your own, the same `tools` go to your tool node.

**If your project uses `langchain-mcp-adapters`** (versions before 1.4.0), you connect with `MultiServerMCPClient`, the `http` transport and the headers in the same entry:

```python
from langchain_mcp_adapters.client import MultiServerMCPClient

client = MultiServerMCPClient(
    {
        "meteor": {
            "transport": "http",
            "url": "https://api.met.meteor.com.co/api/v1/mcp",
            "headers": {"Authorization": f"Bearer {os.environ['MET_API_KEY']}"},
        },
    }
)
tools = await client.get_tools()
```

LangChain publishes a guide to move from `langchain-mcp-adapters` to `langchain.mcp` (link in the sources, below).

## Vercel AI SDK (TypeScript)

```bash
npm install ai @ai-sdk/mcp
```

`createMCPClient` takes an `http` transport (streamable HTTP) with the URL and the headers.

```ts
import { createMCPClient } from '@ai-sdk/mcp';

const meteor = await createMCPClient({
  transport: {
    type: 'http',
    url: 'https://api.met.meteor.com.co/api/v1/mcp',
    headers: { Authorization: `Bearer ${process.env.MET_API_KEY}` },
    redirect: 'error',
  },
});

try {
  const { tools } = await meteor.listTools();
  console.log(tools.map((t) => t.name)); // the tools your key allows

  const contacts = await meteor.callTool({
    name: 'met_list_contacts',
    arguments: { search: 'Ana', limit: 5 },
  });
  console.log(contacts.content);
} finally {
  await meteor.close();
}
```

To let the model decide, `meteor.tools()` returns the same tools in the AI SDK's format and you pass them in `tools` to `generateText` or `streamText`. Close the client when the response ends:

```ts
import { streamText } from 'ai';

const result = streamText({
  model: yourModel, // the model your agent already uses
  tools: await meteor.tools(),
  prompt: 'Which channels do I have connected?',
  onEnd: async () => {
    await meteor.close();
  },
});
```

## Good to know in all three

- **A missing tool is a missing scope.** The catalog is filtered by your key's scopes. `met_whoami` tells you which account and which permissions your agent is connected with.
- **Give it only the tools it uses.** The full catalog is large, and with fewer options the model chooses better. Issue the key with just the scopes it needs and, if needed, filter in the framework: `tool_filter` in the Python OpenAI Agents SDK, `toolFilter` in the TypeScript one, or filter the `tools` list by name in LangChain and in the AI SDK.
- **Your workspace's connectors come along too.** `met_list_integrations` and `met_list_integration_tools` show what is connected and which actions each connector brings. Whatever has no tool of its own is reachable through `met_search_operations` → `met_describe_operation` → `met_call_operation`.
- **What cannot be undone asks for `confirm: true`.** Deleting, publishing a flow or creating a broadcast fails without touching anything if the argument is missing, and the error says what would be lost. If your agent runs without a person beside it, don't give it write scopes it doesn't need.
- **Retries don't duplicate.** Writes carry an idempotency key the server derives: if your framework retries the same call, it gets the first call's response.
- **WhatsApp has its rules.** `met_send_message` doesn't send if a person on the team is handling the conversation, and outside the 24-hour window you need an approved template (`met_send_whatsapp_template`). See [An agent that answers WhatsApp](recipe-whatsapp.html).

## MCP or the runs API: who decides

| | MCP server (this guide) | Runs API |
|---|---|---|
| Who decides what to do | Your agent, with your model | A Met in your workspace |
| What you provide | The agent, the model and the loop | The question or the task |
| What Meteor provides | The `met_*` tools | The whole Met: instructions, skills, memory and tools |
| Start at | [MCP server](../../mcp.html) | [Run Mets](run-mets.html) |

Use MCP when you already have an agent and want to give it Meteor's WhatsApp, CRM and connectors. Use the runs API when the work can be done by a Met that already serves your business and your code only needs to ask and read the result. The two combine: your agent can run a Met with `met_run_agent`. To see everything you get as an agent builder, start at [For chatbot and AI agent builders](for-agent-builders.html).

## Sources

Checked on 22-Nov-2026 against each framework's official documentation:

- **OpenAI Agents SDK (Python)** — [openai.github.io/openai-agents-python/mcp](https://openai.github.io/openai-agents-python/mcp/): `MCPServerStreamableHttp`, with the headers in `params["headers"]`.
- **OpenAI Agents SDK (TypeScript)** — [openai.github.io/openai-agents-js/guides/mcp](https://openai.github.io/openai-agents-js/guides/mcp/): `MCPServerStreamableHttp`, with `requestInit` (`fetch` options) for the headers.
- **LangChain** — [docs.langchain.com/oss/python/langchain/mcp](https://docs.langchain.com/oss/python/langchain/mcp) and the migration guide [docs.langchain.com/oss/python/migrate/langchain-mcp-adapters](https://docs.langchain.com/oss/python/migrate/langchain-mcp-adapters): `MCPAdapter`, with the headers on `StreamableHttpTransport`. For `langchain-mcp-adapters`: [github.com/langchain-ai/langchain-mcp-adapters](https://github.com/langchain-ai/langchain-mcp-adapters), `http` transport with `headers`.
- **Vercel AI SDK** — [ai-sdk.dev/docs/ai-sdk-core/mcp-tools](https://ai-sdk.dev/docs/ai-sdk-core/mcp-tools) and [ai-sdk.dev/docs/reference/ai-sdk-core/create-mcp-client](https://ai-sdk.dev/docs/reference/ai-sdk-core/create-mcp-client): `createMCPClient` with the `http` transport, `url` and `headers`.
