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

Uploaded CPython 3.11+Windows x86-64

mcp_compressor-0.23.0-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.23.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (7.6 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.11+macOS 11.0+ ARM64

mcp_compressor-0.23.0-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.23.0.tar.gz.

File metadata

  • Download URL: mcp_compressor-0.23.0.tar.gz
  • Upload date:
  • Size: 132.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","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.23.0.tar.gz
Algorithm Hash digest
SHA256 7ba8318f0d5bc844c50fd51b6dcbbcd838197f4554c170024527d9b4183c2416
MD5 52620719aa86a93aee2072449d892fb0
BLAKE2b-256 40201723e87c8b57a7b2aedc21e3b843b45fcc71ffb1add527184b422a13ea2f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.23.0-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.15 {"installer":{"name":"uv","version":"0.11.15","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.23.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 be999468ce462713cedcf7ea92677f251027df9aeddf856e134bd158c0a93199
MD5 f231cf68199d153b9653c783571754d8
BLAKE2b-256 325fcc89a120203a0bbb14fe7f982b0a00e2188492a2a9ca0560c7a11be73a16

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.23.0-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.15 {"installer":{"name":"uv","version":"0.11.15","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.23.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bc3bbdb02eea9ad327807c112dadc6aee8c5a177c83a61bed7d334430393ebbe
MD5 78c7aea92c85f4d6a617d39fb005bf20
BLAKE2b-256 5f40e4a8512469f57d1167bb088418be683df5bbe40e140d701ecbeb6113c324

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.23.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
  • Upload date:
  • Size: 7.6 MB
  • Tags: CPython 3.11+, manylinux: glibc 2.17+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","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.23.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 073606ae1ebc686a59f1536bcaabd1023c432742a3f2741e192746503cb12817
MD5 3db25a9f0153194fa60c2193b534af2a
BLAKE2b-256 5620ba8a0bac563aa40de03a2d310c39198cd1ab8d86d8b29e65c12222bba4a1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.23.0-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.15 {"installer":{"name":"uv","version":"0.11.15","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.23.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6dc186774304f5bf85f3c77a8cafd5a953adb038edff91e5881d62cf380e2b52
MD5 846388902f33b8b36b957914eb1d70ba
BLAKE2b-256 b9273983abd02387a0cb1617cd1dcbf13d30f1e6304dd950bfb680fbf9b31177

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.23.0-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.15 {"installer":{"name":"uv","version":"0.11.15","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.23.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fbff6b7bc33d443d5f16655797ed93ff748c15dc53f2a838ad231ab3ce2198aa
MD5 5cf00fcead043da363a6ccef0f450a68
BLAKE2b-256 d1693aed10ba6759b12d533db83ee3ce3e8098f3b6094d2a9984bc88fa43864d

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