MCP客户端工具

Mastra支持的MCP客户端,用于连接AI代理与外部工具和资源,充当通用插件系统,使代理能够跨语言和环境调用工具,同时也可用于构建MCP服务器。

  • by mastra-ai
  • TypeScript
  • 本地部署
  • 2.9万 星标
  • 更新于
在 GitHub 查看 mastra-ai/mastra

使用说明

@mastra/mcp

Mastra supports the Model Context Protocol (MCP), an open standard for connecting AI agents to external tools and resources. It serves as a universal plugin system, enabling agents to call tools regardless of language or hosting environment.

Mastra can also be used to author MCP servers, exposing agents, tools, and other structured resources via the MCP interface. These can then be accessed by any system or agent that supports the protocol.

Installation

npm install @mastra/mcp

Usage

Provide an MCP server URL or stdio command.

import { MCPClient } from '@mastra/mcp';

const client = new MCPClient({
  servers: { docs: { url: new URL('https://example.com/mcp') } },
});
const tools = await client.listTools();

Documentation

Changelog

See the package changelog for version history and release notes.

Support

We have an open community Discord. Come and say hello and let us know if you have any questions or need any help getting things running.