MCP Server CLI Inspector for Model Context Protocol
Inspect MCP server contexts and messages with the CLI Inspector for the Model Context Protocol by wong2.
npx @wong2/mcp-cliOverview
The MCP Server CLI Inspector is a lightweight command-line utility for interacting with servers that implement the Model Context Protocol (MCP). It connects to an MCP-compatible server to enumerate, inspect, stream, and export model contexts and the messages/events associated with them. For developers integrating with LLM systems, the inspector makes it easier to debug context composition, audit message history, and reproduce behaviors by turning live context traces into portable artifacts.
The tool is intended for local development, CI troubleshooting, and incident investigation. It provides quick visibility into context state (active contexts, metadata, and message payloads), supports tailing updates in real time, and can dump entire contexts to JSON/JSONL for downstream analysis or replay.
Features
- Connect to any MCP-compatible server via URL and API token
- List and filter available contexts and sessions
- Inspect single context metadata and full message histories
- Stream (tail) live messages from a context
- Export contexts/messages as JSON or JSONL for audits and replays
- Lightweight CLI suitable for scripts and CI pipelines
- Configurable time ranges, limits, and output formats
Installation / Configuration
Install a prebuilt binary (recommended)
- Download the latest release for your platform from the GitHub Releases page, unpack and move to a directory on your PATH:
# example (Mac/Linux)
Install with Go (if a Go module build is available)
Docker (run without installing)
Configuration
- The CLI supports a per-user config file (YAML or JSON) and environment variables. Create a configuration at ~/.mcp/config.yaml:
# ~/.mcp/config.yaml
server_url: "https://mcp.example.com"
api_key: "sk-REPLACE_WITH_YOUR_KEY"
timeout_seconds: 15
Or set environment variables:
Command-line flags override config file and environment variables.
Available Tools / Resources
- CLI executable: mcp-inspect — primary interface for interacting with MCP servers
- Config file: ~/.mcp/config.yaml — persistent connection settings and defaults
- Output formats: json, jsonl, pretty (table/text)
- GitHub repo and release artifacts: https://github.com/wong2/mcp-cli
- MCP protocol spec and server implementations: consult your MCP server documentation for endpoints and authentication details
Common commands (summary table)
| Command | Description | ||||||
|---|---|---|---|---|---|---|---|
| mcp-inspect list | List available contexts on the server | ||||||
mcp-inspect inspect | Show metadata and messages for a single context | mcp-inspect watch | Stream new messages for a context in real time | mcp-inspect dump | Export messages to JSON/JSONL | mcp-inspect search | Filter contexts by metadata or time range | Use Cases
Tips
For more details and the latest commands, consult the repository README and the MCP server documentation in your environment. |