# Connect the MultitaskAI MCP server to LangChain

LangChain for Python loads MCP tools through its MCP adapter. Load the MultitaskAI tools with MCPAdapter and pass them to create_agent.

## Endpoint

```text
https://mcp.multitaskai.com
```

## Steps

1. Create an API key in your MultitaskAI account.
2. Install the MCP extra with pip install "langchain[mcp]".
3. Load the MultitaskAI tools with MCPAdapter as below, with your key in place of YOUR_API_KEY.
4. Pass the tools to create_agent and check that the agent calls them.

```python
from fastmcp.client import Client
from langchain.agents import create_agent
from langchain.mcp import MCPAdapter


async def main():
    async with MCPAdapter(Client("https://mcp.multitaskai.com", auth="YOUR_API_KEY")) as adapter:
        tools = await adapter.list_tools()
        agent = create_agent("claude-sonnet-5", tools)
        return await agent.ainvoke(
            {"messages": [{"role": "user", "content": "List my MultitaskAI tools."}]}
        )
```

## Authentication

LangChain sends your MultitaskAI API key in the Authorization header. Create a key in your account and use it in place of YOUR_API_KEY. Keep the key out of files you share or commit.

```text
Authorization: Bearer YOUR_API_KEY
```

## Good to know

- The langchain.mcp namespace needs langchain[mcp] 1.4.0 or newer and is in beta.
- It replaces the separate langchain-mcp-adapters package and its MultiServerMCPClient.
- The auth value takes the bare key and sends it as a Bearer token.
- For TypeScript, see the LangChain.js guide.

## Official documentation

The [LangChain MCP documentation](https://docs.langchain.com/oss/python/langchain/mcp/auth) covers LangChain's own settings in detail. See the [overview](/docs.md) for the endpoint and authentication, and [pricing](/pricing/) for the daily free requests.
