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

Uploaded CPython 3.11+Windows x86-64

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

Uploaded CPython 3.11+macOS 11.0+ ARM64

mcp_compressor-0.29.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.29.1.tar.gz.

File metadata

  • Download URL: mcp_compressor-0.29.1.tar.gz
  • Upload date:
  • Size: 141.3 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.29.1.tar.gz
Algorithm Hash digest
SHA256 0781fa7e769d4d1b88425c5b1ab632e42b613978e46622cfc5e61760655630ec
MD5 e8b2861348f6de771eefce013118e572
BLAKE2b-256 0132ff98a8445fa9f0d5422ac5831bbff99bf07d4032b7abf3992571bb1ed7a7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.29.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.29.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 20c4603b1a156b4313e7e686240e06961d4a3d96722cba7dd00ba3a970cc4ccb
MD5 bfd5d4d701f633692ad86cdb343a4fa1
BLAKE2b-256 070393a16a5064eae7ec07fc3a3d4f4f255092be58d770cb7eba5cfc89a167ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.29.1-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.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.29.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5143648a6c02ad94914bd70ad6eaa943d10b9c2763fa59bc66d80e8fef9ef53f
MD5 daf51b512d2331c14db5001c47013ecb
BLAKE2b-256 abba2dde197fbefbcffbdf279582b7b387bdb9e9c8bc3e7dc3866c632607d793

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.29.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.29.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0ed732e0e222c038babc80a0110b50da324bb4941b227f8a5275beb34247a182
MD5 ed81dc6e209fb23469b6f98cfcb4659f
BLAKE2b-256 0473ecb4605a303753d48e36bde09d27c11cfb2a5c3bdd04069b709bd8af50c0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.29.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.29.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f296aa88ed154e17673c2b55bc96800a3c74d2dbc97c64b8e2a14345a0de83c0
MD5 27927b24747e5adae582afb4d9abb256
BLAKE2b-256 15e6f19a2cbf9326cc2b3c087b46be0a4acff1269428b6d0190da78e77fe36f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_compressor-0.29.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.29.1-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ca580d12624bc8dd5138f85ab7e5e6f4c3ffb2ed8b219ffbb60e39ddb95180fa
MD5 0f2b0488a23d414030fbf0023986a300
BLAKE2b-256 6b701621063c36579dbc0e23d6f15245604af7a0e93e2c9352cf226b895d1b39

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