Skip to main content

A minimalistic MCP client for testing MCP Server

Project description

MCP Client for Testing

A minimalistic MCP (Model Context Protocol) client for testing tool calls in MCP servers.

Usage

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
import logging
import json
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, server_log_level_int=logging.DEBUG)

if __name__ == "__main__":
    asyncio.run(main())

Example

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!"}}'

Development

Installation from source

  1. Clone the repo git clone git@github.com:piebro/mcp-client-for-testing.git.
  2. Go into the root dir cd mcp-client-for-testing.
  3. Install in development mode: uv pip install -e .

Formatting and Linting

The code is formatted and linted with ruff:

uv run ruff format
uv run ruff check --fix

Building with uv

Build the package using uv:

uv build

Releasing a New Version

To release a new version of the package to PyPI, create and push a new Git tag:

  1. Checkout the main branch and get the current version:

    git checkout main
    git pull origin main
    git describe --tags
    
  2. 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.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_client_for_testing-0.1.6.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_client_for_testing-0.1.6-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file mcp_client_for_testing-0.1.6.tar.gz.

File metadata

  • Download URL: mcp_client_for_testing-0.1.6.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mcp_client_for_testing-0.1.6.tar.gz
Algorithm Hash digest
SHA256 40119bf6f009df8997a0a0f1f6e9853031038ab484ed0009263d3e310ee9a0ae
MD5 b3d5297e6799bf537deec3b676434c31
BLAKE2b-256 c6e3ae316b5a34c4e90dffbcf5d3395bc21e5c66db3636a8127d52a931f37ded

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_client_for_testing-0.1.6.tar.gz:

Publisher: publish.yml on piebro/mcp-client-for-testing

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_client_for_testing-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_client_for_testing-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 527439fc1531c97ec118f48d8e85a0a1c164a58d99094d46093c371617bb8bfc
MD5 1bcf5fb8f9e9274b2099f800c0553ed7
BLAKE2b-256 9568ea27ff967fecaa365cdd8630bf1dedca9048961f6c5d70820499899777c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_client_for_testing-0.1.6-py3-none-any.whl:

Publisher: publish.yml on piebro/mcp-client-for-testing

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page