MCP Inspector as MCP Server

MCP Inspector as MCP Server

Enables LLMs to inspect and test other MCP servers by listing and calling their tools, reading resources, and getting prompts. Supports stdio, SSE, and HTTP transports for both local and remote MCP server inspection.

Category
访问服务器

README

MCP Inspector as MCP Server

A lean MCP server that enables LLMs to inspect and test other MCP servers. This is a self-contained implementation that uses the MCP SDK directly, without shelling out to external CLIs.

Features

  • Direct SDK integration: Uses @modelcontextprotocol/sdk directly for both server and client operations
  • All transport types: Supports stdio, SSE, and HTTP (streamable) transports
  • Minimal footprint: Single dependency (@modelcontextprotocol/sdk)
  • Full MCP inspection: List tools, call tools, list resources, read resources, list prompts, get prompts
  • Session management: Persistent connections with automatic garbage collection
  • Event buffering: Capture notifications, traffic, and errors for debugging

Installation

npm install
npm run build

Usage

As an MCP Server

Add to your MCP config. While there are slight variances between different harnesses, the general format is the same:

{
  "mcpServers": {
    "mcp-inspector": {
      "command": "node",
      "args": ["/path/to/mcp-inspector-as-mcp-server/dist/server.js"]
    }
  }
}

Available Tools

Session Management (NEW in v2.0)

Tool Description
insp_connect Establish a persistent connection to an MCP server. Returns a session_id.
insp_disconnect Close a persistent session and release resources.
insp_list_sessions List all active sessions with their status and idle time.
insp_read_events Read buffered events (notifications, traffic, errors) from a session.

Inspection Tools

Tool Description
insp_tools_list List all tools exposed by an MCP server
insp_tools_call Call a tool on an MCP server
insp_resources_list List all resources exposed by an MCP server
insp_resources_read Read a specific resource
insp_resources_templates List resource templates
insp_prompts_list List all prompts
insp_prompts_get Get a specific prompt

Connection Parameters

All tools accept the following connection parameters:

For stdio transport (local commands):

  • command: Command to run (e.g., "node", "python")
  • args: Array of arguments (e.g., ["path/to/server.js"])

For SSE/HTTP transport (remote servers):

  • url: Server URL (e.g., "http://localhost:3000/sse")
  • headers: Optional HTTP headers object

Common:

  • transport: Force transport type ("stdio", "sse", or "http"). Auto-detected if not specified.
  • session_id: (Optional) Use an existing persistent session instead of creating an ephemeral connection.

Session Workflow

For debugging stateful server behavior, use persistent sessions:

1. insp_connect → returns session_id
2. insp_tools_list (with session_id) → uses persistent connection
3. insp_tools_call (with session_id) → state is preserved
4. insp_read_events (with session_id) → see notifications
5. insp_disconnect (with session_id) → cleanup

Sessions auto-close after 30 minutes of inactivity.

Examples

List tools from a local MCP server (ephemeral):

{
  "command": "node",
  "args": ["/path/to/some-mcp-server/dist/server.js"]
}

Create a persistent session:

{
  "command": "node",
  "args": ["/path/to/some-mcp-server/dist/server.js"]
}
// Returns: { "session_id": "sess_abc123", "server_info": {...} }

Call a tool using a session:

{
  "session_id": "sess_abc123",
  "tool_name": "search",
  "tool_args": {"query": "hello"}
}

Architecture

src/
├── server.ts     # MCP server exposing inspector tools
├── client.ts     # Client wrapper (hybrid stateless/session mode)
├── transport.ts  # Transport factory (stdio, SSE, HTTP)
├── session.ts    # SessionRegistry with GC (30-min TTL)
└── events.ts     # EventBuffer (ring buffer for notifications)

Why This Exists

The original MCP Inspector is a web-based UI + CLI combo spread across multiple projects. This consolidates the core functionality into a single, lean MCP server that an LLM can use to:

  1. Develop and debug MCP servers iteratively
  2. Test MCP server functionality without leaving the conversation
  3. Explore what tools/resources/prompts an MCP server exposes
  4. Debug stateful behavior with persistent sessions

Changelog

v2.0.0

  • Added session management (insp_connect, insp_disconnect, insp_list_sessions)
  • Added event buffering (insp_read_events)
  • All inspection tools now support optional session_id for persistent connections
  • Added automatic garbage collection (30-minute TTL for idle sessions)
  • Backward compatible: omit session_id for original ephemeral behavior

v1.0.0

  • Initial release with ephemeral connections

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选