Skip to main content

Trace2MCP

Teach once. Run forever.

Trace2MCP compiles a successful AI-agent tool-call trace into a deterministic, inspectable, MCP-ready workflow.

An agent can discover a useful procedure once. Trace2MCP then validates the trace, infers data dependencies, deduplicates safe reads, builds a directed acyclic graph (DAG), and identifies work that can run concurrently.

Install

pip install trace2mcp

To run generated MCP servers, install the optional MCP dependency:

pip install "trace2mcp[mcp]"

Python 3.10 or newer is required.

Try it

trace2mcp demo
trace2mcp inspect trace.json
trace2mcp compile trace.json --out build/my-workflow
trace2mcp verify build/my-workflow/workflow.json
trace2mcp replay build/my-workflow/workflow.json --frozen
trace2mcp benchmark trace.json --repetitions 3

trace2mcp demo runs the complete offline path: teach, compile, verify, frozen replay, and a visible safety-gate example. It uses no model, API key, or network.

Or use the Python API:

from trace2mcp import compile_trace, load_trace

trace = load_trace("trace.json")
workflow = compile_trace(trace, allow_side_effects=False)

print(workflow.to_dict())

The compile command produces a portable workflow.json, inert handler stubs, and a minimal MCP server skeleton. You provide the real tool implementations; observed trace outputs are never converted into executable code.

Why compile traces?

  • Lower orchestration overhead: reuse a discovered procedure instead of planning the same tool path on every run.
  • Dependency-aware execution: independent read-only calls can run in parallel.
  • Fail-closed safety: unknown and destructive operations are denied; consequential operations need a reviewed contract and explicit approval.
  • Auditability: tool calls, references, dependencies, and scheduling remain visible as portable JSON.
  • Provider-neutral design: the core compiler does not require a model or an API key.

Live demo

Use the free, browser-only Trace2MCP interactive demo or visit the Hugging Face Space.

The included demo uses synthetic outputs and recorded durations to explain the scheduler. Its speedup is educational, not a production performance claim.

Safety

Trace2MCP is an alpha research tool. Version 0.2 verifies structure and integrity, supports deterministic frozen replay, and runs reviewed local handlers with bounded concurrency, timeouts, and safe retries. It does not provide distributed durability, sandboxing, live remote replay, or a proof of semantic equivalence.

Licensed under the MIT License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trace2mcp-0.2.0.tar.gz (66.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trace2mcp-0.2.0-py3-none-any.whl (49.6 kB view details)

Uploaded Python 3

File details

Details for the file trace2mcp-0.2.0.tar.gz.

File metadata

  • Download URL: trace2mcp-0.2.0.tar.gz
  • Upload date:
  • Size: 66.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.10

File hashes

Hashes for trace2mcp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6f25279a7824926f1a18fe9c65945e4296cf4e8d2e4082d7508377bdc4b49c33
MD5 204f664bb637d0cb3948e5638e3ad5da
BLAKE2b-256 2b5e5e7682aa14a54ed901388f5ac50e4e1723be2a7e5c662f733d00b2455af4

See more details on using hashes here.

File details

Details for the file trace2mcp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: trace2mcp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 49.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.10

File hashes

Hashes for trace2mcp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8443e7afd8420c239f8f1d28758c8d9afd3bda4f53cf7dab0d394a969cd39e2e
MD5 04e6de241ebe0074177b1d73d04c2607
BLAKE2b-256 8ea9de21e2ab9d00147345d4b4d56b2468e660bca1e1ed6824c89e16a7fdd2d1

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.1

2 files

This release

0.2.0 This release

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page