MCP Server Template

local-only server

The server can only run on the client’s local machine because it depends on local resources.

MCP サーバーテンプレート 🛠️

独自のモデルコンテキストプロトコル(MCP)サーバーを構築するためのスターターテンプレートです。このテンプレートは、CursorまたはClaude Desktopで使用できるカスタムMCPを作成するために必要な基本的な構造と設定を提供します。

特徴

  • TypeScript を使用した基本的な MCP サーバーのセットアップ
  • サンプルツールの実装
  • すぐに使えるプロジェクト構造
  • @modelcontextprotocol/sdkで構築

プロジェクト構造

mcp-server-template/ ├── index.ts # Main server implementation ├── package.json # Project dependencies ├── tsconfig.json # TypeScript configuration └── build/ # Compiled JavaScript output

はじめる

  1. このテンプレートを複製します:
git clone [your-repo-url] my-mcp-server cd my-mcp-server
  1. 依存関係をインストールします:
pnpm install
  1. プロジェクトをビルドします。
pnpm run build

これにより、コンパイルされた MCP サーバー スクリプトである/build/index.jsファイルが生成されます。

カーソルの使用

  1. カーソル設定 -> MCP -> 新しいMCPサーバーの追加に移動します
  2. MCP を構成します。
    • 名前: [自分の名前を選択してください]
    • タイプ: コマンド
    • コマンド: node ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js

Claude Desktopでの使用

次の MCP 構成を Claude Desktop 構成に追加します。

{ "mcpServers": { "your-mcp-name": { "command": "node", "args": ["ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js"] } } }

発達

テンプレートには、 index.tsにサンプルツールの実装が含まれています。独自の MCP を作成するには、以下の手順を実行します。

  1. index.ts内のサーバー構成を変更します。
const server = new McpServer({ name: "your-mcp-name", version: "0.0.1", });
  1. server.tool()メソッドを使用してカスタム ツールを定義します。
server.tool( "your-tool-name", "Your tool description", { // Define your tool's parameters using Zod schema parameter: z.string().describe("Parameter description"), }, async ({ parameter }) => { // Implement your tool's logic here return { content: [ { type: "text", text: "Your tool's response", }, ], }; } );
  1. 実装をビルドしてテストします。
npm run build

貢献

問題や機能強化のリクエストをお気軽にお寄せください。

ライセンス

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

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

Cursor または Claude Desktop と統合できるモデル コンテキスト プロトコル サーバーを構築するためのスターター テンプレート。開発者は AI アシスタント用のカスタム ツールと拡張機能を作成できます。

  1. Features
    1. Project Structure
      1. Getting Started
        1. Using with Cursor
          1. Using with Claude Desktop
            1. Development
              1. Contributing
                1. License
                  ID: vnt96edg3a