Testing utility for MCP servers with TypeScript support and response validation
MCP Test Client is a robust testing utility designed for Model Context Protocol (MCP) servers, providing an easy-to-use interface to validate server implementations and ensure that tools are working correctly. This client supports tool listing and tool calls, making it a valuable resource for developers looking to integrate AI applications like Claude Desktop, Continue, Cursor, and other MCP clients into their workflows.
The MCP Test Client delivers several key features that enhance the testing and development of MCP servers:
MCP Test Client is designed to fully leverage the Model Context Protocol (MCP) architecture. The protocol ensures that AI applications can communicate with data sources and tools via a standardized interface, enhancing flexibility and interoperability. Below is an illustration of how MCP communication flows within the protocol:
graph TD;
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
This flow demonstrates the seamless interaction between an AI application, MCP client, and server, ultimately enabling communication with data sources or tools.
To get started using MCP Test Client, follow these steps for installation and basic usage:
Installation:
bun install mcp-test-client
Basic Example Usage:
import { MCPTestClient } from 'mcp-test-client';
describe('MCP Server Tests', () => {
let client: MCPTestClient;
beforeAll(async () => {
client = new MCPTestClient({
serverCommand: 'bun',
serverArgs: ['./path/to/your/server.ts'],
});
await client.init();
});
afterAll(async () => {
await client.cleanup();
});
test('should list available tools', async () => {
const tools = await client.listTools();
expect(tools).toContainEqual(
expect.objectContaining({
name: 'your-tool-name',
description: 'Your tool description',
})
);
});
test('should call a tool', async () => {
await client.assertToolCall(
'your-tool-name',
{ arg1: 'value1', arg2: 'value2' },
(result) => {
expect(result.content[0].text).toBe('expected result');
}
);
});
});
The MCP Test Client is particularly useful in several key areas of AI development and deployment:
Consider a scenario where an AI application needs to perform data analytics using various tools within MCP servers. The client can easily test these tools before deployment, ensuring that real-time data processing is seamless and accurate.
For NLP applications like text analysis or summarization, the MCP Test Client allows developers to validate how different servers handle linguistic features and responses. This ensures consistent performance across various MCP-compliant environments.
MCP Test Client is fully compatible with popular MCP clients:
The compatibility matrix below provides a detailed overview of the client's integrations:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
To ensure compatibility and performance, the MCP Test Client includes a comprehensive matrix that details its interactions with specific AI applications. This helps developers understand where full functionality is available and where it might be limited.
For advanced users or security-conscious organizations:
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
Yes, you can connect to multiple MCP servers from a single client instance. Each server configuration is stored in a separate section of the mcpServers
object.
The client supports all tools that are listed and called through the Model Context Protocol. You can test your own custom tools as long as they follow the protocol standards.
Testing ensures that the correct responses are being received from tools, which is crucial for maintaining data integrity and security. The client runs assertions to validate these responses, mitigating potential security risks.
While tests should be conducted thoroughly before going live, MCP Test Client primarily serves a testing role. We recommend deploying the protocol in your production environment with caution, after thorough validation and optimization.
Yes, current limitations include potential API key exposure if not securely managed and compatibility issues with servers that do not fully support prompt handling, which is limited to Continu.
If you wish to contribute:
Explore more about MCP and its ecosystem:
By leveraging the power of MCP Test Client, developers can ensure seamless integration and deployment of AI applications across various platforms and environments.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods