Python client library and CLI for connecting to a serverless MCP server
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_client_python-0.2.0.tar.gz.
File metadata
- Download URL: mcp_client_python-0.2.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2afdc96642ef1f6810bc7e7cb96a7987a07476359644251080667b534916c64
|
|
| MD5 |
0623dbe149d0b05ae47de45ea15fb0e1
|
|
| BLAKE2b-256 |
ecaaea56b0b33e871be3571732fef80bc11bd0ca4e10ef6cefb49e33980bbb17
|
Provenance
The following attestation bundles were made for mcp_client_python-0.2.0.tar.gz:
Publisher:
publish.yml on nicculus/mcp-client-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_client_python-0.2.0.tar.gz -
Subject digest:
e2afdc96642ef1f6810bc7e7cb96a7987a07476359644251080667b534916c64 - Sigstore transparency entry: 1654712889
- Sigstore integration time:
-
Permalink:
nicculus/mcp-client-python@7f06ad6529f71d03b864c7babc61050f5f78fcf8 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/nicculus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7f06ad6529f71d03b864c7babc61050f5f78fcf8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_client_python-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mcp_client_python-0.2.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3996e92f78e960b7166d499769b775c87016126fd22bc6c5b45c643cb7986ee
|
|
| MD5 |
fddf56f336ec90baf3864a894fdbdd04
|
|
| BLAKE2b-256 |
8ead948c5ac0b57c3b77f4265a0902d45726bf4fd0a2a16961e3925fa4049d7a
|
Provenance
The following attestation bundles were made for mcp_client_python-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on nicculus/mcp-client-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_client_python-0.2.0-py3-none-any.whl -
Subject digest:
d3996e92f78e960b7166d499769b775c87016126fd22bc6c5b45c643cb7986ee - Sigstore transparency entry: 1654713233
- Sigstore integration time:
-
Permalink:
nicculus/mcp-client-python@7f06ad6529f71d03b864c7babc61050f5f78fcf8 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/nicculus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7f06ad6529f71d03b864c7babc61050f5f78fcf8 -
Trigger Event:
push
-
Statement type: