MCP Gateway (Parent MCP Server)

MCP Gateway (Parent MCP Server)

Enables centralized management and unified interface for multiple child MCP servers (filesystem, sqlite, etc.), allowing users to discover, launch, and execute tools across different MCP servers through a single gateway.

Category
Visit Server

README

Parent MCP Server

複数の子MCPサーバーを一元管理する親MCPサーバーです。

概要

このサーバーは、複数の子MCPサーバー(filesystem, sqlite など)を登録・管理し、統一されたインターフェースで操作できるようにします。

セットアップ

1. 依存関係のインストール

uv sync

2. 子サーバー設定ファイルを用意

children_config.example.json / children_abstract.example.json をテンプレートとしてコピーし、実環境に合わせて編集してください。

cp children_config.example.json children_config.json
cp children_abstract.example.json children_abstract.json

3. uvxで起動(推奨)

GitHubに公開後、uvxから直接起動できます。

uvx --from git+https://github.com/OWNER/ParentMCPserver \
  parent-mcp-server \
  --children-config /absolute/path/to/children_config.json \
  --children-abstract /absolute/path/to/children_abstract.json

4. ローカルでの起動(リポジトリclone済みの場合)

uv run python parent_server.py \
  --children-config /absolute/path/to/children_config.json \
  --children-abstract /absolute/path/to/children_abstract.json

設定例

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "./files"],
      "env": {},
      "description": "ファイル操作を行うサーバー"
    },
    "sqlite": {
      "command": "uvx",
      "args": ["mcp-server-sqlite", "--db-path", "./test.db"],
      "env": {},
      "description": "SQLiteデータベース操作サーバー"
    }
  }
}

使用方法

このプロジェクトで使用する場合

.mcp.json に以下を設定(OWNERはご自身のGitHubアカウントに置き換えてください):

{
  "mcpServers": {
    "parent-manager": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/OWNER/ParentMCPserver",
        "parent-mcp-server",
        "--children-config",
        "/absolute/path/to/children_config.json",
        "--children-abstract",
        "/absolute/path/to/children_abstract.json"
      ],
      "env": {
        "PYTHONUTF8": "1"
      }
    }
  }
}

別プロジェクトから使用する場合

他のプロジェクトの .mcp.json にも同様に設定できます(上記と同じ構成を追加してください)。

重要: --children-config--children-abstract で実際の絶対パスを指定してください(children-abstract未指定の場合は警告を出し、children_abstractリソースは登録されません)。

提供されるツール

基本ツール

  • list_registered_children() - 登録された子サーバー一覧を取得
  • wake_child_and_get_schema(child_name) - 子サーバーを起動してスキーマを取得
  • execute_child_tool(child_name, tool_name, tool_args, head_chars=None, tail_chars=None) - 子サーバーのツールを実行し、長い出力を省略可能
  • get_children_abstract() - 子サーバー概要JSONの内容を返す(--children-abstract指定時のみ)

セッション管理ツール

  • get_active_sessions() - 現在アクティブな子サーバーセッションの一覧を取得
  • close_child_session(child_name) - 特定の子サーバーとのセッションを閉じる
  • check_child_session_health(child_name) - セッションの健全性をチェック
  • reconnect_child_session(child_name) - セッションを強制的に再接続

高度な機能

デバッグモード

環境変数 DEBUG_MCP=1 を設定すると、子サーバーのstderr出力を確認できるデバッグモードが有効になります。

DEBUG_MCP=1 uv run python parent_server.py \
  --children-config /path/to/children_config.json \
  --children-abstract /path/to/children_abstract.json

自動リトライ機能

接続失敗時は自動的に最大3回までリトライします(指数バックオフ: 1秒、2秒、4秒)。

プロジェクト構造

ParentMCPserver/
├── parent_server.py     # メインサーバーコード
├── children_config.example.json   # 子サーバー設定テンプレート
├── children_abstract.example.json # 子サーバー概要テンプレート
├── example.mcp.json               # .mcp.json設定例
├── pyproject.toml      # プロジェクト定義
├── .venv/              # 仮想環境(uv syncで作成)
└── README.md           # このファイル

トラブルシューティング

Python環境が見つからない

uv sync

を実行して、プロジェクト専用の仮想環境を作成してください。

子サーバーが起動しない

  • config.json の設定を確認
  • 子サーバーのコマンド(npx, uvx など)が利用可能か確認
  • 子サーバーの依存関係がインストールされているか確認

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured