Skip to main content
Glama
Nagendda

MCP Tool Manager

by Nagendda

MCP Tool Manager

本番運用に耐える堅牢な、AIネイティブなツールレジストリおよびエージェント管理システム。Model Context Protocol (MCP) に基づいて構築されています。

Node.js License: MIT MCP Security


📖 目次

  1. これは何か?

  2. アーキテクチャ概要

  3. プロジェクト構成

  4. クイックスタート

  5. 設定リファレンス

  6. APIリファレンス

  7. 実装計画

  8. セキュリティモデル

  9. モニタリングと可観測性

  10. ロードマップ

  11. コントリビューション


Related MCP server: mcp-tool-gateway

これは何か?

MCP Tool Manager は、AI統合ツールシステムにおける最も困難な運用課題を解決するデュアルサーバープラットフォームです。

問題

解決策

巨大なAPIレスポンスでLLMのコンテキストウィンドウを消費する

ツールごとのバイト予算と、グレースフルなトランケーション通知

上流APIの障害がLLMに連鎖する

ツールごとのサーキットブレーカー(CLOSED → OPEN → HALF-OPEN)

サーバー再起動ですべてのデータが失われる

定期的な自動ディスクスナップショット、起動時に復元

APIゲートウェイへのブルートフォース/インジェクション攻撃

10系統の脅威検出器+段階的レート制限+IP自動ブロック

リクエストをエンドツーエンドでトレースする手段がない

全レイヤーおよび上流APIに伝播されるX-Trace-IDヘッダー

ツール/エージェントが揮発性メモリのみに登録される

ファイル永続化されたコールログ+エージェントJSON設定+状態スナップショット


アーキテクチャ概要

┌─────────────────────────────────────────────────────────────────────────┐
│                        MCP Tool Manager Platform                        │
│                                                                         │
│  ┌──────────────────────┐        ┌────────────────────────────────────┐ │
│  │   Manager Server      │        │    Hardened MCP Server             │ │
│  │   src/server          │        │    mcp-server-project              │ │
│  │                       │        │                                    │ │
│  │  • REST API (CRUD)    │        │  • MCP Protocol endpoint           │ │
│  │  • JWT + API key auth │        │  • Agent API key auth + expiry     │ │
│  │  • Tool registry      │        │  • Circuit breaker per tool        │ │
│  │  • Agent management   │        │  • Retry + exponential backoff     │ │
│  │  • Credential vault   │        │  • Response cache (TTL per tool)   │ │
│  │  • Audit log          │        │  • Context window limiting         │ │
│  │  • State snapshots    │        │  • File-persisted call log         │ │
│  │  • WebSocket events   │        │  • 10-family threat detection      │ │
│  │  • Response cache     │        │  • Admin /metrics endpoint         │ │
│  └──────────┬───────────┘        └──────────────┬─────────────────────┘ │
│             │                                    │                       │
│  ┌──────────▼───────────┐        ┌──────────────▼─────────────────────┐ │
│  │   React Dashboard     │        │    Claude Desktop / LLM Agent      │ │
│  │   src/dashboard       │        │    (connects via MCP SDK)          │ │
│  └──────────────────────┘        └────────────────────────────────────┘ │
│                                                                         │
│  ┌──────────────────────────────────────────────────────────────────┐   │
│  │  Cross-cutting: X-Trace-ID · Rate Limiting · Helmet CSP ·        │   │
│  │  Structured Logging · Connection Limit · Compression             │   │
│  └──────────────────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────────────────┘

プロジェクト構成

mcp/
├── .env.example                    # Template — copy to .env and fill in values
├── .gitignore                      # Excludes .env, node_modules, logs, snapshots
├── package.json                    # Root scripts — start both servers, CLI, tests
├── README.md                       # This file
├── REPORT.md                       # Full technical capability report
├── CHANGELOG.md                    # Version history
│
├── src/
│   ├── server/                     # Manager Server (REST API)
│   │   ├── index.js                # Entry point — snapshot restore + server start
│   │   ├── app.js                  # Express app — all middleware wired
│   │   ├── routes/
│   │   │   ├── tools.js            # CRUD + test execution for tools
│   │   │   ├── agents.js           # Agent management + tool discovery
│   │   │   ├── auth.js             # Login, register, API key management
│   │   │   ├── credentials.js      # Encrypted credential vault
│   │   │   └── monitoring.js       # Stats, audit log, cache, snapshot status
│   │   ├── middleware/
│   │   │   ├── auth.js             # JWT + API key auth + RBAC
│   │   │   └── error-handler.js    # Typed errors + global handler
│   │   ├── storage/
│   │   │   ├── in-memory-store.js  # All in-memory Maps + operations
│   │   │   ├── seeder.js           # Initial data (skipped if snapshot exists)
│   │   │   └── state-snapshot.js   # Periodic disk snapshots (JSON files)
│   │   ├── utils/
│   │   │   ├── trace.js            # X-Trace-ID middleware
│   │   │   ├── context-limit.js    # Response byte budget + pagination guard
│   │   │   ├── response-cache.js   # node-cache wrapper + TTL presets
│   │   │   ├── encryption.js       # AES-256-CBC for credential vault
│   │   │   └── logger.js           # Levelled logger (error/warn/info/debug)
│   │   └── websocket.js            # Real-time events via WebSocket
│   │
│   ├── dashboard/                  # React + Vite management UI
│   │   ├── src/
│   │   │   ├── pages/              # Dashboard, Tools, Agents, Monitoring, Settings
│   │   │   ├── components/         # Sidebar, Topbar, ToastContainer
│   │   │   ├── services/api.js     # Axios client for Manager Server
│   │   │   └── styles/             # global.css, sidebar.css
│   │   └── vite.config.js
│   │
│   ├── sdk/
│   │   └── index.js                # Developer SDK — npm-publishable client
│   │
│   └── cli/
│       └── index.js                # Admin CLI (17 commands)
│
├── mcp-server-project/             # Hardened MCP Server
│   ├── package.json
│   ├── src/
│   │   ├── server.js               # Boot sequence — all 7 security layers
│   │   ├── mcp-protocol.js         # MCP spec endpoint (/mcp/tools, /mcp/invoke)
│   │   ├── routes/
│   │   │   ├── invoke.js           # Tool invocation (retry + CB + cache + limit)
│   │   │   ├── info.js             # Tool discovery per agent
│   │   │   └── metrics.js          # Admin monitoring endpoint
│   │   ├── middleware/
│   │   │   ├── auth.js             # Agent auth + expiry + scope + disabled check
│   │   │   ├── trace.js            # X-Trace-ID attachment
│   │   │   └── context-limit.js    # Response byte budget
│   │   ├── state/
│   │   │   ├── call-log.js         # Disk-persisted call log (NDJSON)
│   │   │   ├── circuit-breaker.js  # Per-tool CLOSED/OPEN/HALF state machine
│   │   │   └── response-cache.js   # TTL cache with auto-eviction
│   │   ├── loaders/
│   │   │   ├── registry.js         # Central tool+agent in-memory registry
│   │   │   ├── tool-loader.js      # Loads *.json from /tools/
│   │   │   ├── agent-loader.js     # Loads *.json from /agents/
│   │   │   └── credential-loader.js # Merges .env + JSON credentials
│   │   └── watcher.js              # chokidar hot-reload on /tools/ and /agents/
│   ├── security/
│   │   ├── middleware/
│   │   │   ├── security-headers.js # Strict Helmet CSP + CORS
│   │   │   ├── rate-limiter.js     # 3-tier rate limiting + IP auto-block
│   │   │   └── threat-detector.js  # 10-family injection/attack detector
│   │   └── logger/
│   │       └── security-log.js     # Structured security event log (5 levels)
│   ├── tools/                      # Tool definition JSON files
│   ├── agents/                     # Agent definition JSON files
│   ├── credentials/                # .env and JSON secrets (gitignored)
│   ├── logs/                       # Security log + call log (gitignored)
│   └── security-tests/             # Attack simulation suite + benchmark
│
├── snapshots/                      # Manager server state snapshots (gitignored)
└── examples/                       # Example tool/agent JSON files

クイックスタート

前提条件

要件

バージョン

Node.js

≥ 16.0.0

npm

≥ 7.0.0

Git

任意

1. クローン

git clone https://github.com/YOUR_USERNAME/mcp-tool-manager.git
cd mcp-tool-manager

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

# Root (Manager Server + CLI + SDK)
npm install

# Dashboard
cd src/dashboard && npm install && cd ../..

# MCP Server
cd mcp-server-project && npm install && cd ..

3. 設定

# Manager Server
cp .env.example .env
# Edit .env with your JWT_SECRET, ENCRYPTION_KEY, etc.

# MCP Server
cp mcp-server-project/credentials/.env.example mcp-server-project/credentials/.env
# Edit credentials/.env with your agent keys and tool API keys

4. 実行

# Terminal 1 — Manager Server (port 5000)
npm run dev:server

# Terminal 2 — React Dashboard (port 3000)
npm run dev:dashboard

# Terminal 3 — MCP Server (port 5001 by default)
cd mcp-server-project && npm start

5. アクセス

インターフェース

URL

ダッシュボード

http://localhost:3000

マネージャーAPI

http://localhost:5000

マネージャーヘルスチェック

http://localhost:5000/api/monitoring/health

MCPサーバー

http://localhost:5001

MCPヘルスチェック

http://localhost:5001/health

MCPメトリクス

http://localhost:5001/metrics/health

デフォルトログイン(マネージャー)

Email:    admin@mcp-tool-manager.dev
Password: admin123

⚠️ 本番環境では、ADMIN_USERNAME / ADMIN_PASSWORD 環境変数を使用して直ちに変更してください。


設定リファレンス

マネージャーサーバー(.env

# Core
NODE_ENV=development
MCP_SERVER_PORT=5000
MCP_SERVER_HOST=localhost
LOG_LEVEL=info

# Auth
JWT_SECRET=your-super-secret-key-min-32-chars
JWT_EXPIRY=24h
ENCRYPTION_KEY=your-encryption-key-exactly-32-ch

# Context Window
MCP_MAX_RESPONSE_BYTES=65536        # 64 KB default response budget
MCP_MAX_PAGE_SIZE=100               # Max items per paginated endpoint

# Scalability
MCP_MAX_CONNECTIONS=500             # TCP connection limit
SNAPSHOT_DIR=./snapshots            # State persistence directory
SNAPSHOT_INTERVAL_SECS=60           # Save state every 60 seconds
SNAPSHOT_RESTORE=true               # Restore state on startup

# Cache TTLs (seconds)
CACHE_TTL_TOOL_LIST=30
CACHE_TTL_TOOL_ITEM=60
CACHE_TTL_AGENT_LIST=30
CACHE_TTL_STATS=10
CACHE_TTL_ACTIVITY=300

# Future (not yet wired — provide connection string to enable)
DATABASE_URL=postgresql://user:password@localhost:5432/mcp_tools
REDIS_URL=redis://localhost:6379

MCPサーバー(mcp-server-project/credentials/.env

# Agent API Keys (convention: AGENT_<AGENTID_UPPERCASE>_KEY)
AGENT_MY_AGENT_KEY=your-agent-secret-key

# Tool credentials (referenced by credential_ref in tool JSON)
OPENAI_API_KEY=sk-...
WEATHER_API_KEY=...
SLACK_BOT_TOKEN=xoxb-...

# Admin
ADMIN_KEY=your-admin-key-for-metrics-endpoint

# Server
MCP_PORT=5001
MCP_MAX_CONNECTIONS=200
MCP_MAX_RESPONSE_BYTES=32768        # 32 KB default per tool response

ツールJSONフィールド(MCPサーバー)

{
  "name": "my_tool",
  "description": "Human-readable description for the LLM",
  "endpoint_url": "https://api.example.com/endpoint",
  "method": "POST",
  "credential_ref": "MY_API_KEY",
  "parameters": {
    "type": "object",
    "properties": {
      "query": { "type": "string", "description": "Search query" }
    },
    "required": ["query"]
  },
  "cache_ttl_seconds": 60,
  "max_response_bytes": 8192,
  "retry_max": 3,
  "timeout_ms": 10000,
  "circuit_failure_threshold": 5,
  "circuit_open_window_ms": 30000
}

エージェントJSONフィールド(MCPサーバー)

{
  "agent_id": "my-agent",
  "allowed_tools": ["weather_lookup", "send_email"],
  "expires_at": "2027-01-01T00:00:00Z",
  "disabled": false
}

APIリファレンス

マネージャーサーバー(http://localhost:5000

認証

メソッド

パス

認証

説明

POST

/api/auth/login

JWTトークンを取得

POST

/api/auth/register

アカウントを作成

GET

/api/auth/me

現在のユーザー+APIキー

POST

/api/auth/api-keys

新しいAPIキーを生成

DELETE

/api/auth/api-keys/:key

APIキーを失効

ツール

メソッド

パス

認証

説明

GET

/api/tools

ツール一覧(ページング対応)

POST

/api/tools

新しいツールを登録

GET

/api/tools/:id

ツール詳細

PUT

/api/tools/:id

ツールを更新

DELETE

/api/tools/:id

ツールを削除

POST

/api/tools/:id/test

ツール呼び出しをテスト

エージェント

メソッド

パス

認証

説明

GET

/api/agents

エージェント一覧

POST

/api/agents

エージェントを登録

GET

/api/agents/:id

エージェント詳細

PUT

/api/agents/:id

エージェントを更新

DELETE

/api/agents/:id

エージェントを削除

POST

/api/agents/:id/tools

エージェント用のツールを探索

モニタリング

メソッド

パス

認証

説明

GET

/api/monitoring/health

生存確認プローブ

GET

/api/monitoring/stats

システム全体の統計+キャッシュ+スナップショット

GET

/api/monitoring/activity

実際の時間別コールタイムライン(24時間)

GET

/api/monitoring/top-tools

呼び出し回数上位N件のツール

GET

/api/monitoring/audit-log

監査エントリ

GET

/api/monitoring/cache

キャッシュヒット率+エントリ

GET

/api/monitoring/snapshot

最終スナップショットのタイムスタンプ+件数

MCPサーバー(http://localhost:5001

メソッド

パス

認証

説明

GET

/health

生存確認プローブ

GET

/info

AGENT_KEY

呼び出し元エージェント用のツール一覧

GET

/info/all

ADMIN_KEY

全ツール+全エージェント

GET

/mcp/tools

Claude Desktop互換のツール一覧

POST

/mcp/invoke/:tool

MCPプロトコル呼び出し

POST

/invoke/:toolName

AGENT_KEY

直接ツール呼び出し

GET

/metrics

ADMIN_KEY

完全なモニタリングダッシュボード

GET

/metrics/health

軽量な生存確認プローブ

GET

/metrics/calls

ADMIN_KEY

最近のコール履歴


実装計画

このセクションでは、完全なロードマップを説明します — 構築済みのもの、進行中のもの、そしてインフラストラクチャの決定が必要なものです。

フェーズ1 — 基盤 ✅ 完了

  • マネージャーサーバーのREST API(ツール、エージェント、認証、認証情報、モニタリング)

  • 完全なCRUD操作を備えたインメモリストア

  • RBACを備えたJWT+APIキーの二重認証

  • AES-256-CBCによる認証情報ボールト

  • Reactダッシュボード(ツール、エージェント、モニタリング、設定ページ)

  • WebSocketによるリアルタイムイベント配信

  • 開発者向けSDK(src/sdk/index.js

  • 17コマンドを備えた管理CLI(src/cli/index.js

  • MCPプロトコルエンドポイント(Claude Desktop互換)

  • ホットリロード対応のファイルベースのツール/エージェントレジストリ(chokidar

  • リングバッファ方式の監査ログ

フェーズ2 — セキュリティ強化 ✅ 完了

  • 10系統の脅威検出器(SQL/NoSQL/XSS/SSRF/Shell/Template/Path/CMDi/Null/Headerインジェクション)

  • スキャナーのユーザーエージェントブロック(sqlmap、nikto、nmap、Burp Suite、20以上のスキャナー)

  • 3段階のレート制限(グローバル+厳格+スローダウン)

  • ブルートフォース後の自動IPブロック(20回以上のヒット)

  • 5段階の重大度レベルを持つ構造化セキュリティイベントログ

  • Helmetによる厳格なCSP(defaultSrc: 'none'

  • エージェントキーの有効期限+無効化フラグ

  • スコープの強制(requireScopeミドルウェア)

  • 認証失敗+スコープ違反のセキュリティログ

  • セキュリティテストスイート+ベンチマーク(強化版と非保護版の比較)

フェーズ3 — 運用機能 ✅ 完了(本リリース)

  • X-Trace-ID — 全レイヤーと上流APIに伝播される一意のリクエスト相関ID

  • サーキットブレーカー — ツールごとのCLOSED/OPEN/HALF-OPEN(設定可能なしきい値)

  • 指数バックオフによるリトライ — 200ms → 400ms → 800ms、4xxエラーはスキップ

  • レスポンスキャッシュ — ツール/データ型ごとのTTL、ヒット率追跡、プレフィックス無効化

  • コンテキストウィンドウ制限 — ツールごとのバイト予算、シグナリング付きグレースフルなトランケーション

  • ページネーションガード — グローバルな?limitクランプ(デフォルト最大100件)

  • 状態スナップショット — 定期的なアトミック書き込み、起動時に復元(ツール/エージェント/ユーザーは再起動後も保持)

  • 接続数制限ガード — 設定可能な最大値を超えるTCPソケットを切断

  • レート制限を有効化(マネージャー) — IPごとに毎分グローバル300回+認証15回

  • 実際のモニタリング — 実際のコールデータに基づくアクティビティタイムライン(Math.random()モックを削除)

  • /metricsエンドポイント(MCP) — 完全な管理ダッシュボード(コール、キャッシュ、サーキットブレーカー、メモリ)

  • node-cacheを有効化(マネージャー) — データ型ごとのTTLプリセット、ヒット率追跡

  • /api/monitoring/cache/api/monitoring/snapshot の新しいエンドポイント

フェーズ4 — 永続化と分散 🔲 インプット待ち

これらにはインフラストラクチャが必要です。pgioredis はすでにインストールされています — 必要なのは接続文字列のみです。

  • PostgreSQLin-memory-store.js を永続データベースに移行

    • toolsagentsusersapi_keyscredentialsaudit_log テーブル

    • pg によるコネクションプール(DATABASE_URL.env.example にすでに記載)

  • Redis — 共有レート制限+セッション+レスポンスキャッシュストア

    • マルチインスタンス安全性のため、node-cache を ioredis に置き換え

    • 全サーバーインスタンス間での共有IPブロックリスト

    • REDIS_URL.env.example にすでに記載)

  • 水平スケーリング — Redis+Postgresの接続後、nginxの背後にNインスタンスをデプロイ

フェーズ5 — 開発者体験 🔲 オプション

  • OpenAPI/Swagger仕様の自動生成(swagger-jsdoc

  • 起動時のzod環境スキーマ検証(設定欠落時にフェイルファスト)

  • JWTリフレッシュトークン+ブラックリスト

  • Prometheusメトリクスエクスポート(/metrics/prometheusエンドポイント)

  • OpenTelemetry分散トレーシング

  • ツール互換性マトリックス

  • サーキットブレーカーの状態をリアルタイム表示するWebSocketダッシュボード


セキュリティモデル

マネージャーサーバー

Request
  │
  ├── X-Trace-ID attachment (Layer 0)
  ├── Helmet strict CSP (Layer 1)
  ├── Global rate limit 300/min (Layer 2a)
  ├── Auth rate limit 15/min on /api/auth (Layer 2b)
  ├── Body size limit 2 MB (Layer 3)
  ├── Context window budget (Layer 4)
  ├── Pagination guard max 100 items (Layer 5)
  ├── JWT / API key verification (per-route)
  └── RBAC role check (per-route)

MCPサーバー

Request
  │
  ├── X-Trace-ID attachment (Layer 0)
  ├── Strict Helmet CSP (Layer 1)
  ├── IP block list check (Layer 2)
  ├── Body size guard (Layer 3)
  ├── Context window budget (Layer 4)
  ├── HTTP method whitelist (Layer 5)
  ├── Scanner user-agent block (Layer 6)
  ├── Global rate limit + speed slow-down (Layer 7)
  ├── 10-family threat detection (Layer 8)
  ├── Agent API key auth + expiry + disabled check (per-route)
  ├── Tool scope enforcement (per-route)
  ├── Circuit breaker check (per-tool)
  ├── Response cache lookup (per-tool)
  └── Retry + context limit on upstream call (per-tool)

モニタリングと可観測性

利用可能なデータ

ソース

表示内容

GET /api/monitoring/stats

システム概要、キャッシュ統計、スナップショット情報、コンテキスト制限設定

GET /api/monitoring/activity

実際の24時間の時間別コールタイムライン(成功数+エラー数)

GET /api/monitoring/top-tools

コール数と成功率で見た上位ツール

GET /api/monitoring/audit-log

すべての管理者操作(ツール作成/削除、エージェント追加/削除)

GET /api/monitoring/cache

キャッシュヒット率、エントリ数、エビクション数

GET /api/monitoring/snapshot

最終スナップショットのタイムスタンプ+レコード数

GET /metrics (MCP、管理者)

サーキットブレーカーの状態、コールログ、キャッシュ統計、システムメモリ

GET /metrics/health (MCP、公開)

アップタイム+メモリ(軽量プローブ)

logs/calls.ndjson (MCP)

完全なコール履歴:トレースID、エージェント、ツール、レイテンシ、成功、リトライ

logs/security.log (MCP)

すべてのセキュリティイベント:AUTH 失敗、脅威、レート制限、サーキットブレーカーのトリップ

snapshots/meta.json (Manager)

最終スナップショット:タイムスタンプ+全データ種別の件数

X-Trace-ID フロー

Client → [generates or passes X-Trace-ID]
  → Manager/MCP Server [attaches to req.traceId, echoes in X-Trace-ID response header]
    → Security log entries [include traceId]
      → Call log entries [include traceId]
        → Upstream API call [X-Trace-ID forwarded in headers]
          → Response [traceId in JSON body]

ロードマップ

v2.1(次期)

  • 永続ストレージ用に PostgreSQL を接続

  • 分散レート制限+キャッシュ用に Redis を接続

  • 起動時における zod による環境変数スキーマ検証

v2.2

  • JWT リフレッシュトークン+ブラックリスト

  • Prometheus メトリクスエクスポート

  • APIキーごとのレート制限(IPベースではない)

v3.0

  • 完全な OpenAPI 仕様

  • OpenTelemetry による分散トレーシング

  • OAuth2/OIDC によるエージェントのフェデレーション ID


コントリビューティング

ブランチ戦略、PRプロセス、コードスタイルガイドについては、CONTRIBUTING.md を参照してください。


ライセンス

MIT © MCP Tool Manager Team


完全な技術能力評価については REPORT.md を参照してください。

A
license - permissive license
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 Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    A secure tool-execution plane for agentic AI that enforces JWT authentication, rate limiting, prompt-injection inspection, and audit logging, while ingesting downstream OpenAPI endpoints as MCP tools.
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to access a unified catalog of tools from various APIs (OpenAPI, GraphQL, MCP, Google Discovery) through the MCP protocol.
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables AI agents to securely call MCP tools with risk scoring, checkpoints, rollback, and approval workflows.
    134
    MIT

View all related MCP servers

Related MCP Connectors

  • Hosted MCP endpoint with realistic fake data for prototyping agents. 12 tools, no setup.

  • Free public MCP for AI agents — 193 tools, 44 workflows. No API key.

  • Hosted MCP with 91 agent tools: X, domains, SEO, Maps, Trends, Search, YouTube, TikTok, and more.

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/Nagendda/MCP-Tool-Manager'

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