How to test an MCP server
Connect to the server, call its tools by hand, then check the tool definitions with lint and the tools themselves with a smoke test, in the browser or in CI.
Quick start
npx mcp-master-tester
Open http://127.0.0.1:6280 and click Connect. The default fields launch the official reference server (npx -y @modelcontextprotocol/server-everything), which uses every feature, so you can try everything before pointing it at your own server.
It needs Node.js 20 or later. To use a different port, set PORT, for example PORT=7000 npx mcp-master-tester. If the port is taken, it says so and exits.
Or run it from source:
git clone https://github.com/simplymanas/mcp-master-tester.git
cd mcp-master-tester
npm install
npm start
Connecting to a server
| Server type | Settings |
|---|---|
| Local npm package | stdio → Command npx, Arguments -y @modelcontextprotocol/server-filesystem /path/to/dir |
| Local script | stdio → Command python, Arguments my_server.py, Working dir as needed |
| Needs an API key | stdio → + var → GITHUB_PERSONAL_ACCESS_TOKEN = … (hidden automatically) |
| Remote (current spec) | Streamable HTTP → URL https://host/mcp, plus a Bearer token if required |
| Remote (legacy) | SSE → URL https://host/sse |
The connection panel shows Not connected, Connecting… or Connected, and once connected, the server's name and version, the transport and the process id. Edit any field and click Reconnect to apply it. Closing or reloading the tab ends the session and stops the server process.
Keys and auth. Environment variables named like *KEY*, *TOKEN*, *SECRET* or *PASSWORD* are hidden as you type. If a remote server answers 401, the app asks for a token and retries. If a stdio server crashes and its error output mentions a missing key, the app offers to add it and reconnect.
Profiles are saved in your browser. Secrets are never stored, so the app asks for them when you connect.
Running tools by hand
Each tool's inputSchema becomes a form: text and number fields, checkboxes, drop-downs for enums (including oneOf with titles), multi-select arrays and JSON editors for objects. Required fields are checked before anything is sent, and Edit as JSON lets you type the arguments directly. Ctrl/⌘ + Enter runs the selected tool.
- Results: text (JSON is pretty-printed), images, audio, resource links, embedded resources and
structuredContent. A tool'sisErrorresult is shown separately from a protocol error, with how long the call took. - While it runs: set a timeout per call and watch progress from
notifications/progress. Tools marked destructive ask for confirmation, and each tool keeps a call history. - Resources and prompts: read static resources, fill in URI templates, and see the messages a prompt returns.
- Elicitation: when a server sends
elicitation/create, a form built from itsrequestedSchemaappears. - Protocol log: every JSON-RPC frame in both directions with request-to-response time, the server's stderr, and
notifications/messageentries, with alogging/setLevelcontrol when the server supports logging.
Lint
Lint reads the server's tool list and checks each definition against the MCP spec and against what models handle well. A model only knows a tool through its name, description and schema, and that whole list is sent with every request, so a vague or bloated definition costs accuracy and context on every call.
In the app, open the Lint tab. The tab count shows errors and warnings, coloured by the worst one, then info findings in muted text: 2 · 14 means 2 errors or warnings and 14 info suggestions.
What it checks
- Spec:
inputSchemaandoutputSchemamust be of type object, required fields must be defined, and names must be valid and unique. - Look-alike tools: names so close a model may pick the wrong one (
get_userandgetUsers), and near-identical descriptions. A prefix every tool shares, or a description template most of them share, doesn't count. - Descriptions: missing, very short, never saying when not to use the tool, so long they eat context, or padded with indentation copied from the source code (a multi-line string indented to match the code around it). It also flags a whole tool list that is too big.
- Parameters: missing types or descriptions; no
requiredlist when a parameter has no default; free-form strings that list fixed values (should be an enum); strings that should be booleans, numbers, dates, URLs or emails; and values with no example. - Naming: names that aren't snake_case, and names that break the server's own convention.
- Annotations: missing read-only and destructive hints, and tools marked read-only whose name says they change something (
cancel_booking) or that are also marked destructive. - Output size: list and search tools with no limit or pagination parameter.
- From real calls in the app: a result over about 10,000 tokens, and an
isErrorresult with no useful message for the model to recover from.
From the command line
The same rules run in a terminal or CI. The command connects, lists the tools, prints the findings and exits non-zero when there are any at your chosen level.
# stdio: put the server command after --
npx mcp-master-tester lint -- node dist/index.js
# Streamable HTTP (add --sse for the legacy SSE transport)
npx mcp-master-tester lint --url https://example.com/mcp --header "Authorization: Bearer $TOKEN"
| Option | What it does |
|---|---|
--fail-on <level> | Exit 1 at error (default), warn or info findings, or never |
--format <format> | text (default), json, or github for GitHub Actions annotations |
--show-info | List info findings too (they're always counted) |
--env KEY=VALUE, --cwd <dir> | Environment and working directory for a stdio server |
--url <url>, --sse, --header "Name: value" | Connect to a remote server |
--timeout <ms> | Give up after this long (default 30000) |
Exit codes: 0 passed, 1 findings at or above --fail-on, 2 the server couldn't be started or reached, or the options were wrong. If a stdio server crashes on start, its stderr is printed.
Smoke test
Lint asks whether the tool definitions are good. The smoke test asks whether the tools actually work: it calls each read-only tool once and fails if one doesn't answer properly. It runs in the app's Smoke tab and from the command line:
npx mcp-master-tester smoke -- node dist/index.js
mcp-master-tester smoke · my-server v1.4.0 · 6 tools · stdio
pass ping_db 2 ms
pass get_weather 48 ms
warn find_user 3 ms returned an error for the made-up "id": No user with id "test". Ids look like "u_1".
fail get_report 12 ms result breaks its outputSchema: … data/celsius must be number
fail slow_query 30001 ms no answer: timed out after 30001 ms
skip delete_user not marked read-only
✖ failed: 2 failed, 1 warning, 2 passed, 1 skipped. Failing on: fail.
What runs, and how far to trust it
readOnlyHint is the server describing itself. If a tool is mislabelled, the smoke test calls a tool that writes. Choose by what is at stake.
| The server | Use | What runs |
|---|---|---|
| Holds real data, or isn't yours | --tool a --tool b | Exactly the tools you name. An allow-list is the only mode that doesn't rely on the server's own labels. |
| A local or test instance | no flag | Tools marked readOnlyHint: true, except those whose name or other annotations contradict it: named like a write (cancel_booking), or marked destructive as well. |
| A throwaway instance | --all | Every tool. |
The name check only catches careless labels. A get_quote that also fires a webhook looks read-only to any tool, which is why the allow-list comes first. If no tool runs at all, the command fails, because a run that called nothing has proved nothing.
What is sent
A value for each required parameter and nothing else:
- the schema's
default, firstexamplesentry,constor firstenumvalue, if it has one; - otherwise a made-up placeholder:
"test",1, or a value that fits theformat(a URL, an email address, a date).
In the app, your last run of a tool in the session comes first. To turn warnings into real checks in CI, print what would be sent, replace the made-up values, and pass the file back:
npx mcp-master-tester smoke --print-args -- node dist/index.js > smoke.json
# edit smoke.json, for example: { "find_user": { "id": "u_1" } }
npx mcp-master-tester smoke --args smoke.json -- node dist/index.js
How answers are judged
| Result | When |
|---|---|
| pass | The tool answered with a normal result. |
| fail | No answer before the timeout; the server closed the connection; a protocol error (the tool threw instead of returning an error result); a result that breaks the tool's outputSchema; or an error result for arguments that came from the schema or from you. |
| warn | An error result, or "invalid params", for made-up arguments: the tool answered, but a placeholder can't prove it works. Also a result over about 10,000 tokens. |
| skip | Not clearly read-only, left out with --skip, or listed after a tool that crashed the server. |
Expected skips
A pass covers only the tools that ran. When tools are skipped because they aren't marked read-only, the run says which ones. To make that a failure, use --fail-on skip, and list the tools you expect to go untested with --skip:
npx mcp-master-tester smoke --fail-on skip --skip add_card --skip delete_card -- node dist/index.js
The tools you name show as "skipped on request" and don't count against the run. A new tool that nobody marked read-only fails it, and so does a renamed one, because a --skip name the server doesn't have is an error. --fail-on skip is the strictest level, so warnings fail the run too; clear them by giving real arguments, as above.
Options
| Option | What it does |
|---|---|
--all | Also run tools that aren't clearly read-only. They may change data. |
--tool <name> | Run only this tool (repeatable), read-only or not. The safest way to choose what runs. |
--skip <name> | Leave this tool out (repeatable). With --fail-on skip, this is how you list the skips you expect. |
--args <file> | JSON file of arguments: { "tool_name": { "param": "value" } } |
--print-args | Print the arguments that would be sent, and run nothing |
--fail-on <level> | Exit 1 on fail (default), also on warn, also on skip, or never |
--timeout <ms> | How long each tool may take (default 30000) |
--format, --env, --cwd, --url, --sse and --header work as they do for lint, and so do the exit codes. A misspelt tool name in --tool, --skip or the --args file is an error (exit 2), so a renamed tool can't quietly drop out of the test.
Breaking changes
A lockfile records your server's tools. In CI, diff compares the live server with it, so a pull request that renames a parameter or drops a tool fails before your users' agents do.
# writes mcp-tools.lock.json; commit it
npx mcp-master-tester snapshot -- node dist/index.js
# in CI: exit 1 on a breaking change
npx mcp-master-tester diff -- node dist/index.js
breaking get_user parameter "org": new required parameter, so existing calls without it fail
breaking get_weather output field "celsius": no longer always present
warn search description changed (412 → 980 characters): models read it on every request, so check the new text
info export_csv new tool
| Level | What counts |
|---|---|
breaking | A tool or parameter removed; a new required parameter; a narrower type, enum or limit on an input; an output field removed, no longer always present, or of a new type; the outputSchema removed |
warn | A changed description (models act on it, and a changed description is how a tool can be repurposed), annotation or default, or a schema change it can't classify |
info | A new tool, optional parameter or output field; a wider type |
--fail-on breaking is the default; warn, info and never are the others. --lock <file> reads another lockfile, and snapshot --out <file> writes one. When a change is intended, run snapshot again and commit the new lockfile in the same pull request. The lockfile has no dates or server version, so it only changes when the tools do.
Tool-selection evals
Lint checks how your tools are written. eval checks whether a model actually picks the right one, for the requests your users make. It is the test to run after rewriting descriptions, merging two similar tools, or trimming a long tool list.
List the requests and the tool each should lead to in mcp-evals.json:
[
{ "prompt": "What's the weather in Paris tomorrow?", "expect": "get_forecast", "args": { "city": "Paris" } },
{ "prompt": "Find the user with email ana@example.com", "expect": ["find_user", "search_users"] },
{ "prompt": "Thanks, that's all", "expect": null }
]
export ANTHROPIC_API_KEY=...
npx -p mcp-master-tester -p @anthropic-ai/sdk mcp-master-tester eval -- node dist/index.js
pass get_forecast What's the weather in Paris tomorrow?
fail find_user / search_users Find the user with email ana@example.com
→ called "get_user", expected "find_user" or "search_users"
pass (no tool) Thanks, that's all
✖ failed: 2 of 3 passed (66%), 1 failed, 0 errors; needs 100%. Failing on: fail.
Mixed up: find_user/search_users → get_user. Clearer descriptions usually fix this.
Tokens: 14,670 in, 930 out.
| Field | What it means |
|---|---|
prompt | What the user asks |
expect | The tool that should be called, a list of acceptable tools, or null when no tool fits and the model should just answer |
args | Optional: values the call must have. Strings match ignoring case; arguments not listed are ignored. |
name | Optional: a label for the report |
The file can also be an object, { "model": "...", "cases": [...] }, to choose the model for everyone who runs it.
What is sent
One request per case to the Anthropic API: your server's real tool list (name, description and input schema), the request, and a short neutral system prompt, so the result reflects your tools, not the prompt. The model may answer without a tool, which is what null cases test. Nothing is called on the server, so it is safe on servers whose tools change data. Each case is billed to your key; the report shows the tokens used.
Options
--cases <file>: the cases file (defaultmcp-evals.json).--model <id>: the model to test with (defaultclaude-opus-5-5, or"model"in the file).--effort low|medium|high|xhigh|maxsets its effort.--pass-rate <percent>: pass when at least this share of cases pass (default 100). Models vary a little between runs, so a large suite may want 90.--fail-on fail|neverand--format text|json|github, as for the other commands. A bad key or model stops the run with exit code 2.
The Anthropic SDK is an optional dependency, installed only for eval, so everything else keeps two dependencies. Use npx -p as above, or npm install --save-dev @anthropic-ai/sdk in your project. The GitHub Action installs it for you.
GitHub Actions
Build your server, then run the action against it. It runs lint and the smoke test, shows each finding as an annotation on the workflow run, and adds a summary table to the job page.
Save this as .github/workflows/mcp.yml:
name: MCP server checks
on: [push, pull_request]
jobs:
mcp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
- run: npm ci && npm run build
- uses: simplymanas/mcp-master-tester@v1
with:
command: node dist/index.js
For a server in another language, swap the setup and build steps for your own (for Python, actions/setup-python and pip install .) and set command, for example python -m my_server.
For a remote server, give url and headers (one Name: value per line, from the secrets context) instead of command. A stdio server doesn't see the step's environment apart from PATH, HOME and a few others, so pass what it needs in env, one KEY=VALUE per line. If the server in CI holds anything you care about, list the tools the smoke test may call in tools.
| Input | What it does |
|---|---|
command | Command that starts a stdio server. Split on spaces and run without a shell. |
url, sse, headers | A remote server instead |
env, cwd | Environment and working directory for a stdio server |
checks | Any of lint, smoke, diff, eval. Left empty: lint and smoke, plus diff when the lockfile exists, plus eval when the cases file exists and anthropic-api-key is set |
lockfile, diff-fail-on | For diff: the lockfile (default mcp-tools.lock.json), and breaking (default), warn, info or never |
lint-fail-on | error (default), warn, info or never |
smoke-fail-on | fail (default), warn, skip or never |
tools, skip, all, args | Which tools the smoke test calls, and with what arguments, as in the smoke test options |
anthropic-api-key, eval-cases | For eval: a key from the secrets context, passed to the eval run only, and the cases file (default mcp-evals.json). Also eval-model, eval-effort, eval-pass-rate and eval-fail-on, as in evals. |
timeout | Milliseconds for connecting, listing tools, or one tool call (default 30000) |
The outputs lint, smoke, diff and eval are passed, failed, error or skipped. @v1 follows the latest 1.x release; use @v1.9.0 or a commit SHA to stay on one version.
On another CI system, or to control every flag, run the commands directly. With --format github, findings still show as annotations on GitHub. Add --tool for each tool if the server in CI holds anything you care about.
- run: npm ci && npm run build
- run: npx -y mcp-master-tester lint --format github --fail-on warn -- node dist/index.js
- run: npx -y mcp-master-tester smoke --format github --args smoke.json -- node dist/index.js
Security
- The backend listens on
127.0.0.1only, because it can run any command you enter in the stdio form. Don't expose it on a network. - Requests with a
Hostother than127.0.0.1orlocalhost, or anOriginother than the app itself, are rejected. That blocks DNS-rebinding attacks and other websites open in your browser. - Everything a server sends (names, descriptions, schemas, results, logs) is treated as untrusted and escaped before display. A Content-Security-Policy backs that up.
- Secrets stay in memory in the browser tab and the backend process. Profiles save names only, never values.
- Tools only run when you click Run, and tools marked destructive ask first. The smoke test is the exception, which is why it only runs tools marked read-only, or the ones you name.
To report a security issue, see SECURITY.md.
Limitations
- No browser sign-in (OAuth) for remote servers. Use a Bearer token or custom headers instead.
- Sampling (
sampling/createMessage) and roots are not advertised to servers. - URL-mode elicitation is not advertised, so servers can only ask for input with a form.
These are on the roadmap, and several are marked as good first contributions.