# Connect the MultitaskAI MCP server to LangChain.js

LangChain.js loads MCP tools for TypeScript agents. Add MultitaskAI to an MCPAdapter with its URL and your API key, then pass the tools to createAgent.

## Endpoint

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

## Steps

1. Create an API key in your MultitaskAI account.
2. Install the adapters with npm install @langchain/mcp-adapters@^2.0.0 @langchain/core @langchain/langgraph.
3. Add the MultitaskAI server below to an MCPAdapter, with your key in place of YOUR_API_KEY.
4. Pass the listed tools to createAgent and ask the agent which MultitaskAI tools it can use.

```typescript
import { MCPAdapter } from "@langchain/mcp-adapters";
import { createAgent } from "langchain";

const adapter = new MCPAdapter({
  servers: {
    multitaskai: {
      url: "https://mcp.multitaskai.com",
      headers: { Authorization: "Bearer YOUR_API_KEY" },
    },
  },
});

const tools = await adapter.listTools();
const agent = createAgent({ model: "claude-sonnet-5", tools });
```

## Authentication

LangChain.js 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

- You need @langchain/mcp-adapters 2.0 or later, which replaced MultiServerMCPClient with MCPAdapter.
- Close the adapter with await adapter.close() when the agent is done.
- For rotating tokens, pass an authProvider instead of headers.

## Official documentation

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