mcpatom
A minimal Python MCP Server SDK.
From Greek atomos: indivisible. The whole library is a single file,
mcpatom.py, consumable two ways:
- Copy the file into your project. No dependency, no lockfile entry.
- Install the package:
pip install mcpatom- the file itself is the installed module.
Scope
- Tools, resources, and prompts, over stdio or streamable HTTP.
- Protocol versions
2026-07-28(stateless, per-request_meta) and theinitialize-handshake versions2025-11-25and2025-06-18, served side by side. - stdlib-only Python >= 3.10, no dependencies, ever.
Everything else (sampling, elicitation, subscriptions, auth, etc.) is deliberately omitted.
Usage
from mcpatom import Server
srv = Server("my-server")
@srv.tool
def greet(name: str, excited: bool = False) -> str:
"""Return a greeting for the given name."""
return f"Hello, {name}{'!' if excited else '.'}"
@srv.resource("data://motd")
def motd() -> str:
"""Message of the day."""
return "Be indivisible."
@srv.prompt
def haiku(topic: str) -> str:
"""Ask for a haiku."""
return f"Write a haiku about {topic}."
srv.serve_stdio()
For streamable HTTP instead of stdio, end with:
srv.serve_http(8388) # http://127.0.0.1:8388/mcp
serve_http accepts only localhost (and the bind host) as Origin/Host;
allowed_origins=["*.example.com"] replaces that list, ["*"] allows
any origin, and host="0.0.0.0" requires it.
More runnable servers in examples/.
Schemas and return types
Each function's name, docstring, and annotations become the tool's name,
description, and schema; @srv.tool(name=, description=, input_schema=, output_schema=) override generation, and extra= merges raw fields into
the listing. Server() also takes version= and instructions=.
Parameters may be annotated with any of these:
strintfloatboollist[X](or barelist)Literal[...]TypedDictX | Noneof any of the above
Annotated[X, "text"] adds a description the model sees. A parameter's
default is published in the schema when it is JSON-representable; a None
default is omitted unless null is a selectable Literal value.
A tool may return:
str- one text blockdict- JSON text plusstructuredContent; aTypedDictreturn annotation publishes the matchingoutputSchemaImage(data, mime_type)/Audio(data, mime_type)- one binary block (raw bytes in, base64 on the wire)- a tuple - one block per item:
strtext,Image/Audiomedia, a dict whose"type"names a spec block type verbatim (e.g.resource_link) None- empty content; any other JSON value - text
Raising is the error API: any exception becomes isError content the
model can read and correct.
Resources return str (text) or bytes (base64 blob).
Prompts take only str arguments and return a str user message, or a
list of message dicts passed through verbatim.
Wiring it up
claude mcp add my-server -- /abs/path/.venv/bin/python /abs/path/server.py
or in any mcpServers config:
{"mcpServers": {"my-server": {"command": "/abs/path/.venv/bin/python", "args": ["/abs/path/server.py"]}}}
Smoke test without a client:
echo '{"jsonrpc":"2.0","id":1,"method":"server/discover"}' | python server.py
# {"jsonrpc":"2.0","id":1,"result":{"resultType":"complete","_meta":{...},"supportedVersions":[...],"capabilities":{"tools":{}},"ttlMs":0,"cacheScope":"private"}}
Metadata
Release files for mcpatom 0.3.0
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 |
|---|---|---|---|---|
| mcpatom-0.3.0.tar.gz | 30.1 kB | Without provenance | Details for mcpatom-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcpatom-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for mcpatom-0.3.0-py3-none-any.whl |
Total release size: 41.1 kB
Release files / mcpatom-0.3.0.tar.gz
| Download URL | mcpatom-0.3.0.tar.gz |
|---|---|
| Size | 30.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f981c9e6d087b24fb26c5dcf613149af9562c84cd4bea668dc75d0285f86f6a
|
|
BLAKE2b-256 checksum How to use checksums |
38110613a030ac6ddc5ac8083daf4a391fa76389bfea18f65f1a99970c655b1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / mcpatom-0.3.0-py3-none-any.whl
| Download URL | mcpatom-0.3.0-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7fcff626a16b0faad3a63163066fe6a1a9bbf039e2bb1769467e63f36aece399
|
|
BLAKE2b-256 checksum How to use checksums |
f0ac9ce497c3d80a2e0e35940ae1b8ebee70b4d72fab94110fbcd9ef62b502bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for mcpatom 0.3.0
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.