Skip to main content

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 unless no_token=True explicitly 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'

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)

Source distribution for mcpmini 0.0.5
File Size Uploaded
mcpmini-0.0.5.tar.gz 16.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcpmini 0.0.5
File Interpreter ABI Platform
mcpmini-0.0.5-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release 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