mcpmini
mcpmini is a small, readable MCP server and client library. It exposes Python functions as tools over stdio or streamable HTTP, deriving their schemas from signatures and parameter documentation. Its client exposes remote tools as Python callables with reconstructed signatures, documentation, and defaults.
Usage
Installation
pip install mcpmini
How to use
Define a Python function with type annotations and docments, the comments beside parameters. mcpmini uses these to build the tool schema. Pass the functions to MCPServer:
from mcpmini.core import MCPServer, MCPClient, serve_stdio, serve_mcp
import asyncio, socket
def fahrenheit(
celsius:float, # Temperature to convert
)->float:
"Convert Celsius to Fahrenheit"
return celsius*9/5+32
srv = MCPServer('demo', [fahrenheit])
Choose a transport for the server:
asyncio.run(serve_stdio(srv))serves it over stdio for an MCP host to launch.asyncio.run(serve_mcp(srv, port=8000, token='S'))serves it over streamable HTTP with bearer-token authentication. A non-loopback bind requires a token unlessno_token=Trueexplicitly disables that requirement.
On stdio, a tool can call await srv.elicit(message, schema) to request structured input while its tool call remains active. A client created with MCPClient.stdio(..., on_request=handler) supplies the answer.
The CLI serves functions from a file:
mcpmini tools.py
mcpmini tools.py --transport http --port 8000
Use these commands in an MCP host’s server configuration. To connect Claude Code to the HTTP server configured with token S above:
claude mcp add --transport http demo http://127.0.0.1:8000/mcp -H "Authorization: Bearer S"
MCPClient exposes server tools as bound Python functions. The following example starts a local server and calls its fahrenheit tool:
def free_port():
with socket.socket() as s:
s.bind(('127.0.0.1', 0))
return s.getsockname()[1]
port = free_port()
task = asyncio.create_task(serve_mcp(srv, port=port, token='S'))
await asyncio.sleep(0.2)
async with MCPClient.http(f'http://127.0.0.1:{port}/mcp', token='S') as c: res = await c.tools.fahrenheit(celsius=100)
task.cancel()
res
'212.0'
Metadata
Release files for mcpmini 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcpmini-0.0.5.tar.gz | 16.2 kB | Without provenance | Details for mcpmini-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcpmini-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for mcpmini-0.0.5-py3-none-any.whl |
Total release size: 31.5 kB
Release files / mcpmini-0.0.5.tar.gz
| Download URL | mcpmini-0.0.5.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6637a001428d36bfa113305692455f26071f5ba58344067d659bd446e945fb2d
|
|
BLAKE2b-256 checksum How to use checksums |
e55cd84830e5362224babd6addd5ec6629d1858f25d26c7313645f41ed85f6f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Release files / mcpmini-0.0.5-py3-none-any.whl
| Download URL | mcpmini-0.0.5-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
461aaab3fa67098fcd1bb7d602cce5cef52875bf8314fe889ab152f0060c899e
|
|
BLAKE2b-256 checksum How to use checksums |
5196a180ba501ff70b4427316e81d6dd06da96469b9d333517f6dc2beea3c1e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.15
|
Security for mcpmini 0.0.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.