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 inspect trace.json
trace2mcp compile trace.json --out build/my-workflow
trace2mcp benchmark trace.json --repetitions 3
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: writes and unknown operations are rejected unless explicitly allowed.
- 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 a research prototype. Review generated workflows and implement authorization, validation, timeouts, and least-privilege access around real tools before production use.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trace2mcp-0.1.0.tar.gz.
File metadata
- Download URL: trace2mcp-0.1.0.tar.gz
- Upload date:
- Size: 29.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e60be38c05b837b9685bcb4da6491098dc48d6de34cda0637a7f490ee4ac5542
|
|
| MD5 |
5d1703fc7904f342c3731937f9c7a15b
|
|
| BLAKE2b-256 |
5977cfbfe5c4f411797502ffdb0977b852d919fd6ecca1147e71bc8c15f233a9
|
File details
Details for the file trace2mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: trace2mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9305a9221314dc498d4ee92c23c45fb224ee0cb5ef1652b434dc51b806778d59
|
|
| MD5 |
14f8432cb36f16aabbe668aa760d6d65
|
|
| BLAKE2b-256 |
01302c122fa5b8d79c85cd786baf0cc2aac23090a8b310b926d85f239a8007b1
|