# Connect the MultitaskAI MCP server to Mastra

Mastra builds agents in TypeScript. Add MultitaskAI as a server in an MCPClient with its URL and your API key, then give its tools to your agent.

## Endpoint

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

## Steps

1. Create an API key in your MultitaskAI account.
2. Add the @mastra/mcp package to your Mastra project.
3. Create the MCPClient below, with your key in place of YOUR_API_KEY.
4. Pass await mcp.listTools() as your agent's tools and check that the multitaskai_ tools are listed.

```typescript
import { MCPClient } from '@mastra/mcp'

export const mcp = new MCPClient({
  servers: {
    multitaskai: {
      url: new URL('https://mcp.multitaskai.com'),
      requestInit: {
        headers: {
          Authorization: 'Bearer YOUR_API_KEY',
        },
      },
    },
  },
})
```

## Authentication

Mastra 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

- Headers go under requestInit.headers.
- listTools() prefixes each tool with the server name, as multitaskai_toolName.
- listToolsets() returns tools per server, for passing as toolsets at runtime.
- Keep the key in an environment variable in real code.

## Official documentation

The [Mastra MCP documentation](https://mastra.ai/reference/tools/mcp-client) covers Mastra's own settings in detail. See the [overview](/docs.md) for the endpoint and authentication, and [pricing](/pricing/) for the daily free requests.
