Skip to main content

mcp-client-python

A Python client library and CLI for connecting to a serverless MCP server over Streamable HTTP.

Companion to mcp-infra, which deploys the server to AWS, Azure, or GCP.

Installation

pip install mcp-client-python

CLI

eval "$(mcp-client config set --endpoint https://YOUR_ENDPOINT/mcp --key YOUR_KEY)"

# ...or set them yourself:
export MCP_ENDPOINT=https://YOUR_ENDPOINT/mcp
export MCP_HEADERS="x-api-key:YOUR_KEY"

# List available tools
mcp-client tools list

# Call a tool
mcp-client tools call <name> --args '{"key": "value"}'

# Machine-readable output
mcp-client tools list --json
mcp-client tools call <name> --args '{"key": "value"}' --json

# Custom headers (repeatable)
mcp-client tools list --header "x-api-key:YOUR_KEY"
mcp-client tools list --header "Authorization:Bearer tok123" --header "X-Custom:foo"

Credentials can also be placed in a .env file in the working directory. Additional headers can be set via MCP_HEADERS as comma-separated key:value pairs:

MCP_HEADERS="x-api-key:YOUR_KEY,X-Custom:foo"

SDK

import asyncio
from mcp_client import MCPClient

client = MCPClient(
    endpoint="https://YOUR_ENDPOINT/mcp",
    headers={"x-api-key": "YOUR_KEY"},
)

# List available tools
tools = asyncio.run(client.list_tools())
print([t.name for t in tools])

# Call a tool
result = asyncio.run(client.call_tool(
    "get_repo_summary",
    {"repo_url": "https://github.com/anthropics/anthropic-sdk-python"},
))
print(result.content)

Each method opens a fresh connection, executes, and closes — no persistent state to manage.

Requirements

  • Python 3.10+
  • An MCP server endpoint (see mcp-infra)

License

MIT

Metadata

Release files for mcp-client-python 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-client-python 0.4.0
File Size Uploaded Provenance Actions
mcp_client_python-0.4.0.tar.gz 9.8 kB With provenance Details for mcp_client_python-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcp-client-python 0.4.0
File Interpreter ABI Platform Actions
mcp_client_python-0.4.0-py3-none-any.whl Python 3 none any Details for mcp_client_python-0.4.0-py3-none-any.whl

Total release size: 15.7 kB

Release files / mcp_client_python-0.4.0.tar.gz

Download URL mcp_client_python-0.4.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ee52381a7af7c2349beb262c65e3b96018f9061bd4388e33de37aca012d2e620
BLAKE2b-256 checksum
How to use checksums
274f193414ab52a878af32a2c42e552d9ce39c3dd3c0c9365fa5e2de0765dd91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.

Transparency log

Release files / mcp_client_python-0.4.0-py3-none-any.whl

Download URL mcp_client_python-0.4.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
183b9e99843f3ea92487db6b84a9fcc14003e1f1a38dba8738aa1d253156a82b
BLAKE2b-256 checksum
How to use checksums
87bd0bd0d5dd2c8e600ac048229f75ea3a29f5255577a7a409d42e57efb05afa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.

Transparency log

Security for mcp-client-python 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mcp_client_python-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page