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; 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'

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcpmini-0.0.1.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcpmini-0.0.1-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file mcpmini-0.0.1.tar.gz.

File metadata

  • Download URL: mcpmini-0.0.1.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.2

File hashes

Hashes for mcpmini-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c0662186fa0c1b493053965124331d48790ebf7cef3b917725eead0fe8139760
MD5 64daf63d2dbc74e43d9dda4bf44276b3
BLAKE2b-256 85072fd5e4d57ad8163788985800e7062183c1859db924360f5d254ab0bca9a1

See more details on using hashes here.

File details

Details for the file mcpmini-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: mcpmini-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.2

File hashes

Hashes for mcpmini-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3e69917b74efce65121700679b99cb380a18bd3295065d1d05f692000b0b1487
MD5 e6ae29042ab4df9390c590d7765d751a
BLAKE2b-256 ab8b348631529f37e5b42abd9316b5528ef7bca38ef572bcb65c522bf2989c71

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page