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.31.3.tar.gz (147.2 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.31.3-cp311-abi3-win_amd64.whl (6.8 MB view details)

Uploaded CPython 3.11+Windows x86-64

mcp_compressor-0.31.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.0 MB view details)

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

mcp_compressor-0.31.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.31.3-cp311-abi3-macosx_11_0_arm64.whl (7.2 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

mcp_compressor-0.31.3-cp311-abi3-macosx_10_12_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: mcp_compressor-0.31.3.tar.gz
  • Upload date:
  • Size: 147.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","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.31.3.tar.gz
Algorithm Hash digest
SHA256 0822d45fc4d70150a4ae01d304a7aa4653cd456fc382ab1a30e4c9935756dbbc
MD5 dcfb6789c2dc1d3d7b79242ca7309c68
BLAKE2b-256 84bd4ef1b5085e36885c3578540f7cc28be70b42a736eb0bb8c26dc38e4c5422

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.31.3-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 6.8 MB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","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.31.3-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 27f6c9e315e2af11f65e273d7897125cf7a613bc5fa75814fc9074d6df1c38c0
MD5 da1e578919c489f360165362cb0cfe2d
BLAKE2b-256 9837800c4754a69124d41a9fef42b264cffb6d798c6bbe09ccc790f50dff099c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.31.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 8.0 MB
  • Tags: CPython 3.11+, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","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.31.3-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 af4bda60fc811419c602be7f8a091df8de0cbfee5280a3215da11fd8e46df0bf
MD5 a59b3fffa38180dcfd8a2fbc754f6723
BLAKE2b-256 bb1a7fff69615704b9abfcd4b20d172d5f54c2bea7e8469d79a9b5dd8a3cf233

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.31.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.25 {"installer":{"name":"uv","version":"0.11.25","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.31.3-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5fd3077f11fa3e87d21cb7a3e9c8acf5cafbcfd4a1c97a100b1d6760480eb87d
MD5 3636adab1dd2abb8860dde0890343633
BLAKE2b-256 a245d4ac0cedf0f89567211caf1f4b01b2182f9a5d9796cff6bf7fc0a1447e22

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.31.3-cp311-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 7.2 MB
  • Tags: CPython 3.11+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","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.31.3-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7c6ba875ce7237932e77af9802ca64664990f9525184238d6da3daa13abd7346
MD5 4ef3494bbe8d3175627e8718aacde8b8
BLAKE2b-256 b9f4b7422f7e200a270ad7848a1729e588dc6729050c68e04dff10661eb5d247

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.31.3-cp311-abi3-macosx_10_12_x86_64.whl
  • Upload date:
  • Size: 7.4 MB
  • Tags: CPython 3.11+, macOS 10.12+ x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.25 {"installer":{"name":"uv","version":"0.11.25","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.31.3-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6519479a8092d46d47790437fc1ba73ded5692b7cdb9c4b22c6698d2650c6cfa
MD5 832ade05be0cc8faf01fb9f381f02ad5
BLAKE2b-256 de553f4dd1a95c7354b33de28182da3d0c1cc60592fbea8203d2875d00a2d48e

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