Skip to main content

ArchGraph

License: MIT Python 3.11+ MCP Server Tests

Security-first code intelligence for AI agents.
Parses 10 languages, builds a knowledge graph with taint analysis, CVE detection, and clustering.
Connect to any AI agent via MCP — Cursor, Claude Code, Windsurf, and more.


Why ArchGraph?

Other tools help you understand code. ArchGraph helps you secure it.

ArchGraph Code Search AST Parsers SAST Tools
Taint Analysis ✅ Input → Sink ❌ ❌ ✅
CVE Detection ✅ Auto via OSV ❌ ❌ Partial
CFG / Data Flow ✅ libclang + tree-sitter ❌ Partial ✅
MCP for AI Agents ✅ 7 tools ❌ ❌ ❌
Functional Clustering ✅ Community detection ❌ ❌ ❌
Execution Tracing ✅ Entry → Sink flows ❌ ❌ ❌
Export (JSON/GraphML) ✅ ❌ ❌ Partial
Local-first ✅ Neo4j Varies ✅ Varies
License MIT Varies Varies Often proprietary

Quick Start

# Install
pip install archgraph

# Extract (auto-detects languages)
archgraph extract /path/to/repo -w 4

# Query the graph
archgraph query "MATCH (f:Function {is_input_source: true}) RETURN f.name, f.file"

# Start web dashboard
archgraph serve --port 8080

# Generate HTML security report
archgraph report /path/to/repo

With Docker (Neo4j included):

docker compose up -d neo4j           # password: archgraph
archgraph extract /path/to/repo --neo4j-password archgraph

🤖 AI Agent Integration (MCP)

ArchGraph exposes 7 tools and 4 resources to any MCP-compatible agent.

Setup

# Index your repo
archgraph extract . --include-cve --include-clustering

# Start MCP server
archgraph mcp

Connect your agent:

Agent Command
Claude Code claude mcp add archgraph -- archgraph mcp
Cursor Add to ~/.cursor/mcp.json
Windsurf Add to MCP config
OpenCode Add to ~/.config/opencode/config.json

What Your Agent Gets

Tools: query, impact, context, detect_changes, find_vulnerabilities, cypher, stats

Resources: archgraph://schema, archgraph://security, archgraph://clusters, archgraph://processes

Example Conversation

You: "Are there any buffer overflow risks in the network code?"

Agent:
1. Queries input sources in network files
2. Traces taint paths to dangerous sinks
3. Reports: "Found 2 paths:
   - net_recv() → memcpy() in src/net/handler.c (depth: 3)
   - read_packet() → strcpy() in src/net/parser.c (depth: 4)
   Both reach dangerous sinks without validation."

🔒 Security Features

Automatic labeling — Every function gets security labels:

  • is_input_source — reads external data (recv, read, fetch, ...)
  • is_dangerous_sink — dangerous operations (memcpy, exec, eval, ...)
  • is_allocator, is_crypto, is_parser — additional categories
  • risk_score — 0-100 risk score based on labels

Taint path detection:

MATCH path = (src:Function {is_input_source: true})-[:CALLS*1..8]->(sink:Function {is_dangerous_sink: true})
RETURN src.name, sink.name, length(path) AS depth

CVE enrichment:

archgraph extract . --include-cve    # Queries OSV API automatically

All Commands

Command Description
extract Extract code graph from repository
query Run Cypher queries against the graph
stats Show node/edge statistics
schema Show graph schema
diff Compare repo state vs stored graph
impact Blast radius analysis for a function
export Export to JSON, GraphML, or CSV
report Generate HTML security report
serve Start web dashboard
mcp Start MCP server for AI agents
skills Generate AI agent skill files
repos List indexed repositories

Use Cases

Security Audit

archgraph extract /target -l c,cpp --include-cve --include-clang
archgraph query "MATCH path = (src:Function {is_input_source: true})-[:CALLS*1..5]->(sink:Function {is_dangerous_sink: true}) RETURN src.name, sink.name"

Code Review

archgraph diff /path/to/repo
archgraph impact "func:src/api.c:handle:42" --direction both

Reverse Engineering

archgraph extract /binary/project -l c,cpp,rust --include-clang --include-deep
archgraph query "MATCH (f:Function) WHERE f.is_exported = true RETURN f.name, f.file"

Architecture

                  ┌──────────────────────────────────────────────────┐
                  │         GraphBuilder Pipeline (11 steps)         │
                  │                                                  │
  Local Path ─────┤  1. Tree-sitter structural extraction            │
     or           │  2. Git history                                  │
  GitHub URL ─────┤  3. Dependency extraction                        │──── Neo4j
  (auto clone)    │  4. Annotation scanning                          │     Store
                  │  5. Security labeling                            │       │
                  │  6. Clang deep analysis (C/C++)                  │       ├── MCP Server
                  │  7. Tree-sitter deep analysis (Rust/Java/Go/…)   │       ├── Web Dashboard
                  │  8. Churn enrichment                             │       └── Export/Report
                  │  9. CVE enrichment (OSV API)                     │
                  │ 10. Clustering (community detection)             │
                  │ 11. Process tracing (execution flows)            │
                  └──────────────────────────────────────────────────┘

Benchmarks

Project Language Files Nodes Edges Time
zlib (~50K LOC) C 79 2,389 3,968 6.6s
fastify (~30K LOC) JavaScript 487 2,810 18,472 10.5s
Linux drivers/usb (~500K LOC) C 892 62,812 122,746 12.7s

Benchmarks: Windows 11, Python 3.13, single-threaded. Parallel mode (-w 4) is 2-3x faster.


Documentation

Document Description
Architecture & Schema Graph schema, node/edge types, pipeline
CLI Reference All commands and options
AI Agent Integration MCP setup, tools, examples
Security Analysis Security labeling, Cypher queries
Deep Analysis CFG, data flow, taint tracking
Roadmap Development phases

Testing

pytest tests/ -v  # 137 passed, 22 skipped

No external services required. Tests use temporary directories with real tree-sitter parsing and git operations.


License

MIT

Metadata

Release files for archgraph 0.2.0

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

Source distribution (sdist)

Source distribution for archgraph 0.2.0
File Size Uploaded Provenance
archgraph-0.2.0.tar.gz 119.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for archgraph 0.2.0
File Interpreter ABI Platform
archgraph-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 222.5 kB

Release files / archgraph-0.2.0.tar.gz

Download URL archgraph-0.2.0.tar.gz
Size 119.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3cd96796fecd037e0077841ba04b09817c3550827eb9b249fae16fb2f3ca04dd
BLAKE2b-256 checksum
How to use checksums
fb07c4117d459c781196025db733f2a6e3bcac2615c640372dea78a325cb3e34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / archgraph-0.2.0-py3-none-any.whl

Download URL archgraph-0.2.0-py3-none-any.whl
Size 103.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
003f47afa80f82c0624fa82cfea6831c93ad2d08a6ccced6cf8f643cf47446d5
BLAKE2b-256 checksum
How to use checksums
847ec3e66f6b25c13fa0311b6738e164592a60a150897be6f9685a837aa9da31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Security for archgraph 0.2.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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files 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