mcpField
M
MCP Server Template

MCP Server Template

ローカル
medium.com開発ツール183 週間前に更新

MCP Server Template について

MCP Server Templateは、インタラクティブなクイズ機能を備えたBunベースのMCPサーバー用スターターです。AIツールを開発する人向けで、カテゴリや難易度の選択肢とMCP統合テストを含みます。

主な機能

  1. 01Bunでの実行
  2. 02カテゴリ別のクイズ問題
  3. 03複数の難易度
  4. 04MCP統合テスト

活用シーン

  1. 01インタラクティブなクイズサーバーの構築
  2. 02MCPツール連携のテスト

MCP 対応

MCPサーバーとして、カテゴリと難易度を指定して問題を取得するget_quizツールをクライアントに提供します。

設定

ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。

インストール方法は未掲載です

このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。

リポジトリ

ツール

ツール一覧はまだ取得されていません

ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。

詳細

MCP サーバーテンプレート

Bun ランタイムで AI ツールを構築するための MCP スターターキット

環境要件

  • Bun:v1.0.0 以上
  • Node.js:v18.0.0 以上(一部の依存関係で必要)
  • オペレーティングシステム:
    • macOS 12 以降
    • glibc 2.31 以降の Linux
    • Windows 10 以降(WSL 経由)

機能

  • クイズに特化した MCP サーバーの実装
  • 複数のカテゴリと難易度に対応したクイズツール
  • MCP 統合テストを含む Jest テスト環境
  • 包括的なテストカバレッジ

インストール

# Clone the repository
git clone https://github.com/username/quiz-mcp-template.git
cd quiz-mcp-template

# Install dependencies
bun install

Claude Desktop の設定

{
  "quiz": {
    "command": "<your path>/.bun/bin/bun",
    "args": ["run", "<your path>/bun-mcp-template/src/index.ts"]
  }
}

使用方法

サーバーの実行
# Start the server
bun start

# Development mode (with auto-restart)
bun dev
テスト
# Run all tests
bun test

MCP ツール

このサーバーは、対話型クイズツールを提供します。

get_quiz:さまざまなカテゴリと難易度のクイズ問題を提供します

{
  "method": "tools/call",
  "params": {
    "name": "get_quiz",
    "arguments": {
      "category": "science",
      "difficulty": "medium"
    }
  },
  "jsonrpc": "2.0",
  "id": 1
}

利用可能なカテゴリ:

  • general
  • science
  • history
  • geography
  • entertainment

難易度:

  • easy
  • medium
  • hard

プロジェクト構成

quiz-mcp-template/
├── src/
│   └── index.ts       # Main Quiz MCP server implementation
├── tests/
│   └── cli-mcp.test.ts # MCP integration tests
├── package.json
├── tsconfig.json
└── README.md

開発

クイズカテゴリの拡張

新しいクイズカテゴリや問題を追加するには、src/index.ts の quizQuestions オブジェクトを変更します。

// Add new category
quizQuestions.newCategory = {
  easy: [
    { question: "Easy question 1?", answer: "Answer 1" },
    { question: "Easy question 2?", answer: "Answer 2" },
    // Add more questions...
  ],
  medium: [
    { question: "Medium question 1?", answer: "Answer 1" },
    { question: "Medium question 2?", answer: "Answer 2" },
    // Add more questions...
  ],
  hard: [
    { question: "Hard question 1?", answer: "Answer 1" },
    { question: "Hard question 2?", answer: "Answer 2" },
    // Add more questions...
  ],
};

// Don't forget to update the schema to include the new category
const QuizSchema = z.object({
  category: z
    .enum([
      "general",
      "science",
      "history",
      "geography",
      "entertainment",
      "newCategory",
    ])
    .optional()
    .describe("The category of questions to ask"),
  // ...
});

ライセンス

MIT

謝辞

このプロジェクトは、Anthropic が開発した Model Context Protocol(MCP)を使用し、AI アシスタント向けの教育用クイズツールを提供します。

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。