An engineering look at building a diagnostic toolkit that goes beyond checking whether a Model Context Protocol server connects.
A successful connection doesn't necessarily mean an MCP server is healthy.
A server might connect successfully while exposing incorrectly defined tools, invalid JSON Schemas, suspicious tool descriptions, unreliable execution behavior, or performance problems.
These are different problems, but they all affect the quality of an MCP integration.
I wanted to approach MCP diagnostics from a broader perspective: instead of checking only whether a server connects, what if we could inspect its capabilities, validate its schemas, test its behavior, audit potential security issues, and measure its performance?
That idea is what led to mcp-probe.
GitHub: https://github.com/SinaMohammadi/mcp-probe
npm: https://www.npmjs.com/package/@sinamoohammadi/mcp-probe
The problem: connecting is only the first step
The Model Context Protocol provides a standardized way for applications to communicate with external tools and services.
But building an MCP server involves more than implementing the protocol and making a connection work.
Consider a few situations:
- A server advertises tools, but some of them fail during discovery.
- A tool exposes an incomplete or incorrectly structured JSON Schema.
- A tool description contains suspicious instructions.
- A remote endpoint uses an insecure transport configuration.
- A server exposes sensitive information through metadata or responses.
- Tool execution becomes slower after a code change.
- A configuration works locally but fails in a CI/CD environment.
These issues require different types of inspection and testing.
A basic connection check cannot identify all of them.
I wanted to bring these diagnostic capabilities into one developer-oriented toolkit.
Introducing mcp-probe
@sinamoohammadi/mcp-probe is a Node.js and TypeScript toolkit for diagnosing, testing, auditing, and profiling Model Context Protocol servers.
It provides two interfaces:
- A command-line interface for developers and automation.
- A strongly typed programmatic API for integrating its engines into Node.js applications.
The package is built on the official @modelcontextprotocol/sdk.
Instead of implementing a separate MCP communication layer, it uses the official SDK for protocol communication.
This keeps the project focused on diagnostics rather than reinventing the protocol.
Getting started
Installation is straightforward:
npm install @sinamoohammadi/mcp-probe You can also run the CLI directly:
npx @sinamoohammadi/mcp-probe --help For example, to inspect a local MCP server using STDIO:
npx @sinamoohammadi/mcp-probe inspect \ --transport stdio \ --command node \ --args server.js Or inspect a Streamable HTTP endpoint:
npx @sinamoohammadi/mcp-probe inspect \ --transport http \ --url http://localhost:3000/mcp One feature worth highlighting is in-memory inspection.
npx @sinamoohammadi/mcp-probe inspect \ --transport in-memory \ --module ./dist/server.js This allows local MCP modules to be inspected without requiring an HTTP server.
There is also an offline scanning command:
npx @sinamoohammadi/mcp-probe scan ./my-mcp-project This scans a local project without starting its MCP server.
Beyond discovery: inspecting the actual capabilities
An MCP server can expose several types of capabilities, including tools, resources, resource templates, and prompts.
I wanted discovery to provide more than a simple list of tool names.
The discovery engine retrieves protocol metadata and capability information, including:
- Available tools.
- Tool input and output schemas.
- Tool annotations.
- Resources.
- Resource templates.
- Prompts.
It also supports automatic pagination.
This information provides the foundation for the other engines.
For example, schema validation can inspect whether tool definitions are structurally consistent and whether their constraints make sense.
The validator also supports runtime tool-input validation.
Security auditing without automatically executing tools
Security was an important part of the project.
MCP servers can expose tools that interact with filesystems, databases, external services, and other sensitive resources.
A diagnostic toolkit should be able to identify suspicious configurations and tool definitions without blindly executing everything it discovers.
That is why mcp-probe includes a non-destructive, rule-based security auditing engine.
The current implementation includes:
- 31 runtime security and bug-detection rules.
- 14 offline static rules for local project scanning.
The runtime rules cover configuration, tools, transport, execution, data, and reliability-related issues.
Some examples include:
Configuration issues
- Hardcoded credentials and API keys.
- Potential environment-variable leakage.
- Risky CLI argument usage.
- Excessive timeouts.
Tool-related issues
- Destructive tool indicators.
- Suspicious prompt-injection or tool-poisoning patterns.
- Unconstrained input schemas.
- Potential sensitive-data exposure combined with external network access.
Transport issues
- Unencrypted remote HTTP.
- Missing authentication headers.
- Disabled TLS certificate verification.
- Potentially unsafe endpoint configurations.
The offline scanner adds source-level checks, including:
- Unsafe shell execution.
- Dynamic code evaluation.
- Hardcoded secrets.
- TLS verification bypasses.
-
console.log()usage in STDIO MCP server source files. - Potentially unsafe SQL construction.
- Empty catch blocks.
An important distinction: a security finding is not automatically proof of an exploitable vulnerability.
Some rules inspect metadata, descriptions, and schemas. They identify suspicious patterns that developers should investigate.
The report includes severity, classification, confidence, evidence, and remediation guidance to help developers understand what was detected.
Testing MCP tools
Discovery tells us what a server exposes.
Testing helps us understand whether its tools behave as expected.
mcp-probe includes an MCP testing framework with explicit JSON or TypeScript test definitions.
The testing engine supports:
- Input schema validation.
- Output assertions.
- JSON and structured-content assertions.
- Timeouts and retries.
- Latency regression detection.
- Safe mode.
Safe mode is enabled by default and blocks destructive tools unless they are explicitly authorized.
This is important because automated testing should not accidentally trigger destructive operations simply because a tool exists.
The goal is to make MCP tool testing more deliberate and repeatable.
Performance profiling
Correctness is not the only concern.
A tool might return the right result but take significantly longer than expected.
The performance profiler measures initialization, discovery, and tool execution.
Its reports can include:
- Average latency.
- Median latency.
- P95 latency.
- P99 latency.
- Throughput.
- Error and timeout rates.
- Response payload metrics.
For example, you can benchmark a particular tool:
mcp-probe benchmark \ ./mcp-probe.config.json \ --tool search_products \ --iterations 100 This makes performance analysis part of the diagnostic workflow rather than something developers need to implement separately.
The profiler also includes safety considerations for remote and destructive operations.
Architecture: keeping the engines independent
One architectural decision was to keep the project organized into focused modules.
The architecture follows Clean Architecture and Dependency Inversion principles.
The source code is separated into areas such as:
-
connection/— Transport creation and connection lifecycle. -
client/— Typed MCP client abstraction. -
discovery/— Protocol and capability discovery. -
validation/— Schema and payload validation. -
security/— Security rules and auditing. -
testing/— Test execution and assertions. -
performance/— Benchmarking and profiling. -
health/— Health and stability checks. -
reporting/— Output generation. -
cli/— Command-line interface.
The MCPProbe facade brings these engines together.
The advantage of this structure is that the individual engines can also be imported independently.
For example:
import { MCPClient, DiscoveryEngine, SchemaValidator, SecurityAuditor, PerformanceProfiler, MCPTestRunner, HealthChecker, } from '@sinamoohammadi/mcp-probe'; This provides flexibility for developers who want to integrate specific diagnostic capabilities into their own applications.
Another important implementation detail is process safety.
STDIO processes are spawned without shell execution, using validated executable names and explicit argument arrays.
The connection layer also includes lifecycle handling, timeouts, secret redaction, and SSRF protections.
Reports that fit into development workflows
A diagnostic tool becomes more useful when its output can be consumed by other tools.
mcp-probe supports multiple reporting formats:
- Terminal.
- JSON.
- Markdown.
- Self-contained HTML.
- SARIF 2.1.0.
SARIF support is particularly useful for integrating security findings into GitHub Code Scanning.
The CLI also provides deterministic exit codes, allowing CI/CD pipelines to react to diagnostic results.
For example, a GitHub Actions workflow can run schema validation, tests, and security scans as part of a development pipeline.
- name: Validate MCP schemas run: npx @sinamoohammadi/mcp-probe validate ./mcp-probe.config.json - name: Run MCP tool tests run: npx @sinamoohammadi/mcp-probe test ./mcp-tests.json - name: Scan local MCP project run: npx @sinamoohammadi/mcp-probe scan . --format sarif --output mcp-static.sarif --fail-on high - name: Run MCP security audit run: npx @sinamoohammadi/mcp-probe security ./mcp-probe.config.json --format sarif --output mcp-security.sarif --fail-on high This turns MCP diagnostics into something that can run repeatedly instead of relying entirely on manual checks.
A programmatic API
The CLI is useful for everyday development, but I also wanted the toolkit to be usable inside Node.js applications.
Here is a basic example:
import { MCPProbe } from '@sinamoohammadi/mcp-probe'; const probe = new MCPProbe({ transport: { type: 'stdio', command: 'node', args: ['server.js'], }, }); try { const report = await probe.inspect({ includeHealth: true, }); console.log( 'Discovered tools:', report.discovery?.tools.count ); console.log( 'Security findings:', report.security?.summary.totalFindings ); console.log( 'Health:', report.health?.status ); } finally { await probe.close(); } The finally block ensures that the connection is closed even when inspection fails.
This is useful when diagnostics need to become part of a larger automated workflow.
What I learned from building it
One thing became clear while designing the toolkit: MCP diagnostics are not a single problem.
Connection management, discovery, schema validation, security auditing, testing, performance profiling, and reporting have different responsibilities.
Combining them into one tightly coupled implementation would make the project harder to maintain.
Separating them into focused engines makes it easier to reason about each responsibility and reuse individual capabilities.
Another important lesson is that security auditing needs context.
A suspicious schema or tool description is a signal worth investigating, not necessarily a vulnerability. Reporting confidence and evidence is just as important as reporting severity.
Finally, diagnostic output should be useful beyond the terminal. Machine-readable reports and predictable exit codes make it possible to integrate the same checks into development pipelines.
Try it yourself
If you are building MCP servers or maintaining MCP integrations, you can explore the project here:
- GitHub: https://github.com/SinaMohammadi/mcp-probe
- npm: https://www.npmjs.com/package/@sinamoohammadi/mcp-probe
Install it:
npm install @sinamoohammadi/mcp-probe Or try:
npx @sinamoohammadi/mcp-probe --help The project is released under the MIT license.
Let's discuss MCP tooling
I am interested in how other developers approach MCP server quality.
Do you currently test your MCP servers only by connecting them to an MCP client, or do you also have automated schema validation, security checks, and performance tests?
And what would you consider the most important missing capability in the current MCP developer tooling ecosystem?
I'd love to hear your thoughts and feedback.