Skip to main content
Glama

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

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

特徴

  • TypeScript を使用した基本的な MCP サーバーのセットアップ

  • サンプルツールの実装

  • すぐに使えるプロジェクト構造

  • @modelcontextprotocol/sdkで構築

Related MCP server: MCP Server Boilerplate

プロジェクト構造

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

貢献

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

ライセンス

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

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hypermodel-labs/mcp-server-template'

If you have feedback or need assistance with the MCP directory API, please join our Discord server