Skip to main content

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 mypy or pyright before 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


Download files

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

Source Distribution

mcp_static_toolgen-0.1.3.tar.gz (58.0 kB view details)

Uploaded Source

Built Distribution

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

mcp_static_toolgen-0.1.3-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

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

Hashes for mcp_static_toolgen-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f53a99373b0a2b19ec89b1cf04f001dd07844296d3eb58e9020ebbabf5665974
MD5 c902908862dd36d81df5a1224a3cfe08
BLAKE2b-256 b24a14fc3b991c29ce1e45ea809ba97d3b690404cafb250e3027530509f6de1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_static_toolgen-0.1.3.tar.gz:

Publisher: publish.yml on hyranno/mcp_static_toolgen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_static_toolgen-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_static_toolgen-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 eeafd39d6060fb66379be74fc857debc4e0986e0bba4603968d0f30c621ffc5b
MD5 288ae5b244c5eaf7551be41832ffbeda
BLAKE2b-256 507323b25b554fdb54a2243d463705265e970c4a484c217d57ad64a4e7c46122

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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