OpenTrace Python agent — maps system architecture, code structure, and service relationships into a knowledge graph
Project description
OpenTrace
Index any codebase into a knowledge graph — then query it with AI via MCP.
OpenTrace parses source code with tree-sitter, extracts classes, functions, imports, and call relationships, and stores the result in an embedded graph database. The graph is queryable through a built-in MCP server, so tools like Claude Code can search, traverse, and understand your codebase structure.
Install
pip install opentraceai
Or run directly with uv:
uvx opentraceai index .
Requires Python 3.12+.
Quick Start
1. Index a codebase
opentraceai index /path/to/repo
This parses every supported file, extracts symbols and relationships, and writes the graph to ./otindex.db.
$ opentraceai index ~/projects/myapp
Opening LadybugDB at ./otindex.db ...
Indexing /home/user/projects/myapp ...
1284 nodes, 3421 relationships, 187 files, 95 classes, 412 functions
Done in 4.2s.
2. Query via MCP
Start a stdio MCP server against the indexed database:
opentraceai mcp --db ./otindex.db
This exposes graph query tools over stdin/stdout for any MCP-compatible client.
Claude Code
Add OpenTrace to Claude Code as a plugin, or configure it manually in your project's .mcp.json:
{
"mcpServers": {
"opentrace": {
"type": "stdio",
"command": "uvx",
"args": ["opentraceai", "mcp", "--db", "./otindex.db"]
}
}
}
MCP Tools
| Tool | Description |
|---|---|
search_graph |
Full-text search across nodes by name or properties |
list_nodes |
List nodes by type (Class, Function, Service, etc.) |
get_node |
Get a node's full details and immediate neighbors |
traverse_graph |
Walk relationships from a node (outgoing, incoming, or both) |
get_stats |
Get graph statistics — node/edge counts broken down by type |
Supported Languages
| Full extraction (symbols + calls + imports) | Structural extraction (symbols only) |
|---|---|
| Python, TypeScript/JavaScript, Go | Rust, Java, Kotlin, C#, C/C++, Ruby, Swift |
Config and data files (JSON, YAML, TOML, Protobuf, SQL, GraphQL, Bash) are indexed as file nodes.
CLI Reference
opentraceai index [PATH] [OPTIONS]
| Option | Default | Description |
|---|---|---|
PATH |
. |
Directory to index |
--db |
./otindex.db |
Database path |
--repo-id |
directory name | Repository identifier |
--batch-size |
200 | Items per write batch |
-v, --verbose |
off | Debug logging |
opentraceai mcp [OPTIONS]
| Option | Default | Description |
|---|---|---|
--db |
./otindex.db |
Database path |
-v, --verbose |
off | Debug logging |
Part of OpenTrace
This package is the CLI/MCP component of OpenTrace, an open-source platform for mapping system architecture into knowledge graphs. The full project also includes a browser-based graph explorer at oss.opentrace.ai.
License
Apache License 2.0
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
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 opentraceai-0.3.0rc18.tar.gz.
File metadata
- Download URL: opentraceai-0.3.0rc18.tar.gz
- Upload date:
- Size: 199.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4e0fcb8546713e02879606d775a45353cd7cdb4db331d2f93a6983af3334c94
|
|
| MD5 |
352fa4f13cd48b8f67259d99be7d5958
|
|
| BLAKE2b-256 |
dfd236aecc1dd7caa448e661e01f8e75d9f593a7bf990569f16f2c34e63a7210
|
Provenance
The following attestation bundles were made for opentraceai-0.3.0rc18.tar.gz:
Publisher:
publish-dev.yml on opentrace/opentrace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opentraceai-0.3.0rc18.tar.gz -
Subject digest:
d4e0fcb8546713e02879606d775a45353cd7cdb4db331d2f93a6983af3334c94 - Sigstore transparency entry: 1206089158
- Sigstore integration time:
-
Permalink:
opentrace/opentrace@609d786e0f586f015af8599df657cfae80f0c8a6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/opentrace
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-dev.yml@609d786e0f586f015af8599df657cfae80f0c8a6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file opentraceai-0.3.0rc18-py3-none-any.whl.
File metadata
- Download URL: opentraceai-0.3.0rc18-py3-none-any.whl
- Upload date:
- Size: 94.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2020273405f68981a095589adb58500e616b984d57a086c54c4cd6ab2f52ab9
|
|
| MD5 |
6a83f5d6a523b2afb1f9b3c76c9e6ab7
|
|
| BLAKE2b-256 |
5a6fcc0e16e62987664a2735215b841859f101572cfcd3ac27538fb61070181b
|
Provenance
The following attestation bundles were made for opentraceai-0.3.0rc18-py3-none-any.whl:
Publisher:
publish-dev.yml on opentrace/opentrace
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
opentraceai-0.3.0rc18-py3-none-any.whl -
Subject digest:
a2020273405f68981a095589adb58500e616b984d57a086c54c4cd6ab2f52ab9 - Sigstore transparency entry: 1206089164
- Sigstore integration time:
-
Permalink:
opentrace/opentrace@609d786e0f586f015af8599df657cfae80f0c8a6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/opentrace
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-dev.yml@609d786e0f586f015af8599df657cfae80f0c8a6 -
Trigger Event:
push
-
Statement type: