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

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

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_python-0.2.1.tar.gz (8.4 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_python-0.2.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file mcp_client_python-0.2.1.tar.gz.

File metadata

  • Download URL: mcp_client_python-0.2.1.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mcp_client_python-0.2.1.tar.gz
Algorithm Hash digest
SHA256 68256708289519a476d05d45abd86b6e8ea632d8dd6f549bdf1b3887393f4eb9
MD5 00ba6e159fa00a95c6457601edae6b72
BLAKE2b-256 b668e6bc990ac249a4fa4d8ba2374e5226543e8f6420fd708584e33daf42961b

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_client_python-0.2.1.tar.gz:

Publisher: client-python-publish.yml on nicculus/simple-mcp

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_python-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_client_python-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ac2e52616ab3338d9b7d57de53b13840eb7bd90085280fef2b3280384e00f9c5
MD5 184f71480bce6977a847a3df8eba4d0f
BLAKE2b-256 81aad8779bd6cf2b32dc52dda9929b76ca0f9ff2ca67035d51c6abf4ea73a377

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_client_python-0.2.1-py3-none-any.whl:

Publisher: client-python-publish.yml on nicculus/simple-mcp

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

Release history Release notifications | RSS feed

0.4.0

2 files

0.3.0

2 files

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.0

2 files

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