Logo MCP Compressor

MCP Compressor

Tổ chức
atlassian-labs

An MCP server wrapper for reducing tokens consumed by MCP tools, available in typescript, python, and rust

Nhà phát hànhatlassian-labs
Kho mãmcp-compressor
Ngôn ngữRust
Bản fork
14
Sao
136
Công cụ có sẵn
0
Phương thức truyền tảistdio
Danh mục
Giấy phépApache-2.0
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    MCP Compressor cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    136 sao và 14 bản fork từ kho mã được liên kết.

mcp-compressor

MCP Toplist

Release Build status Commit activity License

mcp-compressor helps agents use large MCP servers without spending huge amounts of context on tool descriptions and schemas.

It can run as a CLI MCP proxy, or be embedded directly from Python, TypeScript, or Rust.

Why mcp-compressor?

A powerful MCP server can expose dozens or hundreds of tools. Each tool has a name, description, input schema, and sometimes large nested JSON Schema details. Sending all of that to a model up front can waste thousands of tokens before the agent has done any useful work.

For example, large public MCP servers can spend thousands or tens of thousands of tokens on tool descriptions alone. That creates three problems:

  • models spend context on tools they may never call,
  • cost increases for every request that carries the tool list,
  • adding multiple MCP servers quickly overwhelms practical context budgets.

mcp-compressor changes the interaction pattern: the model sees a small compressed surface first, asks for the full schema only for the selected tool, and then invokes that tool.

Opt into bounded tool responses in any proxy mode with --shrinkfit (20,000 characters) or --shrinkfit=10000. Object responses retain their top-level shape and add truncation instructions. CLI/Code/Just Bash sessions save the full original in a private temporary file; MCP callers can recall with full=true using a session cache or bypassing shrinking on a backend call. See recoverable response shrinking.

Pattern 1: compressed MCP proxy

Use this when you want any MCP client to see a smaller tool surface.

The frontend usually exposes only:

  • get_tool_schema
  • invoke_tool
  • optionally list_tools at max compression

MCP protocol negotiation

The stdio and streamable HTTP frontends accept both legacy initialize clients and modern 2026-07-28 discovery clients, including Python MCP SDK 2.2.0 in auto, legacy, or explicit 2026-07-28 mode. Backend connections initialize independently, so modern clients can use legacy backends without sending frontend negotiation metadata to them. Backends must support legacy initialize; modern-only backends are not supported. Application tool-call metadata and tool result content, annotations, structured content, and error flags are preserved.

Modern catalog and resource-read responses use ttlMs: 0 and private cache scope. Catalogs remain static for the connection; dynamic change subscriptions are not advertised or supported. Legacy responses omit modern protocol fields.

Pattern 2: local proxy for SDKs and generated clients

Use this when your application wants to embed compression directly and call tools from code or shell commands.

The SDK starts a local session proxy for generated clients. Generated clients call that proxy using a session token. Your app does not need to spawn a mcp-compressor stdio subprocess.

Features

Quick example

=== "CLI"

```bash
mcp-compressor -c medium -- python server.py
```

=== "Python"

```python
from mcp_compressor import CompressorClient

with CompressorClient(
    servers={"alpha": {"command": "python", "args": ["server.py"]}},
    compression_level="medium",
) as proxy:
    print([tool.name for tool in proxy.tools])
    print(proxy.invoke("echo", {"message": "hello"}))
```

=== "TypeScript"

```ts
import { CompressorClient } from "@atlassian/mcp-compressor";

const proxy = await new CompressorClient({
  servers: { alpha: { command: "python", args: ["server.py"] } },
  compressionLevel: "medium",
}).connect();

try {
  console.log(proxy.tools.map((tool) => tool.name));
  console.log(await proxy.invoke("echo", { message: "hello" }));
} finally {
  proxy.close();
}
```

=== "Rust"

```rust
use mcp_compressor::compression::CompressionLevel;
use mcp_compressor::sdk::{CompressorClient, ServerConfig};
use serde_json::json;

let proxy = CompressorClient::builder()
    .server("alpha", ServerConfig::command("python").arg("server.py"))
    .compression_level(CompressionLevel::Medium)
    .build()
    .connect()
    .await?;

let result = proxy.invoke("echo", json!({ "message": "hello" })).await?;
```

Generated clients

CLI Mode generates shell commands:

bash
mcp-compressor --cli-mode --server-name atlassian -- https://mcp.atlassian.com/v1/mcp
atlassian get-accessible-atlassian-resources

Code Mode generates Python or TypeScript functions:

python
# generated-py/atlassian.py
import atlassian

resources = atlassian.get_accessible_atlassian_resources()
ts
import { getAccessibleAtlassianResources } from "./generated-ts/atlassian.ts";

const resources = await getAccessibleAtlassianResources();

See Code Mode and generated clients for more detail.

Where to go next

  1. Install the package you need.
  2. Run the quickstart.
  3. Read how compression works.
  4. Choose between CLI usage, SDK usage, generated clients, and Just Bash.

Cài đặt

TypingMind
{
  "mcpServers": {
    "mcp-compressor": {
      "command": "uvx",
      "args": [
        "mcp-compressor",
        "{{config.SERVER_COMMAND_OR_URL}}"
      ],
      "env": {
        "SERVER_COMMAND_OR_URL": "<SERVER_COMMAND_OR_URL>"
      }
    }
  }
}

Dùng MCP MCP Compressor với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối MCP Compressor, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Cài trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Cài trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Giữ tiến trình chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Giữ tiến trình trong cửa sổ Terminal chạy trong khi dùng các công cụ MCP.
3

Thêm MCP Compressor làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của MCP Compressor.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "mcp-compressor": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của MCP Compressor, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của MCP Compressor.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng MCP Compressor giúp tôi làm việc này không?
MCP Compressor
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng MCP Compressor.

Câu hỏi thường gặp

Máy chủ MCP MCP Compressor dùng để làm gì?

MCP Compressor là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP MCP Compressor với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng MCP Compressor với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP MCP Compressor với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối MCP Compressor, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP MCP Compressor với TypingMind?

MCP Compressor hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP MCP Compressor cung cấp những công cụ nào trong TypingMind?

MCP Compressor cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP MCP Compressor không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu MCP Compressor yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇