mcp-testing-kit
by thoughtspot
The mcp-testing-kit provides utilities to test Model Context Protocol (MCP) servers. It allows you to connect to an MCP server instance, send requests, receive notifications, and assert server behavior in your tests.
Last updated: N/A
What is mcp-testing-kit?
mcp-testing-kit is a testing library for MCP servers, providing utilities to connect to a server, send requests, receive notifications, and assert server behavior.
How to use mcp-testing-kit?
Install the package using npm i -D mcp-testing-kit
. Then, use the connect
function to connect to your MCP server instance. You can then use the client returned by connect
to call tools, list resources/prompts, and register callbacks for notifications, errors, and progress. Finally, use close
to close the server instance.
Key features of mcp-testing-kit
Works with any testing framework
Lightweight
Typescript
Provides abstractions for invoking tools/resources/prompts
Use cases of mcp-testing-kit
Testing MCP server functionality
Validating server responses
Simulating client interactions with an MCP server
Ensuring MCP server stability
FAQ from mcp-testing-kit
What testing frameworks are supported?
What testing frameworks are supported?
The kit works with any testing framework, such as vitest or jest.
What is the purpose of the dummy transport layer?
What is the purpose of the dummy transport layer?
It creates a dummy transport layer to connect to the MCP Server directly instead of relying on HTTP/SSE.
What methods are available on the client returned by connect
?
What methods are available on the client returned by connect
?
The client provides methods such as listTools
, callTool
, listResources
, listPrompts
, getPrompt
, onNotification
, onError
, onProgress
, and sendToServer
.
Where can I find more examples?
Where can I find more examples?
See the example/basic
directory for a full-featured MCP server and corresponding tests.
Is this library open source?
Is this library open source?
Yes, it is licensed under the MIT license.