fastify-mcp-server MCP工具 是 AI Skill Hub 本期精选MCP工具之一。综合评分 7.5 分,整体质量较高。我们推荐使用将其纳入你的 AI 工具库,帮助提升工作效率。
Fastify插件,快速创建MCP HTTP服务,简化Model Context Protocol的开发和部署。
fastify-mcp-server MCP工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
Fastify插件,快速创建MCP HTTP服务,简化Model Context Protocol的开发和部署。
fastify-mcp-server MCP工具 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/flaviodelgrosso/fastify-mcp-server
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"fastify-mcp-server-mcp--": {
"command": "npx",
"args": ["-y", "fastify-mcp-server"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 fastify-mcp-server MCP工具 执行以下任务... Claude: [自动调用 fastify-mcp-server MCP工具 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"fastify-mcp-server_mcp__": {
"command": "npx",
"args": ["-y", "fastify-mcp-server"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
The Model Context Protocol (MCP) is an open standard that enables AI assistants to securely connect to external data sources and tools. This plugin provides a streamable HTTP transport implementation for MCP servers built with Fastify, offering:
npm install
npm install fastify-mcp-server @modelcontextprotocol/sdk
A docker-compose.yaml is provided for local development with Redis:
docker compose up -d
npm run dev:redis
```bash
import Fastify from 'fastify';
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import FastifyMcpServer, { getMcpDecorator } from 'fastify-mcp-server';
const app = Fastify({ logger: true });
// Create MCP server factory function
function createMcpServer () {
const mcp = new McpServer({
name: 'my-mcp-server',
version: '1.0.0'
});
// Define MCP tools
mcp.tool('hello-world', () => ({
content: [{ type: 'text', text: 'Hello from MCP!' }]
}));
return mcp;
}
// Register the plugin
await app.register(FastifyMcpServer, {
createMcpServer,
endpoint: '/mcp' // optional, defaults to '/mcp'
});
// Get MCP decorator for advanced features
const mcpServer = getMcpDecorator(app);
// Start the server
await app.listen({ host: '127.0.0.1', port: 3000 });
await app.register(FastifyMcpServer, {
createMcpServer,
transportOptions: {
sessionIdGenerator: () => {
return `mcp-prod-${randomUUID()}`;
}
}
});
To quickly see the plugin in action, you can run the demo server:
```bash
type FastifyMcpServerOptions = {
createMcpServer: () => McpServer; // MCP Server factory function
endpoint?: string; // Custom endpoint path (default: '/mcp')
authorization?: {
// Authorization configuration
bearerMiddlewareOptions: {
verifier: OAuthTokenVerifier; // Custom verifier for Bearer tokens
requiredScopes?: string[]; // Optional scopes required for access
resourceMetadataUrl?: string; // Optional URL for resource metadata
};
oauth2?: {
// OAuth2 metadata configuration
authorizationServerOAuthMetadata: OAuthMetadata; // OAuth metadata for authorization server
protectedResourceOAuthMetadata: OAuthProtectedResourceMetadata; // OAuth metadata for protected resource
};
};
sessionStore?: SessionStore; // Optional custom session store implementation
transportOptions?: StreamableHTTPServerTransportOptions; // Optional transport configuration options
};
You can customize the behavior of the underlying StreamableHTTPServerTransport by providing transportOptions when registering the plugin. This allows you to configure advanced transport features such as custom session ID generation and transport lifecycle callbacks.
import type { StreamableHTTPServerTransportOptions } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
await app.register(FastifyMcpServer, {
createMcpServer,
transportOptions: {
// Custom session ID generator function
sessionIdGenerator: () => {
// Return your custom session ID
return `custom-${Date.now()}-${Math.random()}`;
},
// Callback invoked when session is initialized
onsessioninitialized: async (sessionId) => {
console.log(`Session ${sessionId} initialized`);
}
// Additional StreamableHTTPServerTransport options...
}
});
GET /.well-known/oauth-authorization-server — Returns the OAuth authorization server metadata.GET /.well-known/oauth-protected-resource — Returns the OAuth protected resource metadata.These endpoints are registered only if the corresponding metadata options are provided.
A robust Fastify plugin that provides seamless integration with the Model Context Protocol (MCP) through streamable HTTP transport. This plugin enables your Fastify applications to act as MCP servers, allowing AI assistants and other clients to interact with your services using the standardized MCP protocol.
| Feature | In-Memory | Redis | Custom |
|---|---|---|---|
| **Persistence** | Lost on restart | Persists across restarts | Depends on implementation |
| **Scalability** | Single instance | Multiple instances | Depends on implementation |
| **Performance** | Fastest | Slightly slower (network) | Depends on implementation |
| **Use Case** | Development, single instance | Production, distributed systems | Specialized requirements |
| **Setup** | No configuration needed | Requires Redis server | Custom implementation needed |
基于 Fastify 的 Model Context Protocol (MCP) 服务器实现,提供高性能 HTTP 传输和会话管理功能。
该插件提供以下高级功能:事件系统、会话统计、优雅关闭、可配置的端点、自定义会话存储和自定义传输选项。
环境依赖与系统要求:Node.js、npm、Docker 和 Redis
安装步骤:使用 npm 安装 fastify-mcp-server 和 @modelcontextprotocol/sdk,或者使用 Docker Compose 运行本地开发环境
快速开始:使用 Fastify 和 fastify-mcp-server 插件创建 MCP 服务器,定义 MCP 工具和会话存储
配置说明:MCP 服务器工厂函数、端点路径、授权配置和自定义传输选项
API 参考:GET /.well-known/oauth-authorization-server 和 GET /.well-known/oauth-protected-resource 端点
Fastify MCP 服务器插件:一个强大的 Fastify 插件,提供 MCP 服务器的完整实现,支持高性能 HTTP 传输和会话管理功能
该项目提供了一个易于使用的Fastify插件,用于快速创建MCP HTTP服务,适合Node.js和TypeScript开发者使用。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ ISC 协议 — 功能等同于 BSD 2-Clause,可自由商用,无额外限制。
经综合评估,fastify-mcp-server MCP工具 在MCP工具赛道中表现稳健,质量良好。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | fastify-mcp-server |
| 原始描述 | 开源MCP工具:Fastify plugin to easily spin up Model Context Protocol (MCP) HTTP servers。⭐27 · TypeScript |
| Topics | fastifyhttpmcpnodejstypescript |
| GitHub | https://github.com/flaviodelgrosso/fastify-mcp-server |
| License | ISC |
| 语言 | TypeScript |
收录时间:2026-05-16 · 更新时间:2026-05-19 · License:ISC · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端