# How to connect Mastra to Claude

```json
{
  "title": "How to connect Mastra to Claude",
  "toolkit": "Mastra",
  "toolkit_slug": "mastra",
  "framework": "Claude Cowork",
  "framework_slug": "claude-cowork",
  "url": "https://composio.dev/toolkits/mastra/framework/claude-cowork",
  "markdown_url": "https://composio.dev/toolkits/mastra/framework/claude-cowork.md",
  "updated_at": "2026-11-25T05:36:09.860Z"
}
```

## Introduction

Claude is Anthropic's AI assistant, available on the web, in the desktop app, and on mobile. Cowork is its agent for knowledge work, and it runs on all of those surfaces too. Connected to your apps, Claude can work with your files and services to accomplish complex tasks on your behalf.
This guide walks you through the easiest and most secure way to connect your Mastra account to Claude via Composio Connect, enabling it to list Mastra projects with deployment statuses, review recent Mastra feedback by project, query Mastra metrics for failed runs, and more such actions on your behalf without compromising your account security.
Setup is the same on Claude Web, Desktop, and Cowork, and you only need to do it once. The connector is tied to your account, so it's available in all three.
For exact tool slugs and parameter tables, see the [tool catalog in the Composio docs](https://docs.composio.dev/toolkits/mastra).

## Also integrate Mastra with

- [ChatGPT](https://composio.dev/toolkits/mastra/framework/chatgpt)

## Connect Mastra to Claude Cowork

### Connecting Mastra to Claude Web, Desktop, and Cowork
Two ways to add the Composio connector. Pick whichever you prefer.
### 1. Add with one click
Click the button. Claude opens with the Composio connector filled in. Click Add, then go to step 2.
[Add to Claude](https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=Composio&connectorUrl=https%3A%2F%2Fconnect.composio.dev%2Fmcp)
### Add manually
In Claude Desktop, click Customize in the left sidebar, then select Connectors and click the + icon at the top.
Click Add custom connector and paste in the Composio MCP server URL:

```bash
https://connect.composio.dev/mcp
```

## What is the Mastra MCP server, and what's possible with it?

The Mastra MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Mastra account. It provides structured and secure access to Mastra projects, deployments, organization management, hosted server settings, and observability data, so your agent can manage projects, track deployments, inspect logs and metrics, and administer organization access on your behalf.
- Project and deployment management: Have your agent create, list, inspect, redeploy, stop, or cancel Mastra Studio and hosted Server projects and deployments.
- Observability and feedback analysis: Let the agent discover and review metrics, analyze trends and grouped results, list feedback, and calculate feedback summaries for your Mastra projects.
- Deployment and runtime troubleshooting: Direct your agent to retrieve deployment logs, inspect current hosted Server runtime logs, and check deployment status when investigating an issue.
- Hosted server configuration: Instruct your agent to manage custom domains and replace environment variables for hosted Mastra Server projects, including restarting a running service after configuration changes.
- Organization access administration: Have your agent list members, invitations, organizations, and API tokens, invite or remove members, update roles, and revoke invitations or tokens.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `MASTRA_ADD_SERVER_DOMAIN` | Add Server Domain | Add a custom domain to a hosted Mastra Server project and return its required DNS records. |
| `MASTRA_ANALYZE_FEEDBACK` | Analyze Feedback | Calculate an aggregate, grouped breakdown, time series, or percentile series over numeric Mastra feedback without creating data. |
| `MASTRA_ANALYZE_METRICS` | Analyze Metrics | Calculate an aggregate, grouped breakdown, time series, or percentile series over hosted Mastra metrics without creating data. |
| `MASTRA_CANCEL_SERVER_DEPLOY` | Cancel Server Deployment | Cancel a queued or in-progress Mastra hosted Server deployment. |
| `MASTRA_CONFIRM_DEPLOY_UPLOAD` | Confirm Deploy Upload | Confirm that a deployment ZIP has already been uploaded to the signed URL returned by Create Deployment Upload. This action does not upload the ZIP. It triggers the Studio or Server build-and-deploy pipeline, so call it only after the separate signed-URL PUT succeeds. |
| `MASTRA_CREATE_API_TOKEN` | Create API Token | Create a Mastra organization API token. The response exposes the usable secret exactly once because that is the purpose of this operation. Store it securely immediately; do not log, share, or commit it. |
| `MASTRA_CREATE_DEPLOY_UPLOAD` | Create Deployment Upload | Create a legacy Mastra Studio or hosted Server deployment upload reservation. This action does not upload the artifact or start the deploy pipeline. When upload_url is returned, upload the ZIP bytes directly to it with PUT and Content-Type application/zip, then call Confirm Deploy Upload with the returned deployment ID. env_vars may contain secrets, and upload_url is a sensitive, short-lived signed URL granting temporary upload access; do not log, persist, share, or expose either value. |
| `MASTRA_CREATE_SERVER_PROJECT` | Create Server Project | Create a hosted Mastra Server project. This provisions hosted infrastructure and may trigger usage-metered compute charges. |
| `MASTRA_CREATE_STUDIO_PROJECT` | Create Studio Project | Create a Mastra Studio project. |
| `MASTRA_DELETE_PROJECT` | Delete Project | Permanently delete a Mastra Studio project and all its deployments, or a hosted Server project and its provisioned resources. |
| `MASTRA_DISCOVER_METRICS` | Discover Metrics | Discover metric names, labels, and shared observability dimensions without creating data. |
| `MASTRA_GET_AUTH_CONTEXT` | Get Authentication Context | Return the user, organization, role, and authentication type associated with the connected Mastra API key. |
| `MASTRA_GET_DEPLOY` | Get Deployment | Get the status and details of one Mastra Studio or hosted Server deployment. |
| `MASTRA_GET_DEPLOY_LOGS` | Get Deployment Logs | Get logs for one Mastra Studio or hosted Server deployment; Studio calls may limit the number of recent lines. |
| `MASTRA_GET_PROJECT` | Get Project | Get one Mastra Studio or hosted Server project and its deployment history. |
| `MASTRA_GET_SERVER_ENVIRONMENT_VARIABLES` | Get Server Environment Variables | SENSITIVE: Get environment variables for a hosted Mastra Server project. This returns plaintext secret values; never log, persist, or expose the response. |
| `MASTRA_GET_SERVER_RUNTIME_LOGS` | Get Server Runtime Logs | Get current runtime log records for a hosted Mastra Server project. |
| `MASTRA_INVITE_MEMBER` | Invite Organization Member | Send an invitation to join the connected Mastra organization with a member or admin role. The connected account must have an admin role. |
| `MASTRA_LIST_API_TOKENS` | List API Tokens | List metadata for Mastra organization API tokens. Returned token values are obfuscated identification previews, not usable secrets. |
| `MASTRA_LIST_FEEDBACK` | List Feedback | List hosted Mastra feedback records with page or durable delta continuation. |
| `MASTRA_LIST_INVITATIONS` | List Organization Invitations | List all pending invitations for the connected Mastra organization. |
| `MASTRA_LIST_MEMBERS` | List Organization Members | List members of the connected Mastra organization, including their roles and membership status. |
| `MASTRA_LIST_METRICS` | List Metrics | List raw hosted Mastra metric records with page or durable delta continuation. |
| `MASTRA_LIST_ORGANIZATIONS` | List Organizations | List Mastra organizations available to the connected API-key bearer credential. |
| `MASTRA_LIST_PROJECTS` | List Projects | List Mastra Studio or hosted Server projects in the connected organization. |
| `MASTRA_LIST_SERVER_DOMAINS` | List Server Domains | List custom domains configured for a hosted Mastra Server project. |
| `MASTRA_REDEPLOY_SERVER_PROJECT` | Redeploy Server Project | Trigger a new deployment for a hosted Mastra Server project. Redeployment starts deployment work and may trigger usage-metered compute charges. |
| `MASTRA_REMOVE_MEMBER` | Remove Organization Member | Remove a member from the connected Mastra organization. This destructive operation requires an organization admin role. |
| `MASTRA_REVOKE_API_TOKEN` | Revoke API Token | Revoke a Mastra organization API token so it can no longer authenticate. This destructive operation cannot reveal or restore the revoked secret. |
| `MASTRA_REVOKE_INVITATION` | Revoke Organization Invitation | Revoke a pending invitation to the connected Mastra organization. The connected account must have an admin role. |
| `MASTRA_SET_SERVER_ENVIRONMENT_VARIABLES` | Set Server Environment Variables | SENSITIVE SECRET MUTATION: Replace environment variables for a hosted Mastra Server project. Values are secrets; never log, persist, or expose them. This route does not restart the running service. |
| `MASTRA_SET_SERVER_ENVIRONMENT_VARIABLES_AND_RESTART` | Set Server Environment Variables and Restart | SENSITIVE, IRREVERSIBLE RUNTIME OPERATION: Replace secret environment variables for a hosted Mastra Server project and immediately restart its running service. Never log, persist, or expose the secret values. |
| `MASTRA_STOP_SERVER_DEPLOY` | Stop Server Deployment | Stop a Mastra hosted Server deployment. |
| `MASTRA_UPDATE_MEMBER_ROLE` | Update Organization Member Role | Change an existing member's role in the connected Mastra organization. The connected account must have an admin role. |
| `MASTRA_VERIFY_PROJECT_INGEST_ACCESS` | Verify Project Ingest Access | Verify that the connected Mastra organization API key can ingest telemetry for one project without changing provider state. |

## Supported Triggers

None listed.

## Troubleshooting

### 1. Why does Claude not use the Composio connector for Mastra?

The connector can show as connected, but Claude must use it in each Mastra conversation.
- Click + at the lower left of the chat, or type /.
- Hover Connectors.
- Turn on Composio.
- Ask Claude to connect to Mastra again.

### 2. Why does Claude show an MCP server error before Mastra connects?

Claude can show Couldn't reach the MCP server or Authorization with the MCP server failed when you add the connector for Mastra.
- Check that the connector URL is https://connect.composio.dev/mcp.
- Connectors run from Anthropic's cloud, so your device network is usually not the problem.
- Add the connector again from Customize > Connectors, then ask Claude to connect Mastra.
- If it fails again, send the error and the ofid_ reference id to support@composio.dev.

### 3. Why does the Mastra authorization link not work?

The Composio connector is one server. Your Mastra account connects separately when Claude asks for it.
- If the browser does not open, or the link expires, ask Claude to retry the Mastra connection.
- Composio creates a fresh Mastra authorization link.
- Open that link in your browser and finish the Mastra sign-in.

### 4. Why do Mastra actions fail after they worked before?

The Mastra connection can expire or lose permission.
- Ask Claude to inspect the Mastra connection.
- If the connection is unhealthy, disconnect it when Claude prompts you.
- Reconnect the Mastra account and retry the action.
- If Claude shows a permission prompt, approve it before Claude changes data in Mastra.
- If the action still fails with a permission error, check that the connected account has that permission in Mastra itself.

### 5. How do I switch to a different Mastra account?

Claude can manage the Mastra connection for you.
- Ask Claude to disconnect or delete the current Mastra account.
- Ask Claude to connect Mastra again.
- Open the new Composio authorization link for Mastra.
- Sign in with the other Mastra account in the browser.
- After the account connects, ask Claude to retry the Mastra task.

### 6. Why is my Mastra connection missing in Claude Desktop or on a Team plan?

The connector belongs to your Claude account, so your Mastra connection works in Claude Web, Desktop, and Cowork.
- In Claude Desktop, open Customize > Connectors.
- Next to Composio, click ⋮ and click Clear cache.
- If Mastra tools still do not appear, click ⋮, disconnect, remove the connector, and add it again.
- On Team or Enterprise, an Owner or Primary Owner must enable the connector before you can connect Mastra.

## Creating MCP Server - Stand-alone vs Composio SDK

The Mastra MCP server connects Claude Web, Desktop, and Cowork to your Mastra account through Composio. Once connected, Claude can use the available Mastra tools and triggers to complete tasks on your behalf.

## Complete Code

None listed.

## How to build Mastra MCP Agent with another framework

- [ChatGPT](https://composio.dev/toolkits/mastra/framework/chatgpt)

## Related Toolkits

- [Supabase](https://composio.dev/toolkits/supabase) - Supabase is an open-source backend platform offering scalable Postgres databases, authentication, storage, and real-time APIs. It lets developers build modern apps without managing infrastructure.
- [Codeinterpreter](https://composio.dev/toolkits/codeinterpreter) - Codeinterpreter is a Python-based coding environment with built-in data analysis and visualization. It lets you instantly run scripts, plot results, and prototype solutions inside supported platforms.
- [GitHub](https://composio.dev/toolkits/github) - GitHub is a code hosting platform for version control and collaborative software development. It streamlines project management, code review, and team workflows in one place.
- [1password](https://composio.dev/toolkits/_1password) - 1Password is a password manager and digital vault for storing logins, secrets, notes, and secure documents. It helps individuals and teams protect credentials, share access safely, and reduce password risk.
- [Ably](https://composio.dev/toolkits/ably) - Ably is a real-time messaging platform for live chat and data sync in modern apps. It offers global scale and rock-solid reliability for seamless, instant experiences.
- [Abuselpdb](https://composio.dev/toolkits/abuselpdb) - Abuselpdb is a central database for reporting and checking IPs linked to malicious online activity. Use it to quickly identify and report suspicious or abusive IP addresses.
- [Agent37](https://composio.dev/toolkits/agent37) - Agent37 is a control API for managed agent sandboxes, templates, networking, and execution. It gives teams built-in scheduling, observability, budgets, and workspace administration.
- [Alchemy](https://composio.dev/toolkits/alchemy) - Alchemy is a blockchain development platform offering APIs and tools for Ethereum apps. It simplifies building and scaling Web3 projects with robust infrastructure.
- [Algolia](https://composio.dev/toolkits/algolia) - Algolia is a hosted search API that powers lightning-fast, relevant search experiences for web and mobile apps. It helps developers deliver instant, typo-tolerant, and scalable search without complex infrastructure.
- [Anakin](https://composio.dev/toolkits/anakin_io) - Anakin is a web automation platform offering scraping, crawling, search, and browser automation. Use it to extract structured data, automate site tasks, and monitor web changes reliably.
- [Anchor browser](https://composio.dev/toolkits/anchor_browser) - Anchor browser is a developer platform for AI-powered web automation. It transforms complex browser actions into easy API endpoints for streamlined web interaction.
- [AnyAPI](https://composio.dev/toolkits/anyapi) - AnyAPI is a marketplace of utility APIs for validation, currency conversion, holidays, documents, and web data. It brings common application workflows together through one practical API platform.
- [Apiflash](https://composio.dev/toolkits/apiflash) - Apiflash is a website screenshot API for programmatically capturing web pages. It delivers high-quality screenshots on demand for automation, monitoring, or reporting.
- [Apiverve](https://composio.dev/toolkits/apiverve) - Apiverve delivers a suite of powerful APIs that simplify integration for developers. It's designed for reliability and scalability so you can build faster, smarter applications without the integration headache.
- [Appcircle](https://composio.dev/toolkits/appcircle) - Appcircle is an enterprise-grade mobile CI/CD platform for building, testing, and publishing mobile apps. It streamlines mobile DevOps so teams ship faster and with more confidence.
- [Appdrag](https://composio.dev/toolkits/appdrag) - Appdrag is a cloud platform for building websites, APIs, and databases with drag-and-drop tools and code editing. It accelerates development and iteration by combining hosting, database management, and low-code features in one place.
- [Appveyor](https://composio.dev/toolkits/appveyor) - AppVeyor is a cloud-based continuous integration service for building, testing, and deploying applications. It helps developers automate and streamline their software delivery pipelines.
- [Authyo](https://composio.dev/toolkits/authyo) - Authyo is a REST API service for passwordless authentication, OTP verification, session management, and transactional notifications. Use it to add secure login flows and user verification without building auth infrastructure from scratch.
- [AWS Marketplace MCP](https://composio.dev/toolkits/aws_marketplace_mcp) - AWS Marketplace MCP provides MCP access to AWS Marketplace's cloud software, data, and services catalog. Use it to discover, compare, and evaluate 30K+ AWS Marketplace listings faster.
- [Azure DevOps](https://composio.dev/toolkits/azure_devops) - Azure DevOps is Microsoft's platform for planning work, managing code, and delivering software. It helps development teams collaborate and ship applications with connected tools.

## Frequently Asked Questions

### What are the differences in Tool Router MCP and Mastra MCP?

With a standalone Mastra MCP server, the agents and LLMs can only access a fixed set of Mastra tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Mastra and many other apps based on the task at hand, all through a single MCP endpoint.

### Can I use Tool Router MCP with Claude Cowork?

Yes, you can. Claude Cowork fully supports MCP integration. You get structured tool calling, message history handling, and model orchestration while Tool Router takes care of discovering and serving the right Mastra tools.

### Can I manage the permissions and scopes for Mastra while using Tool Router?

Yes, absolutely. You can configure which Mastra scopes and actions are allowed when connecting your account to Composio. You can also bring your own OAuth credentials or API configuration so you keep full control over what the agent can do.

### How safe is my data with Composio Tool Router?

All sensitive data such as tokens, keys, and configuration is fully encrypted at rest and in transit. Composio is SOC 2 Type 2 compliant and follows strict security practices so your Mastra data and credentials are handled as safely as possible.

---
[See all toolkits](https://composio.dev/toolkits) · [Composio docs](https://docs.composio.dev/llms.txt)
