Skip to main content

OpenTrace Python agent — maps system architecture, code structure, and service relationships into a knowledge graph

Project description

OpenTrace

PyPI - Version License

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

opentraceai-0.3.0rc20.tar.gz (207.1 kB view details)

Uploaded Source

Built Distribution

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

opentraceai-0.3.0rc20-py3-none-any.whl (98.3 kB view details)

Uploaded Python 3

File details

Details for the file opentraceai-0.3.0rc20.tar.gz.

File metadata

  • Download URL: opentraceai-0.3.0rc20.tar.gz
  • Upload date:
  • Size: 207.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for opentraceai-0.3.0rc20.tar.gz
Algorithm Hash digest
SHA256 d4f17d42b3c6ac0213a7d8da40baa2831bdf2fd5cfdb55866815e187a79639c8
MD5 b0422fca7ff4ac1d2fc77db411a10968
BLAKE2b-256 e29102e0d54692b41f71e595f50a1c9f1b2d68a35a11c637b863b2a3d4573d65

See more details on using hashes here.

Provenance

The following attestation bundles were made for opentraceai-0.3.0rc20.tar.gz:

Publisher: publish-dev.yml on opentrace/opentrace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file opentraceai-0.3.0rc20-py3-none-any.whl.

File metadata

File hashes

Hashes for opentraceai-0.3.0rc20-py3-none-any.whl
Algorithm Hash digest
SHA256 ae03e5f0b5f5e0ef46e8fc459384b2110e35aec97002eb0666af47a2238b5004
MD5 6cbfacabf5081e75fa6a164f6fd4ed6a
BLAKE2b-256 3a4fe55967e95cdc8535ec0e41c3bf6fc176ab3f8c40240b75f33a205eb6cc6b

See more details on using hashes here.

Provenance

The following attestation bundles were made for opentraceai-0.3.0rc20-py3-none-any.whl:

Publisher: publish-dev.yml on opentrace/opentrace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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