Skip to main content
Glama
README.md
# OpenKrak

**Dorchester Engine MCP Server** — static analysis intelligence for AI coding assistants.

OpenKrak runs the Dorchester engine on your repository before the model reads a single file. The result is a structured brief — hotspot rankings, dependency graph, blast radius, security findings — delivered directly to the model's context. No hallucinated file structure. No wasted tokens on the wrong files.

**Supported:** Claude Code · Claude Desktop · Cursor · Windsurf

---

## How It Works

```
Repository
    │
    ▼
DeepStrike          — File discovery, AST parse, symbol extraction, dependency resolution
    │
    ▼
Hotspot Registry    — Coupling scores, complexity, git change frequency, god_object detection
    │
    ▼
Correlation Engine  — Finding classification, noise reduction (Rule 1–4), impact chains
    │
    ▼
Blast Radius        — Cascade mapping, affected files and modules, risk scoring
    │
    ▼
Execution Gate      — Safety checks, circular dependency detection, blocker identification
    │
    ▼
Mahadata            — Structured brief with source snippets delivered to the model
```

All analysis runs locally. No source code leaves your machine.

---

## Quickstart — Claude Code

```bash
cd /your/repo
npx openkrak-init
```

That's it. `openkrak-init` drops two files into your repo root:

- **`.mcp.json`** — registers OpenKrak as a Claude Code MCP server
- **`CLAUDE.md`** — injects mandatory instructions into Claude's system prompt every session

Claude Code reads `CLAUDE.md` as user-level instructions. It cannot ignore them. OpenKrak is invoked automatically before any file is accessed.

---

## Manual Setup (Claude Desktop / Cursor / Windsurf)

Add to your MCP config:

```json
{
  "mcpServers": {
    "openkrak": {
      "command": "npx",
      "args": ["openkrak-mcp@1.3.0"]
    }
  }
}
```

| Platform | Config location |
|----------|-----------------|
| Claude Desktop (Windows) | `%APPDATA%\Claude\claude_desktop_config.json` |
| Claude Desktop (macOS) | `~/Library/Application Support/Claude/claude_desktop_config.json` |
| Cursor | `.cursor/mcp.json` in project root, or global settings |
| Windsurf | MCP settings panel |

Requires Node.js ≥ 18.

---

## Tools

10 tools available as of v1.3.0.

| Tool | Description |
|------|-------------|
| `analyze_repo` | Full 6-step pipeline. Returns complete Dorchester brief with source snippets of top 3 critical files. Call before any coding task on a new repo. |
| `get_mahadata` | Compact repo brief mid-session. Structure, entry points, hotspot summary, top 3 critical file previews. |
| `get_hotspots` | Ranked list of high-risk files by coupling, complexity, and git change frequency. |
| `blast_radius` | Impact map for a specific file — cascade, affected modules, risk score. |
| `get_topology` | Project type, framework, language breakdown, entry points, module layers. |
| `get_findings` | Filtered findings by severity (CRITICAL / HIGH / MEDIUM / LOW) or type. |
| `get_file_dependencies` | All imports made by a file + all files that import it. |
| `get_dead_code` | Genuine unused exports vs noise-suppressed false positives. |
| `get_cycles` | All circular dependency cycles with full path sequences. |
| `get_security` | Hardcoded secrets, dangerous shell patterns, critical security findings. |

---

## Output Format

```
╔══ DORCHESTER ENGINE — SCAN ══════════════════════════════════════╗
║ Repo      your-project  |  42f  5840loc  TypeScript  fw:next@15.0
╠══ HOTSPOT REGISTRY (42 files ranked) ════════════════════════════╣
║  1. [CRITICAL ] auth-context.tsx  score:0.812  god_object,high_coupling
║  2. [HIGH     ] api-router.ts     score:0.641  high_coupling
╠══ SOURCE PREVIEW — top 3 critical files (first 60–80 lines each) ╣
║  ── auth-context.tsx  [score:0.812]
...
```

The model receives source snippets of the top 3 critical files inline. It does not need to open those files separately.

---

## Benchmark

Tested on a 26-file TypeScript / Next.js repo (ChesterMath):

| Metric | Value |
|--------|-------|
| Files analyzed | 26 |
| Lines of code | 3,370 |
| Analysis time | 1,043 ms |
| Output tokens | ~13,000 |
| Findings | 18 |
| Hotspots identified | 26 ranked |

**Without OpenKrak:** a model analyzing the same repo by reading files sequentially consumes 60,000+ tokens before forming a structural understanding. OpenKrak delivers equivalent context in ~13,000 tokens — approximately 4–5× reduction.

Token budget is proportional to repo size. Larger repos produce proportionally larger briefs, not arbitrarily capped output.

---

## Language Support

| Language | Analysis method |
|----------|----------------|
| TypeScript / JavaScript | AST-based (ts-estree) — highest accuracy |
| Python | Regex-based symbol + import extraction |
| Go | Struct, interface, func extraction |
| Rust | pub/fn/struct/trait/enum extraction |
| Java | Class, interface, method extraction |
| C# | Class, interface, enum, method extraction |

---

## License

Free tier is active by default — no account required.

| Plan | Price | Queries |
|------|-------|---------|
| Free | $0 | 15 per 24-hour rolling window |
| Pro Monthly | $8 / month | Unlimited |
| Pro Annual | $67.20 / year | Unlimited |

To activate Pro, set `OPENKRAK_KEY` in your environment or MCP config:

```json
{
  "mcpServers": {
    "openkrak": {
      "command": "npx",
      "args": ["openkrak-mcp@1.3.0"],
      "env": {
        "OPENKRAK_KEY": "your-license-key"
      }
    }
  }
}
```

License keys: [openkrak-web.vercel.app](https://openkrak-web.vercel.app)

---

## Notes

- Static analysis only. No AI inference in the pipeline.
- Anonymous telemetry: query count, tool name, error events. No source code or file contents transmitted.
- License validation requires a network call on each invocation.

---

MIT License — © 2026 Faiz Hamizan / Challanger Absolute Advance  
[github.com/FrnzJulianBergmann/openkrak](https://github.com/FrnzJulianBergmann/openkrak)