
platformatic/mcp
Analytics & monitoringこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
JSON-RPC 2.0 を使用したモデルコンテキストプロトコル (MCP) サーバを実装する Fastify プラグインです。 このプラグインは、FastifyアプリケーションがMCPの後にツール、リソース、およびプロンプトを公開することができます...
概要
JSON-RPC 2.0 を使用したモデルコンテキストプロトコル (MCP) サーバを実装する Fastify プラグインです。 このプラグインは、MCP 2025-06-18 仕様をフルデリシテーションサポートで追随するツール、リソース、およびプロンプトを公開するために、Fastify アプリケーションを有効にします。 type-safe スキーマ検証では、TypeBox をインストールします。 - : フルモデルコンテキストプロトコルの仕様をelicitation で実装 - : Server-to-client 情報リクエストスキーマの検証 - : 自動TypeScript 推論による Type-safe スキーマの検証 - : 入力サニタイゼーション、レート制限、およびセキュリティ評価 - : HTTP/SSE および stdio トランスフォーメーション 柔軟な通信 - : リアルタイム通信のための Server-Sent イベント - : Redis-backed セッション管理とメッセージ放送 - : 送信されたセッション管理とメッセージをシームレスにサポートします。 - ローカルセキュリティ機能とサポート - ローカルセキュリティをシームレスに切り替える - プラグインは、elicitation 機能をサポートしています,...
概要(AI 翻訳)
JSON-RPC 2.0 を使用したモデルコンテキストプロトコル (MCP) サーバを実装する Fastify プラグインです。 このプラグインは、MCP 2025-06-18 仕様をフルデリシテーションサポートで追随するツール、リソース、およびプロンプトを公開するために、Fastify アプリケーションを有効にします。
インストール
TypeBox サポート(オプション)
type-safe スキーマ検証では、TypeBox をインストールします。
##特徴
- 完全なMCP 2025-11-25サポート:古いクライアントの[
2025-06-18]および[2024-11-05に交渉する現在のモデルコンテキストプロトコルの修正を実装する - タスク(実験的): タスク処理ツールは、ポーリング、遅延結果の検索、キャンセルと呼びます -Elicitation Support:スキーマ検証で、フォームとURLモードの両方でサーバーツークライアント情報リクエスト
- アイコン:ツール、リソース、リソーステンプレート、プロンプトのオプションのアイコンメタデータ
- TypeBox Validation:Type-safeスキーマ検証と自動TypeScript推論
- セキュリティの強化: 入力サニタイゼーション、レート制限、セキュリティ評価
- 複数の輸送サポート:適用範囲が広いコミュニケーションのためのHTTP/SSEおよびstdioの輸送
- SSE Streaming:リアルタイム通信のためのサーバー送信イベント
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
Fastify MCP Server
A Fastify plugin that implements the Model Context Protocol (MCP) server using JSON-RPC 2.0. This plugin enables Fastify applications to expose tools, resources, and prompts following the MCP 2025-06-18 specification with full elicitation support.
Installation
npm install @platformatic/mcp
TypeBox Support (Optional)
For type-safe schema validation, install TypeBox:
npm install @sinclair/typebox
Features
- Complete MCP 2025-11-25 Support: Implements the current Model Context Protocol revision, negotiating down to
2025-06-18,2025-03-26and2024-11-05for older clients - Tasks (experimental): Task-augmented tool calls with polling, deferred result retrieval and cancellation
- Elicitation Support: Server-to-client information requests in both form and URL mode, with schema validation
- Icons: Optional icon metadata on tools, resources, resource templates and prompts
- TypeBox Validation: Type-safe schema validation with automatic TypeScript inference
- Security Enhancements: Input sanitization, rate limiting, and security assessment
- Multiple Transport Support: HTTP/SSE and stdio transports for flexible communication
- SSE Streaming: Server-Sent Events for real-time communication
- Horizontal Scaling: Redis-backed session management and message broadcasting
- Session Persistence: Message history and reconnection support with Last-Event-ID
- Memory & Redis Backends: Seamless switching between local and distributed storage
- Production Ready: Comprehensive test coverage, security features, and authentication support
Quick Start
import Fastify from 'fastify'
import mcpPlugin from '@platformatic/mcp'
// Or use named import:
// import { mcpPlugin } from '@platformatic/mcp'
const app = Fastify({ logger: true })
// Register the MCP plugin
await app.register(mcpPlugin, {
serverInfo: {
name: 'my-mcp-server',
version: '1.0.0'
},
capabilities: {
tools: { listChanged: true },
resources: { subscribe: true },
prompts: {}
},
instructions: 'This server provides custom tools and resources'
})
// Add tools, resources, and prompts with handlers
app.mcpAddTool({
name: 'calculator',
description: 'Performs basic arithmetic operations',
inputSchema: {
type: 'object',
properties: {
operation: { type: 'string', enum: ['add', 'subtract', 'multiply', 'divide'] },
a: { type: 'number' },
b: { type: 'number' }
},
required: ['operation', 'a', 'b']
}
}, async (params) => {
const { operation, a, b } = params
let result
switch (operation) {
case 'add': result = a + b; break
case 'subtract': result = a - b; break
case 'multiply': result = a * b; break
case 'divide': result = a / b; break
default: throw new Error('Invalid operation')
}
return {
content: [{ type: 'text', text: `Result: ${result}` }]
}
})
app.mcpAddResource({
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →