MCPKit

Integrations

  • Provides example implementations and source code through GitHub repositories.

  • Available as an npm package for easy installation in Node.js projects.

  • Provides full TypeScript integration with type safety for creating MCP servers.

シンプルなMCP

MCP (Model Context Protocol) サーバーを作成するためのシンプルな TypeScript ライブラリ。

特徴

  • シンプルなAPI : 最小限のコードでMCPサーバーを作成
  • 型安全性: TypeScriptの完全統合
  • パラメータ検証: Zod による組み込み検証
  • MCP互換:モデルコンテキストプロトコルを完全に実装

インストール

npm install simple-mcp

クイックスタート

import { McpServer } from 'simple-mcp'; import { z } from 'zod'; // Create a server instance const server = new McpServer({ name: 'my-server' }); // Register the tool with the server server.tool({ name: 'greet', parameters: { name: z.string().describe('Person\'s name') }, execute: async ({ name }) => { return { content: [ { type: 'text', text: `Hello, ${name}! Nice to meet you.` } ] }; } }); // Start the server server.start({ transportType: 'stdio' });

クラスベースの実装

クラスを使用して MCP ツールを実装することもできます。

import { McpServer, type McpTool } from 'simple-mcp'; import { z, ZodObject } from 'zod'; const parameters = { name: z.string().describe('The name is required'), }; class GreetTool implements McpTool<typeof parameters> { public readonly name = 'greet'; public readonly parameters = parameters; public async execute({ name }: z.infer<ZodObject<typeof this.parameters>>) { return { content: [ { type: 'text', text: `Hello, ${name}! Nice to meet you.`, }, ], }; } } // Initialize a new MCP server with the name 'greet-server' const server = new McpServer({ name: 'greet-server' }); // Create an instance of the GreetTool class const greetTool = new GreetTool(); // Register the tool with the server server.tool(greetTool); // Start the server using stdio as the transport method server.start({ transportType: 'stdio' });

より完全な例については、例のディレクトリを参照してください。

貢献

貢献を歓迎します!お気軽に問題を報告したり、プルリクエストを送信してください。

ライセンス

マサチューセッツ工科大学

-
security - not tested
F
license - not found
-
quality - not tested

型安全性、パラメータ検証、最小限のコード API などの機能を備えた Model Context Protocol (MCP) サーバーを作成するためのシンプルな TypeScript ライブラリ。

  1. Features
    1. Installation
      1. Quickstart
        1. Class-based Implementation
          1. Examples
            1. Contributing
              1. License
                ID: ec71usokpf