A minimalistic MCP (Model Context Protocol) client for testing tool calls in MCP servers.
Install uv and test a tool call in an MCP server like this:
uvx mcp-client-for-testing \
--config '
[
{
"name": "name of mcp server",
"command": "uv",
"args": [
"--directory",
"path/to/root/dir/",
"run",
"server.py"
],
"env": {}
}
]
' \
--client_log_level "WARNING" \
--server_log_level "INFO" \
--tool_call '{"name": "tool-name", "arguments": {}}'To use it in code, install the package:
uv pip install mcp-client-for-testing and use it like this:
import asyncio
from mcp_client_for_testing.client import execute_tool
async def main():
config = [
{
"name": "name of mcp server",
"command": "uv",
"args": [
"--directory",
"path/to/root/dir/",
"run",
"server.py"
],
"env": {}
}
]
tool_call = {"name": "tool-name", "arguments": {}}
await execute_tool(config, tool_call)
if __name__ == "__main__":
asyncio.run(main())Use the echo-mcp-server-for-testing with uvx to test the MCP client.
uvx mcp-client-for-testing \
--config '
[
{
"name": "echo-mcp-server-for-testing",
"command": "uvx",
"args": [
"echo-mcp-server-for-testing"
],
"env": {
"SECRET_KEY": "123456789"
}
}
]
' \
--client_log_level "WARNING" \
--server_log_level "INFO" \
--tool_call '{"name": "echo_tool", "arguments": {"message": "Hello, world!"}}'- Clone the repo
git clone [email protected]:piebro/mcp-client-for-testing.git. - Go into the root dir
cd mcp-client-for-testing. - Install in development mode:
uv pip install -e .
The code is formatted and linted with ruff:
uv run ruff format
uv run ruff check --fixBuild the package using uv:
uv buildTo release a new version of the package to PyPI, create and push a new Git tag:
-
Checkout the main branch and get the current version:
git checkout main git pull origin main git describe --tags
-
Create and push a new Git tag:
git tag v0.2.0 git push origin v0.2.0
The GitHub Actions workflow will automatically build and publish the package to PyPI when a new tag is pushed. The python package version number will be derived directly from the Git tag.
This project is licensed under the MIT License. See the LICENSE file for details.