MCP Tools
Agentic adapter for accessing tools defined by Model Context Protocol (MCP) servers.
Install
Usage
createMcpTools
createMcpTools
creates a new McpTools
instance by starting or connecting to an MCP server.
You must provide either an existing transport
, an existing serverUrl
, or a
serverProcess
to spawn.
All tools within the McpTools
instance will be namespaced under the given name
.
createMcpTools
takes in the following options (source):
JSON Schema
Note that McpTools
uses JSON Schemas for toll input parameters, whereas most built-in tools use Zod schemas. This is important because some AI frameworks don’t support JSON Schemas as AI function parameters.
Currently, Mastra, Dexter, and xsAI don’t support JSON Schema input parameters, so they won’t work with McpTools
. All of the other AI SDKs should work fine with the JSON Schema-based tools.