Skip to main content

Rust-backed experimental Python package for mcp-compressor.

Project description

mcp-compressor Python SDK

Python SDK and CLI wrapper for mcp-compressor.

The public Python import is mcp_compressor:

from mcp_compressor import CompressorClient

Quick start

The primary SDK object is CompressorClient. It starts a local session and returns a CompressorProxy; no mcp-compressor stdio subprocess is required.

from mcp_compressor import CompressorClient

servers = {
    "alpha": {
        "command": "python",
        "args": ["alpha_server.py"],
    },
    "atlassian": {
        "url": "https://mcp.atlassian.com/v1/mcp",
    },
}

with CompressorClient(
    servers=servers,
    mode="compressed",
    compression_level="medium",
    include_tools=["getConfluencePage", "updateConfluencePage"],
    toonify=True,
) as proxy:
    print([tool.name for tool in proxy.tools])
    result = proxy.invoke(
        "getAccessibleAtlassianResources",
        {},
        server="atlassian",
    )
    print(result)

Modes

CompressorClient accepts these modes:

  • compressed — expose compressed wrapper tools such as <server>_get_tool_schema and <server>_invoke_tool.
  • cli — expose CLI/help tools for generated shell command usage.
  • bash — expose Just Bash command integration for command-oriented agents.

Generated Python and TypeScript clients are produced with proxy.write_client(...) rather than by selecting a long-lived session mode.

Just Bash metadata

Just Bash mode lets language hosts register backend MCP tools as shell-style commands:

from mcp_compressor import CompressorClient, create_just_bash_commands

with CompressorClient(servers=servers, mode="bash") as proxy:
    commands = {cmd.command_name: cmd for cmd in create_just_bash_commands(proxy)}
    print(commands["atlassian_get-accessible-atlassian-resources"]([]))

Duplicate backend command names are prefixed with the provider name, for example alpha_echo and beta_echo.

Generated clients

A connected proxy can write shell, Python, or TypeScript clients that call the live proxy:

with CompressorClient(servers=servers, compression_level="max") as proxy:
    proxy.write_client("cli", "./bin", name="atlassian")
    proxy.write_client("python", "./generated-py", name="atlassian")
    proxy.write_client("typescript", "./generated-ts", name="atlassian")

Packaging smoke test

Build a local wheel and verify it imports from a clean virtualenv:

uvx maturin build --release --out dist
python -m venv /tmp/mcp-compressor-wheel-test
/tmp/mcp-compressor-wheel-test/bin/python -m pip install "$PWD"/dist/*.whl
cd /tmp
/tmp/mcp-compressor-wheel-test/bin/python -c "from mcp_compressor import CompressorClient, ToolSpec"

CI runs the same kind of wheel smoke test before uploading the built wheel as an artifact.

Advanced helpers

Low-level helpers such as compress_tool_listing, parse_tool_argv, and ToolSpec remain available for tests and advanced integrations, but the primary SDK entry point is CompressorClient.

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

mcp_compressor-0.26.3.tar.gz (135.7 kB view details)

Uploaded Source

Built Distributions

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

mcp_compressor-0.26.3-cp311-abi3-win_amd64.whl (6.7 MB view details)

Uploaded CPython 3.11+Windows x86-64

mcp_compressor-0.26.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.9 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

mcp_compressor-0.26.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.7 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

mcp_compressor-0.26.3-cp311-abi3-macosx_11_0_arm64.whl (7.1 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

mcp_compressor-0.26.3-cp311-abi3-macosx_10_12_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file mcp_compressor-0.26.3.tar.gz.

File metadata

  • Download URL: mcp_compressor-0.26.3.tar.gz
  • Upload date:
  • Size: 135.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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}

File hashes

Hashes for mcp_compressor-0.26.3.tar.gz
Algorithm Hash digest
SHA256 424be2507e8ac43d6326a627fa33a6264ab50c3dc32ec31b6d56c810ba9343c5
MD5 65ead1b7ff86f7d50f34f2b45612fea0
BLAKE2b-256 35c750f51ef99c4ea9715440f74718816c7e31e9ff28662ff8d52b24ff624790

See more details on using hashes here.

File details

Details for the file mcp_compressor-0.26.3-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: mcp_compressor-0.26.3-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 6.7 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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}

File hashes

Hashes for mcp_compressor-0.26.3-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 4d0ea5d70c9675fe8b2f5577f67ccd458737246e04df274cfd44867353e3daf8
MD5 8abb2098899f1d6ed2f939d695f0e95e
BLAKE2b-256 ecaa8904a8124337be1814ab4391dc7c2ea5a134e8239e5e7efeefe61a0478c9

See more details on using hashes here.

File details

Details for the file mcp_compressor-0.26.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: mcp_compressor-0.26.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 7.9 MB
  • Tags: CPython 3.11+, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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}

File hashes

Hashes for mcp_compressor-0.26.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 156683bbe6ed9c2c0cce546c786662c9a9554a579c52c7d1c8c56d6688765886
MD5 860c6cb701aadab41e2e09591c6212c2
BLAKE2b-256 fd66a7b21a24ca076c3715c8ecff4ab8d6a2273a660310ec91b9b7aa3d823215

See more details on using hashes here.

File details

Details for the file mcp_compressor-0.26.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

  • Download URL: mcp_compressor-0.26.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 7.7 MB
  • Tags: CPython 3.11+, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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}

File hashes

Hashes for mcp_compressor-0.26.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 32407dac803acbe2d1a67cdb70e4a5b5fb0581c4d89f34c428e16f9e8399e920
MD5 d9c3c8efabaadcd6146576eb5e65f3de
BLAKE2b-256 86f60faee82433a4fe10aa177d8d3aac3a892dcb0b787a7ce2f4d6348d2bcb87

See more details on using hashes here.

File details

Details for the file mcp_compressor-0.26.3-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: mcp_compressor-0.26.3-cp311-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 7.1 MB
  • Tags: CPython 3.11+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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}

File hashes

Hashes for mcp_compressor-0.26.3-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b750aa670784aff56ddd751e4cf68e669a39cac0096175625bbf431e251bf719
MD5 d6e423b1d8b84c56ff468cdd9b7f42f0
BLAKE2b-256 c3df94019c36e29ede1f4b66d885e1f632c35f6b4df6d1b1be5ac3068d948bd5

See more details on using hashes here.

File details

Details for the file mcp_compressor-0.26.3-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

  • Download URL: mcp_compressor-0.26.3-cp311-abi3-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 7.3 MB
  • Tags: CPython 3.11+, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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}

File hashes

Hashes for mcp_compressor-0.26.3-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2231b21b790a3869a50dc212cbbcccb2e06a3e703ac1a9ce60d4b735eb37425d
MD5 4ee174174640c80922d921df25a129f9
BLAKE2b-256 078dbb0baf88c03c262d9f4f1d2a9ec1059f0efe3717d30fabd76fb16d61d760

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