Static binding code generator for MCP tools
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_static_toolgen-0.1.3.tar.gz.
File metadata
- Download URL: mcp_static_toolgen-0.1.3.tar.gz
- Upload date:
- Size: 58.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f53a99373b0a2b19ec89b1cf04f001dd07844296d3eb58e9020ebbabf5665974
|
|
| MD5 |
c902908862dd36d81df5a1224a3cfe08
|
|
| BLAKE2b-256 |
b24a14fc3b991c29ce1e45ea809ba97d3b690404cafb250e3027530509f6de1b
|
Provenance
The following attestation bundles were made for mcp_static_toolgen-0.1.3.tar.gz:
Publisher:
publish.yml on hyranno/mcp_static_toolgen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_static_toolgen-0.1.3.tar.gz -
Subject digest:
f53a99373b0a2b19ec89b1cf04f001dd07844296d3eb58e9020ebbabf5665974 - Sigstore transparency entry: 1122382801
- Sigstore integration time:
-
Permalink:
hyranno/mcp_static_toolgen@ff93c7a671af3fdc11b30e5e8588514e2a1b45b3 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/hyranno
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ff93c7a671af3fdc11b30e5e8588514e2a1b45b3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_static_toolgen-0.1.3-py3-none-any.whl.
File metadata
- Download URL: mcp_static_toolgen-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eeafd39d6060fb66379be74fc857debc4e0986e0bba4603968d0f30c621ffc5b
|
|
| MD5 |
288ae5b244c5eaf7551be41832ffbeda
|
|
| BLAKE2b-256 |
507323b25b554fdb54a2243d463705265e970c4a484c217d57ad64a4e7c46122
|
Provenance
The following attestation bundles were made for mcp_static_toolgen-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on hyranno/mcp_static_toolgen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_static_toolgen-0.1.3-py3-none-any.whl -
Subject digest:
eeafd39d6060fb66379be74fc857debc4e0986e0bba4603968d0f30c621ffc5b - Sigstore transparency entry: 1122382814
- Sigstore integration time:
-
Permalink:
hyranno/mcp_static_toolgen@ff93c7a671af3fdc11b30e5e8588514e2a1b45b3 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/hyranno
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ff93c7a671af3fdc11b30e5e8588514e2a1b45b3 -
Trigger Event:
push
-
Statement type: