Skip to main content
Watch: I Built an AI App Without Leaving Databricks

MCP client - Mastra - verified

How to add an MCP server to Mastra

Where to add MCP servers in Mastra: In code: new MCPClient({ servers }) from @mastra/mcp (docs example path src/mastra/mcp/client.ts). Its docs list support for stdio and Streamable HTTP and say SSE is not supported. It handles OAuth sign-in for remote servers.

Mastra homepage - Mastra in our tools directory - Compare all MCP clients

Kind
SDK or framework
stdio
Yes
Streamable HTTP
Yes
SSE
No

Add a server

Where the config lives
In code: new MCPClient({ servers }) from @mastra/mcp (docs example path src/mastra/mcp/client.ts)

The example from the Mastra docs, copied verbatim. Swap in your server's name, command or URL.

TypeScript
const mcpClient = new MCPClient({
  servers: {
    github: {
      url: new URL('https://github.example.com/mcp'),
      requireToolApproval: true,
    },
  },
})

Source: mastra.ai/docs/connections/mcp

Which server?

Pick a server from the verified directory of official MCP servers. Each one lists its transport, auth and the setup snippets its vendor publishes, so you can match it to what Mastra supports.

MCP support

What the Mastra docs say it supports. Not stated means the docs do not say either way.

Mastra MCP features, transports and OAuth, each with its source
FeatureValueSource
ToolsCalls the functions a server exposes.Yesmastra.ai/reference/tools/mcp-client
ResourcesReads data and files a server exposes as resources.Yesmastra.ai/reference/tools/mcp-client
PromptsOffers a server's prompt templates to the user.Yesmastra.ai/reference/tools/mcp-client
SamplingLets a server ask the client's model for a completion.Nomastra.ai/reference/tools/mcp-client
RootsTells a server which directories it may work in.Nomastra.ai/reference/tools/mcp-client
ElicitationLets a server ask the user for input mid-task.Yesmastra.ai/reference/tools/mcp-client
DiscoveryPicks up tools, prompts or resources a server adds or removes while connected.Yesmastra.ai/reference/tools/mcp-client
InstructionsUses the instructions a server sends when it connects.Yesmastra.ai/reference/tools/mcp-client
stdioStarts a local server as a subprocess.Yesmastra.ai/docs/connections/mcp
Streamable HTTPConnects to a remote server over the current HTTP transport.Yesmastra.ai/docs/connections/mcp
SSEConnects over the older HTTP+SSE transport.Nomastra.ai/reference/migrations/mcp-v2
OAuthSigns in to remote servers with OAuth.Yesmastra.ai/reference/tools/mcp-client

Worth knowing

@mastra/mcp 2.x speaks MCP 2026-07-28 over stdio and Streamable HTTP, falls back to the legacy initialize handshake for older servers, and no longer falls back to the standalone HTTP+SSE transport.

FAQ

Where is the Mastra MCP config?

In code: new MCPClient({ servers }) from @mastra/mcp (docs example path src/mastra/mcp/client.ts). The example on this page is copied from https://mastra.ai/docs/connections/mcp

Does Mastra support remote MCP servers over Streamable HTTP?

Yes, per https://mastra.ai/docs/connections/mcp. Its docs list support for stdio and Streamable HTTP and say SSE is not supported.

Does Mastra support OAuth for MCP servers?

Yes. It handles OAuth sign-in for remote servers. Source: https://mastra.ai/reference/tools/mcp-client

Which MCP features does Mastra support?

Its docs list Tools, Resources, Prompts, Elicitation, Discovery and Instructions. They say Sampling and Roots are not supported.

Sources

Last verified from the pages below.

Newsletter

New MCP servers, the week they ship

One email per week. New official MCP servers, the coding tools that support them and how developers wire them up.