AgentSkillsCN

mcp-inspector

使用 MCP Inspector CLI 测试 Model Context Protocol (MCP) 服务器。

SKILL.md
--- frontmatter
name: mcp-inspector
description: Test Model Context Protocol (MCP) servers using the MCP Inspector CLI

MCP Inspector Testing Skill

Quick testing for MCP servers (stdio, HTTP, SSE). Run Inspector CLI commands to validate tools, resources, and prompts.

Quick Start

bash
# Basic tool test (local server)
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/list

# Call a tool
npx @modelcontextprotocol/inspector --cli node build/index.js \
  --method tools/call --tool-name mytool --tool-arg key=value

# Remote server (HTTP/SSE)
npx @modelcontextprotocol/inspector --cli https://server.com --method tools/list

Common Methods

MethodPurposeRequired Flags
tools/listList available toolsnone
tools/callExecute a tool--tool-name
resources/listList resourcesnone
resources/readRead resource content--uri
resources/templates/listList resource templatesnone
prompts/listList promptsnone
prompts/getGet prompt with args--prompt-name

Key CLI Flags

Transport:

  • --cli - Enable non-interactive mode (required)
  • --transport <stdio\|sse\|http> - Explicit transport type
  • --server-url <url> - Server URL for SSE/HTTP

Testing:

  • --method <name> - MCP method to call
  • --tool-arg key=value - Tool arguments (repeatable)
  • --uri <uri> - Resource URI
  • --prompt-args key=value - Prompt arguments (repeatable)

Config:

  • --config <path> - Load from mcp.json
  • --server <name> - Select server from config
  • -e KEY=VALUE - Set environment variable
  • --header "Name: Value" - HTTP headers for remote servers

Transport Auto-Detection

  • URLs ending in /mcp → HTTP (streamable)
  • URLs ending in /sse → SSE
  • No URL → stdio (local server)

Reference Docs

See references/ directory:

  • cli-flags.md - Complete flag reference
  • transports.md - stdio/SSE/HTTP details
  • testing-methods.md - All methods with examples
  • config-files.md - mcp.json patterns
  • known-issues.md - Server vs CLI bugs

Language-Specific Examples

See examples/ directory:

  • julia-stdio.md - Julia server testing
  • remote-servers.md - HTTP/SSE testing, curl, mcp-remote

Official Docs