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.28.1.tar.gz (139.6 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.28.1-cp311-abi3-win_amd64.whl (6.7 MB view details)

Uploaded CPython 3.11+Windows x86-64

mcp_compressor-0.28.1-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.28.1-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.28.1-cp311-abi3-macosx_11_0_arm64.whl (7.1 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

mcp_compressor-0.28.1-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.28.1.tar.gz.

File metadata

  • Download URL: mcp_compressor-0.28.1.tar.gz
  • Upload date:
  • Size: 139.6 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.28.1.tar.gz
Algorithm Hash digest
SHA256 147f69891f7966e659e79947c6b73e7003f45001230b7f154bce85e84c522705
MD5 481ee9b26b0d7f2d3bce94a8fd0f0d18
BLAKE2b-256 7cb441ae22a8d8f3bb4d2e40a8b1da1ca341adf946a98a604416065a313c1771

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.28.1-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.28.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f804656e88c73e89250715dfc453fbf4e3c97a2096ac11e457011ce2f8d46c7d
MD5 6dfbd4134056e0a019ad1bc833b67090
BLAKE2b-256 e42770f0f8124fd9901c107507f47d393514d8db97ab4f658f0c754e2da811b5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.28.1-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.28.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e8a2971e79b30cf9501595311531d5704e6fcff7f7a2d977f216707b15318127
MD5 c7e6b24473181c7dc10d5eca7edf7b94
BLAKE2b-256 20c2649dab7ce7799d2c44ecd000e83313eb4202731fb91f5cc9f1aca4b6347c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.28.1-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.28.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0f63cf80001e1e862c36c8a0b4f79655a6abb70cc98feaa15fb652a86e9ab961
MD5 929f4f80bdef020750868760818598e9
BLAKE2b-256 d649bff19bdde7e91fb65e64fe03e4278de62bf2e1ecbc8277f8b9c1831b7037

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.28.1-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.28.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 57b87f3856b11abbf8ea9a06d48ae858ff98aa31c742177f928de1098e12a531
MD5 2879ee0633dd3255bfd4640b7079369b
BLAKE2b-256 32243b04e9d8328e8adebc0d1a4bf8865fe1796047b4574c67115375ca558b0c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.28.1-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.28.1-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 11f3abcdacde7a0641acf1fd9c74075ef1f07346e28a149ca2e30479fd34c2de
MD5 59f18d2eb1fb31d9c34b4e2a5738267e
BLAKE2b-256 1cb0cf19c691a567c47ff389d470bf86cc9689ea7c3d1fa7f85c06e633ede2a5

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