Skip to main content

tracegc-mcp

Model Context Protocol (MCP) server integration for TraceGC context compaction.

Usage Example

tracegc-mcp exposes three core MCP tools backed by TraceGC's deterministic compaction pipeline:

  • add_event(event: dict, session_id: str) — Appends a structured event to an active session trace.
  • compact(session_id: str) — Runs dead-branch sweeping, override pruning, deduplication, and cycle collapse for a session, returning the compacted prompt and metrics.
  • get_receipt(session_id: str, node_id: str) — Retrieves full, unpruned event payload receipts for any pruned node.
from tracegc_mcp import TraceGCMCPServer, add_event, compact, get_receipt

# 1. Initialize server instance
server = TraceGCMCPServer()

# 2. Add events to a session
server.add_event({
    "id": "e1",
    "type": "set_var",
    "timestamp": 100,
    "key": "database",
    "value": "postgres"
}, session_id="sess_100")

server.add_event({
    "id": "e2",
    "type": "set_var",
    "timestamp": 200,
    "key": "database",
    "value": "sqlite"
}, session_id="sess_100")

# 3. Compact the session trace
result = server.compact(session_id="sess_100")
print(result["prompt"])
# Output: "database = sqlite"

# 4. Retrieve receipt for the pruned event
receipt = server.get_receipt(session_id="sess_100", node_id="e1")
print(receipt["receipt"]["value"])
# Output: "postgres"

Module-level tool helpers (add_event, compact, get_receipt) are also provided for direct tool dispatching.

Metadata

Release files for tracegc-mcp 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for tracegc-mcp 0.1.0
File Interpreter ABI Platform Actions
tracegc_mcp-0.1.0-py3-none-any.whl Python 3 none any Details for tracegc_mcp-0.1.0-py3-none-any.whl

Release files / tracegc_mcp-0.1.0-py3-none-any.whl

Download URL tracegc_mcp-0.1.0-py3-none-any.whl
Size 3.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fde67c04362e50186863f17dcad7e0e39356af82cd2a93a217d6fc8bb5c482c7
BLAKE2b-256 checksum
How to use checksums
5f322b171c2f46ef12646869d0c40f02c6128586cfdd74bfed01d9920edd278e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.2

Security for tracegc-mcp 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page