Skip to main content

mcpmini

Usage

Installation

pip install mcpmini

How to use

An MCP tool is a docmented Python function — the docments become the tool’s schema, with no registration ceremony. Serve some functions over stdio or HTTP:

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])

asyncio.run(serve_stdio(srv)) serves it as a host-launched stdio server; a tool on that transport can call await srv.elicit(message, schema), and an MCPClient.stdio(..., on_request=handler) supplies the structured answer while the original tool call remains active. asyncio.run(serve_mcp(srv, port=8000, token='S')) serves it over streamable HTTP behind a bearer token (non-loopback binds refuse to start tokenless unless you pass no_token=True). A file of docmented functions serves straight from the command line — mcpmini tools.py, or mcpmini tools.py --transport http --port 8000 — which is the shape MCP host configs launch. Then any MCP client can connect — for example Claude Code:

claude mcp add --transport http demo http://127.0.0.1:8000/mcp -H "Authorization: Bearer S"

And mcpmini is a client too: server tools come back as bound Python functions, with their signatures, docs, and defaults rebuilt from the wire schema.

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.4

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.4
File Size Uploaded
mcpmini-0.0.4.tar.gz 16.0 kB Details

Built distribution (wheel)

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

Total release size: 31.0 kB

Release files / mcpmini-0.0.4.tar.gz

Download URL mcpmini-0.0.4.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7e9f44b1d24b0175c22125611affd03245ba86151e0f9815d21fb55e9fa27f80
BLAKE2b-256 checksum
How to use checksums
ee43a2878562468b6a667ad80e066e7264f4fa092826ec5bb74220b1a61a5b16
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.4-py3-none-any.whl

Download URL mcpmini-0.0.4-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3180a7976230cf7d7e6f9aec3121d1ef9d41c3ddc19dad21b9990462c9cccf56
BLAKE2b-256 checksum
How to use checksums
8b8b9e57846734d2aff451235195dd063813ac046468bd216f4645bc5fee52da
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

0.0.5

2 release files

This release

0.0.4 This release

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