API Reference

Base URL: https://dke-forge.com/v1

Authentication

All API requests (except registration) require a Bearer token:

Authorization: Bearer fga_your_api_key_here

Get your API key by registering for the beta.

Register

POST /v1/register

Create a new account. Returns an API key (shown once). No authentication required.

FieldTypeDescription
namestringYour name required
emailstringYour email (unique) required
curl -X POST https://dke-forge.com/v1/register \
  -H "Content-Type: application/json" \
  -d '{"name": "Jane Doe", "email": "jane@example.com"}'

Response (201):

{
  "id": "a1b2c3d4e5f6a7b8",
  "name": "Jane Doe",
  "email": "jane@example.com",
  "tier": "cycle",
  "api_key": "fga_0123456789abcdef...",
  "message": "Welcome to DKE-Forge beta! Save your API key..."
}

Verify Key

POST /v1/auth/verify

Check if your API key is valid and see your account details.

curl -X POST https://dke-forge.com/v1/auth/verify \
  -H "Authorization: Bearer fga_your_key"

Code Oracle (Graph Queries)

Structural queries against your code graph. Supports C++, Python, and TypeScript codebases. Available to all tiers.

Graph Stats

GET /v1/graph/stats

Node and edge counts, type breakdown, thermal zone distribution.

curl https://dke-forge.com/v1/graph/stats \
  -H "Authorization: Bearer fga_your_key"

Query Function

GET /v1/graph/function/:name

Look up a function by name. Returns node details including properties, temperature, and confidence.

curl https://dke-forge.com/v1/graph/function/handleRegister \
  -H "Authorization: Bearer fga_your_key"

Callers Of

GET /v1/graph/callers/:name

Functions that call the named function. Optional ?depth=N (default 2).

curl "https://dke-forge.com/v1/graph/callers/authenticate?depth=3" \
  -H "Authorization: Bearer fga_your_key"

Callees Of

GET /v1/graph/callees/:name

Functions called by the named function. Optional ?depth=N (default 2).

curl "https://dke-forge.com/v1/graph/callees/main?depth=2" \
  -H "Authorization: Bearer fga_your_key"

Dependencies

GET /v1/graph/depends/:name

Files and modules that the named entity depends on (DependsOn, Includes, UsesType edges).

curl https://dke-forge.com/v1/graph/depends/graph.cpp \
  -H "Authorization: Bearer fga_your_key"

Impact Analysis

GET /v1/graph/impact/:name

What breaks if you change this function? Returns directly affected, transitively affected, and test cases that need re-running. Optional ?change_type=modify|remove|rename.

curl "https://dke-forge.com/v1/graph/impact/ForgeGraph?change_type=modify" \
  -H "Authorization: Bearer fga_your_key"

Response includes:

{
  "changed": { ... },
  "change_type": "modify",
  "directly_affected": [ ... ],
  "transitively_affected": [ ... ],
  "test_cases_affected": [ ... ],
  "files_to_update": [ "graph.cpp", "store.cpp" ]
}

Rules

GET /v1/graph/rules

List all registered coding rules (naming conventions, complexity limits, etc.).

Check Rules

POST /v1/graph/check

Check a function against all rules. Returns violations.

FieldTypeDescription
namestringFunction name required

Patterns

GET /v1/graph/patterns

List learned structural patterns in your graph.

Pattern Detail

GET /v1/graph/pattern/:id

Pattern details including exemplar functions and edge-profile centroid.

Forge Envelopes

The Cartographer assembles a complete context envelope for a function.

POST /v1/envelope

Assemble a Cartographer envelope. Returns both structured JSON and serialized text ready for LLM consumption.

FieldTypeDescription
namestringTarget function name required
taskstringTask description required
max_contextintMax context nodes (optional, default 50)
curl -X POST https://dke-forge.com/v1/envelope \
  -H "Authorization: Bearer fga_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "authenticate",
    "task": "Add rate limiting by IP address"
  }'

Code Generation (Full Forge Cycle)

The complete pipeline: Cartographer → Scribe (your LLM) → Auditor. Requires your own LLM API key.

POST /v1/generate

Run the full Forge Cycle. Assembles context, calls your LLM, audits the result, retries on failure.

FieldTypeDescription
namestringTarget function name required
taskstringTask description required
llm_providerstring"anthropic" or "openai" required
llm_keystringYour LLM API key (optional if stored in dashboard)
modelstringModel override (default: claude-sonnet-4-20250514 / gpt-4o)
retriesintMax retry attempts (default 3)
build_commandstringCustom build command for compile check
curl -X POST https://dke-forge.com/v1/generate \
  -H "Authorization: Bearer fga_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "handleRegister",
    "task": "Add CAPTCHA verification before registration",
    "llm_provider": "anthropic",
    "llm_key": "sk-ant-api03-your-key-here"
  }'

Response:

{
  "accepted": true,
  "attempts": 1,
  "total_ms": 3200,
  "provider": "anthropic/claude-sonnet-4-20250514",
  "target": "handleRegister",
  "task": "Add CAPTCHA verification...",
  "code": "static void handleRegister(...) { ... }",
  "attempt_details": [ ... ]
}

Scan Repository

POST /v1/scan

Ingest a repository into your code graph. Supports C++, Python, and TypeScript.

FieldTypeDescription
pathstringPath to repository on server required
commitstringGit commit SHA (default: HEAD)

Bring Your Own Key

Forge is model-agnostic. The graph intelligence is deterministic — only the code generation step uses an LLM. You supply your own API key with each generate request.

Supported providers:

Providerllm_provider valueDefault model
Anthropic"anthropic"claude-sonnet-4-20250514
OpenAI"openai"gpt-4o

Per-request keys are sent over TLS and exist only in memory for the duration of the call. Alternatively, store your key in the dashboard — it's encrypted at rest with AES-256-GCM and used automatically when no per-request key is provided.

Error Format

All errors return JSON with an error field:

{
  "error": "Missing or invalid Authorization header"
}
StatusMeaning
400Bad request (missing/invalid parameters)
401Missing or invalid API key
403Insufficient tier or admin access required
404Resource not found (function, pattern, tenant)
409Conflict (duplicate email)
429Rate limit exceeded
500Internal server error

Health Check

GET /health

No authentication required. Returns server status and version.

curl https://dke-forge.com/health
{"status": "ok", "version": "0.2.0"}

Python CLI

The dke-forge package is a pip-installable CLI client that wraps the REST API. No graph engine code ships in the package — it's a pure HTTP client.

Install

pip install dke-forge

Configure

dke-forge config set api_key fga_your_key

Stores your API key in ~/.config/dke-forge/config.json (file permissions set to 600).

Usage

dke-forge health                      # Server status
dke-forge graph stats                  # Node and edge counts
dke-forge graph function main          # Look up a function
dke-forge graph callers authenticate   # Who calls this?
dke-forge graph callees main           # What does this call?

MCP Integration

DKE-Forge's MCP server lets your AI assistant query your code graph directly — asking “what calls this?” and getting the actual call chain instead of guessing from file contents. MCP (Model Context Protocol) is the open standard that makes this work.

DKE-Forge exposes 27 MCP tools across 10 categories — Foundation, Navigation, Architecture, Rules, Provenance, Patterns, Generation-prep, Ingestion, Generation, and Meta. Compatible with Claude Code, Cursor, VS Code, and any MCP client.

Install

The server ships as an optional extra on the dke-forge PyPI package:

pip install 'dke-forge[mcp]'

Pure-Python HTTP client — no local graph engine, no native dependencies. Source at github.com/OpenLangSyn/dke-forge (MIT).

Claude Code Setup

Add this to .mcp.json at your project root (or ~/.mcp.json for global):

{
  "mcpServers": {
    "forge": {
      "command": "dke-forge-mcp",
      "env": {
        "FORGE_URL": "https://dke-forge.com",
        "FORGE_API_KEY": "fga_your_key"
      }
    }
  }
}

On startup the server pings /health, then advertises 27 tools over stdio. Claude Code discovers them automatically.

Tools (27, by category)

ToolDescription
Foundation (1)
forge_graph_statsNode and edge counts, type breakdown
Navigation (7)
forge_query_functionLook up a function by name
forge_callers_ofFunctions that call the named function
forge_callees_ofFunctions called by the named function
forge_depends_onFile and module dependencies
forge_impact_analysisWhat breaks if you change this?
forge_callgraph_reachableTransitively reachable functions from an entry point
forge_find_implementersAll implementers of a type or interface
Architecture (2)
forge_dead_codeFunctions with no incoming calls (excludes tests)
forge_subgraphFocused subgraph by module, type, or function list
Rules (2)
forge_rulesList registered coding rules
forge_check_rulesCheck a function against all rules
Provenance (4)
forge_contradictionsGraph claims that disagree with themselves
forge_last_modifiedCommit tag for a node
forge_provenanceSources + confidence for an edge or property claim
forge_reasoning_traceInference path for a derived query
Patterns (4)
forge_patternsPatterns similar to a given function
forge_pattern_catalogFull pattern catalog with exemplars
forge_pattern_detailDetails of a specific pattern (by id or name)
forge_learn_patternsTrigger pattern discovery on the graph
Generation-prep (1)
forge_envelopeAssemble a Cartographer context envelope
Ingestion (3)
forge_scanIngest a repository into the code graph (async)
forge_scan_statusPoll progress of an async scan
forge_ingestFiles-in-body ingest for AI-coder flows
Generation (1)
forge_generateRun the full Forge Cycle (grounded code generation)
Meta (2)
forge_healthServer health check
forge_auth_verifyVerify API key