MCP-Static-Toolgen
Static binding code generator for MCP tools.
Background
Most MCP integrations fetch tool schemas dynamically at runtime. While flexible, this makes it impossible to use static type checkers, breaks IDE autocompletion, and introduces "runtime surprises" when upstream schemas change.
This project is a static bindgen for MCP. It connects to an MCP server once and generates strictly typed Python code. By moving tool resolution from runtime to build-time, you get:
-
Full Type Safety: Catch interface mismatches with
mypyorpyrightbefore execution. -
IDE Support: Enjoy perfect autocompletion for tool arguments.
-
Determinism: Your agent's interface is locked in code, making it auditable and production-ready.
Usage
Install
uv add mcp_static_toolgen
Code Generation
import asyncio
from langchain_mcp_adapters.sessions import Connection
from mcp_static_toolgen.mcp import connect_and_generate
connections: dict[str, Connection] = {
"mock": {
"transport": "stdio",
"command": "python",
"args": ["src/tests/mock_mcp_server.py"],
},
}
generated_codes = asyncio.run(connect_and_generate(connections))
See example for complete example.
Metadata
Release files for mcp-static-toolgen 0.1.3
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 |
|---|---|---|---|---|
| mcp_static_toolgen-0.1.3.tar.gz | 58.0 kB | With provenance | Details for mcp_static_toolgen-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp_static_toolgen-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for mcp_static_toolgen-0.1.3-py3-none-any.whl |
Total release size: 66.1 kB
Release files / mcp_static_toolgen-0.1.3.tar.gz
| Download URL | mcp_static_toolgen-0.1.3.tar.gz |
|---|---|
| Size | 58.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f53a99373b0a2b19ec89b1cf04f001dd07844296d3eb58e9020ebbabf5665974
|
|
BLAKE2b-256 checksum How to use checksums |
b24a14fc3b991c29ce1e45ea809ba97d3b690404cafb250e3027530509f6de1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 18, 2026.
Transparency logRelease files / mcp_static_toolgen-0.1.3-py3-none-any.whl
| Download URL | mcp_static_toolgen-0.1.3-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eeafd39d6060fb66379be74fc857debc4e0986e0bba4603968d0f30c621ffc5b
|
|
BLAKE2b-256 checksum How to use checksums |
507323b25b554fdb54a2243d463705265e970c4a484c217d57ad64a4e7c46122
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 18, 2026.
Transparency logSecurity for mcp-static-toolgen 0.1.3
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mcp_static_toolgen-0.1.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 18, 2026.
Transparency logA 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.