Skip to main content
Glama
deekshu05

MCP Runbook Search Server

by deekshu05

MCP Runbook Search Server

内部のエンジニアリングランブック群に対するセマンティック検索をツールとして公開するModel Context Protocol (MCP)サーバーです — Claude Desktop、MCP互換のIDE、またはカスタムエージェントが「データベースのフェイルオーバーはどう対応する?」と尋ねると、誰かがwikiをgrepする代わりに、適切なランブックを返します。

Overview

MCPは、LLMクライアントがstdioまたはHTTP経由で別のサーバープロセスによって公開されたツールを発見・呼び出す方法を標準化します。このサーバーは、具体的で現実的なユースケース、つまり内部ナレッジベース(ランブック、ポストモーテム、プレイブック)を、クライアントごとにカスタム統合を書くことなく、任意のMCPクライアントからクエリ可能にするために、プロトコルのその側面を実装します。

このサーバーは3つのツールを公開します:

  • search_runbooks(query, top_k) — ランブックコーパスに対するセマンティック検索。コサイン類似度でランク付けされます。

  • get_runbook(doc_id) — IDで1つのランブックの全文を取得します。

  • list_runbooks() — インデックス化されたすべてのランブックのIDとタイトルを一覧表示します。

Key Features

  • 実際のMCPプロトコル(モックではない) — 公式のmcp Python SDKのFastMCPサーバー上に構築され、stdio経由で接続する実際のClientSessionでエンドツーエンドに検証されています(下記のサンプル実行を参照)— 基盤となる関数の単体テストだけではありません。

  • 依存関係のないセマンティック検索 — ハッシュエンベッダーが各ドキュメントを固定サイズのベクトルに変換します。外部モデル、APIキー、ネットワーク呼び出しは不要で、サーバーは完全にオフラインで動作します。これらのベクトルに対するコサイン類似度は、単なるキーワードの重複ではなく、意味によって結果をランク付けします。

  • ツールロジックをトランスポートから分離src/tools.pyCorpusに対するプレーンな関数を保持し、独立して単体テストされています。src/server.pyはそれらの関数をMCPツールデコレータに配線するだけです。stdioをHTTPトランスポートに、またはコーパスを実際のドキュメントストアに交換しても、ツールロジックには影響しません。

  • 明確なエラーハンドリング — 未知のIDに対するget_runbookは、例外を発生させる代わりに構造化された{"error": ...}ペイロードを返します。クライアントはどちらの場合でも実行可能な応答を受け取れます。

Architecture

MCP client (Claude Desktop, IDE, custom agent)
        │  stdio / JSON-RPC
        ▼
 FastMCP server (src/server.py)
        │  registers tools
        ▼
 tools.py  ──▶  Corpus (src/corpus.py)
                  │
                  ▼
          hashing embedder + cosine similarity
                  │
                  ▼
          5 sample engineering runbooks

Tech Stack

レイヤー

ツール

言語

Python

プロトコル

Model Context Protocol (mcp Python SDK, FastMCP)

検索

依存関係のないハッシュエンベッダー + コサイン類似度

CI/CD

GitHub Actions

Project Structure

.
├── src/
│   ├── corpus.py    # Hashing embedder, Corpus, sample runbook documents
│   ├── tools.py      # Pure tool functions (search / get / list)
│   └── server.py     # FastMCP server wiring tools.py into MCP tool decorators
├── tests/
│   ├── test_corpus.py
│   └── test_tools.py
├── .github/workflows/ci.yml
├── Dockerfile
├── requirements.txt
└── README.md

Getting Started

前提条件

  • Python 3.10+

インストール

git clone https://github.com/deekshu05/mcp-document-search-server.git
cd mcp-document-search-server
pip install -r requirements.txt

サーバーの実行

python -m src.server

これによりサーバーがstdio上で起動し、MCPクライアントの接続を待ちます。

Claude Desktopからの接続

これをclaude_desktop_config.jsonに追加します:

{
  "mcpServers": {
    "runbook-search": {
      "command": "python",
      "args": ["-m", "src.server"],
      "cwd": "/path/to/mcp-document-search-server"
    }
  }
}

Claude Desktopを再起動すると、search_runbooksget_runbooklist_runbooksがClaudeが会話内で直接呼び出せるツールになります。

Dockerでの実行

docker build -t mcp-runbook-server .
docker run -i mcp-runbook-server

Sample run

stdio経由でこのサーバーに接続し、そのツールを呼び出すPython MCPクライアントからの実際の出力です — シミュレーションされたトランスクリプトではありません:

Tools exposed: ['search_runbooks', 'get_runbook', 'list_runbooks']

search_runbooks('the primary database node is not responding'):
{
  "doc_id": "rb-001",
  "title": "Database failover procedure",
  "snippet": "Database failover procedure. When the primary Postgres node becomes
  unresponsive, promote the standby replica using the orchestrator's promote
  command, update the connection endpoint in the service config map, and verify",
  "score": 0.439
}
{
  "doc_id": "rb-003",
  "title": "Deploy rollback procedure",
  "snippet": "Deploy rollback procedure. If error rates exceed the alert
  threshold within ten minutes of a deploy, trigger the automated rollback to
  the previous stable image tag, confirm the health checks pass on all
  replicas, and po",
  "score": 0.3208
}

get_runbook('rb-001'):
{
  "doc_id": "rb-001",
  "title": "Database failover procedure",
  "text": "Database failover procedure. When the primary Postgres node becomes
  unresponsive, promote the standby replica using the orchestrator's promote
  command, update the connection endpoint in the service config map, and
  verify replication lag has dropped to zero on the new primary before
  resuming writes. Page the on-call DBA if promotion does not complete within
  five minutes."
}

クエリは「Postgres」や「フェイルオーバー」を名前で言及していません — 症状の平易な説明です — それでも検索はキーワード一致ではなく意味によって正しいランブックを最初にランク付けします。実際に2番目にランク付けされた結果(ロールバック手順)は、本当に次に関連性の高いランブックです。

Impact

このようなパターンは、以前はどのwikiページを検索すべきかを誰かが知っている必要があった内部ナレッジベースを、任意のMCP互換AIアシスタントが直接クエリして引用できるものに変え、「インシデントが発生してから」「適切なランブックが対応者の目の前に届くまで」の時間を短縮します。

Roadmap

  • より大きなコーパスに対して実行する場合、ハッシュエンベッダーを実際の埋め込みモデルに交換する

  • リモートMCPクライアント向けに、stdioに加えてストリーミング可能なHTTPトランスポートを追加する

  • サーバーを再起動せずに新しいランブックを追加できるように、ライトスルーインデックスを実装する

  • 異なるMCPクライアントがコーパスの異なるサブセットを参照できるように、認証スコープを実装する

License

MIT

-
license - not tested
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • Knowledge coverage map and health score. Ingest docs into a governed knowledge graph via MCP.

  • Read-only MCP connector serving the Run It on AI book; index and Implementation Blocks are free.

  • Query any docs site via MCP. Submit a URL, ask questions, get cited answers.

View all MCP Connectors

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/deekshu05/mcp-document-search-server'

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