inspector README

The project's README from github.com/modelcontextprotocol/inspector. As one markdown file: README.md.

MCP Inspector

A developer tool for inspecting Model Context Protocol (MCP) servers. It ships as a single package, @modelcontextprotocol/inspector, that provides three ways to inspect a server:

All three run through one global mcp-inspector binary:

npx @modelcontextprotocol/inspector          # web UI (default)
npx @modelcontextprotocol/inspector --cli    # CLI
npx @modelcontextprotocol/inspector --tui    # TUI

Upgrading from v1? Read the v1 → v2 migration guide — CLI flags, the new --config vs. --catalog split, the Node engine bump, and what no longer ships.

Repo status. This is the v2 line of the Inspector. Active development happens on v2/main (the develop branch — all v2 PRs target it), which is merged into main at milestone releases; main is the default branch and holds the latest released v2, published to the npm latest tag. The legacy v1 line lives on v1/main — security fixes only, published straight from that branch to the npm v1-latest tag (npx @modelcontextprotocol/inspector@v1-latest). See AGENTS.md for branch/board conventions.

Quick start (development)

Requires Node >=22.19.0.

npm install          # at the repo root; postinstall cascades into every client
npm run build        # web → cli → tui → launcher

For day-to-day web iteration, run Vite directly — fast HMR, no launcher build needed:

cd clients/web && npm run dev

The launcher-driven scripts run the built launcher, so build first:

npm run web        # prod web launcher against clients/web/dist
npm run web:dev    # web launcher in --dev mode (Vite)

v2 is not an npm workspace — each client under clients/* keeps its own package.json and node_modules, and shared code lives in core/, consumed via a @inspector/core build-time alias. Every runtime dependency core/ imports is declared once, in the repo-root package.json, and each client declares only what that client alone consumes — its UI stack, its bundler-inlined packages, its dev tooling — which leaves clients/cli and clients/launcher with no runtime dependencies of their own. What that means for adding a dependency (root vs. client, dependencies vs. devDependencies, and the bundler external lists) is in the local-dev skill.

Project layout

inspector/
├── clients/
│   ├── web/          Web client (Vite + React + Mantine). src/ = browser app; server/ = Node backend
│   ├── cli/          CLI client (tsup bundle, @inspector/core alias)
│   ├── tui/          TUI client (Ink + React, tsup bundle)
│   └── launcher/     Shared launcher — provides the `mcp-inspector` bin, dispatches to web/cli/tui
├── core/             Shared code consumed via the `@inspector/core` alias (no package.json)
├── test-servers/     Composable MCP test servers + fixtures used by integration and smoke tests
├── scripts/          Root build/verify tooling (install cascade, smokes, the verify:* guards)
│                     and repo automation run from CI (the dependency, Dependabot-alert and SDK sweeps)
├── docs/             Task-oriented guides — see below
├── specification/    Design/build specifications
├── .claude/skills/   Agent skills: the repo's procedures, invokable by name
├── AGENTS.md         Contribution rules for agents AND humans
└── README.md         You are here

Each client has its own README with client-specific detail: web · cli · tui · launcher.

Documentation

Guide Covers
Architecture The @inspector/core shared package, and the web client's "dumb components" + Storybook approach
Testing and the quality gate What each validate / coverage / smoke / verify:* script covers, the GitHub-CI-vs-local-gate split, and the supported browsers
Writing a skill How to write a skill description that actually fires, and eval cases that measure it — the case shapes that work, and the tuning loop
Test servers The composable test servers and the showcase config for every feature — what to run, what to click, and what the broken build did
Publishing What ships in the tarball, the packaging invariants, and pack:verify
Docker Running the container image — ports, volumes, and where secrets go
Migrating from v1 to v2 CLI flag mapping, --config vs. --catalog, the Node engine bump, env-var renames
MCP server configuration Which server(s) the Inspector connects to, and the config file format
Reviewing an MCP App The CLI-first → one-shot-web recipe for automated App-tool review
Smoke-testing an MCP server The connect → list → call → assert workflow for a shell or CI job: --format json + jq, the exit-code map, and keeping OAuth non-interactive
Launcher and config consolidation Why the launcher runs a client in-process rather than spawning it

Testing and the quality gate

Each client self-validates from its own folder; the root scripts chain them. There is no aggregate root test script.

npm run validate     # fast inner loop: format:check + lint + typecheck + build + unit tests
npm run coverage     # the per-file ≥90% gate (lines/statements/functions/branches)
npm run local:gate   # MANDATORY before pushing — a strict superset of GitHub CI

npm run local:gate chains every check below, plus the smokes and the Storybook tests. Testing and the quality gate owns the stage list and says what each one covers and why two are local-only; AGENTS.md holds the testing rules themselves.

Contributing — AGENTS.md, CLAUDE.md, and the skills

AGENTS.md is the contract for changing this codebase, and it applies to humans and AI agents alike. It is not agent-only boilerplate — it holds the project's real rules: the version/label conventions, the TypeScript and Mantine/React standards, the testing and coverage requirements, and the mandatory pre-push gate. Read it before making changes, and keep it up to date when you change structure, tooling, or rules.

The repo's procedures — multi-step recipes with commands and live IDs — live in .claude/skills/ instead, one directory per procedure, so they are loaded only when the task calls for them. They are ordinary committed Markdown: an agent that doesn't understand skills can read them, and AGENTS.md carries an index of what exists. Claude Code users invoke one by name (/release, /issue-triage, …).

CLAUDE.md is the entry point Claude Code loads automatically; it includes AGENTS.md, so agents and humans work from the same source of truth. If you use a different agent that reads AGENTS.md, you get the same rules.

A key rule worth surfacing here: all work is issue-driven. Before starting, find or create a tracking issue on the v2 project board; open PRs against v2/main with Closes #<issue>. External contributions are accepted as issues, not pull requests — see CONTRIBUTING.md.

License

MIT.

inspector (modelcontextprotocol/inspector)

Searching Database…

11.1K ·GitHub
这是什么?MCP Inspector 是一款面向开发者的工具,用于检查模型上下文协议(MCP)服务器。它以单个 npm 包发布,提供网页、命令行和 TUI(终端界面)三种方式,便于测试和调试。
这是一个应用,还是三个独立的工具?它是一个单独的包,即 @modelcontextprotocol/inspector,整合了三种界面:基于 Vite+React+Mantine 的网页应用(带 Node 后端);用于自动化和 CI 的可脚本化命令行工具;以及基于 Ink 的终端界面。三者都通过同一个全局二进制程序启动。
我该如何启动 Inspector?通过全局的 mcp-inspector 二进制程序安装并运行,然后选择模式:--web 启动浏览器界面,命令行用于脚本化检查,默认的 TUI 则提供交互式终端会话。
运行它需要预先安装什么?Node.js 22.19.0 或更高版本。该项目不是 npm 工作区,因此 clients/ 下的每个客户端都保留各自的 package.json 和 node_modules,共享代码则放在 core/ 中。
v1 和 v2 之间有什么变化?不兼容的改动需要担心吗?v2 是目前积极开发的版本线(位于 v2/main 分支);v1 只提供安全修复,并以 npm 的 v1-latest 标签发布。从 v1 迁移到 v2 涉及命令行参数变更、--config 与 --catalog 的拆分、Node 引擎版本升级,以及部分功能不再随包提供。
能否用 Docker 运行,而无需在本机安装 Node?可以,项目提供了容器镜像,并附有专门的指南,说明端口、数据卷以及密钥的存放位置。
AGENTS.md 是做什么用的?AGENTS.md 是项目的修改规范,包括版本和标签约定、TypeScript 与 Mantine/React 编码标准、测试和覆盖率要求,以及必须执行的推送前检查。它同时面向开发者和 AI 编程代理编写。
项目在合并前的质量检查包含哪些内容?运行 npm run local:gate 会依次执行每个客户端的 validate、coverage、smoke 和 verify 脚本,以及 Storybook 测试;除此之外,仓库根目录没有统一的测试脚本。
为什么仓库不使用 npm 工作区?clients/ 下的每个客户端都保留各自的 package.json 和 node_modules,共享代码放在 core/ 中,并通过构建时别名 @inspector/core 引用,因此每个客户端只声明它实际使用的依赖。
Size
33 MB
Stars
11.1K
Age
2y
Commits · 90 Days