Documentation

Base URL: https://rj-knowledge-graph.pages.dev · Auth: x-api-key header (omit for demo tier) · OpenAPI spec · llms.txt

60-Second Quickstart

1 · MCP (Claude Desktop / Code, Cursor)

{
  "mcpServers": {
    "rj-knowledge-graph": {
      "command": "npx",
      "args": ["mcp-remote", "https://rj-knowledge-graph.pages.dev/mcp"]
    }
  }
}

Tools: remember, recall, ask_graph, search_graph, find_path, ingest_document, graph_overview

2 · REST — first memory in one call

curl -X POST https://rj-knowledge-graph.pages.dev/api/memory/remember \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_KEY" \
  -d '{"content": "My first agent memory",
       "agent_id": "my-bot",
       "tier": "episodic"}'

Memory is embedded with Cloudflare Workers AI + linked to graph entities automatically.

Memory

POST /api/memory/remember

Store a memory. Auto-linked to graph entities, embedded for vector recall. Use namespace for private agent lanes.

REQUEST

{"content": "Client prefers email follow-ups on Tuesdays",
 "context": "sales call 2026-07-24",
 "tier": "semantic",            // short_term|episodic|semantic|procedural
 "importance": 0.8,             // 0-1
 "agent_id": "sales-bot",
 "namespace": "agent:sales-bot" // or "shared" (default)
}

RESPONSE

{"ok": true, "memory_id": 42, "linked_entities": 2,
 "namespace": "agent:sales-bot", "embedding": "workers-ai/bge-base-en-v1.5"}
POST /api/memory/recall

Retrieve memories via hybrid scoring: vector similarity (70%) + lexical (30%), then ×0.6 + recency ×0.2 + importance ×0.2. Searches your namespace + shared lane.

REQUEST

{"query": "client communication preferences",
 "agent_id": "sales-bot", "namespace": "agent:sales-bot",
 "top_k": 10, "tier": "semantic"}

RESPONSE

{"mode": "vector-hybrid", "results": [{"id": 42, "score": 0.81, "content": "...", "namespace": "agent:sales-bot"}]}

Knowledge Graph

POST /api/ingest

Feed a document in. Entities + relationships extracted automatically (LLM if configured, heuristic otherwise), chunks embedded.

REQUEST

{"path": "notes/meeting.md", "content": "full document text..."}
POST /api/graph/recompute

Recompute PageRank + community detection after ingestion.

GET /api/graph?limit=100

Graph nodes + links (PageRank-ranked) for visualization or reasoning.

GET /api/graph/path?from=ID&to=ID

Shortest path between two entities — "how is X related to Y".

GET /api/search?q=...

Keyword search over entities + document chunks.

GET /api/search/semantic?q=...

Vector semantic search (Workers AI embeddings).

POST /api/ask

Graph-RAG Q&A: entities + relationships + chunks + memories assembled into an answer.

REQUEST

{"question": "What does RJ Business Solutions build?"}
GET /api/export/graph?format=json|graphml|csv

Export the full graph.

Agents & Account

GET /api/agents

Registry of all agents + namespace stats. Agents auto-register on first memory write/recall.

POST /api/billing/keys

Create an API key (self-serve signup uses this).

REQUEST

{"owner_name": "Jane", "owner_email": "jane@co.com", "tier": "free"}
GET /api/billing/tiers

Pricing tiers: free $0/1K · pro $49/50K · enterprise $499/1M calls per month.

GET /api/billing/usage

Your current-month usage, limit, and per-endpoint breakdown.

GET /api/system/status

Capabilities: embedding backend, LLM mode, MCP path, versions.

POST /api/embeddings/backfill?limit=100

Vectorize any chunks/memories missing embeddings (idempotent).

Rate limits & errors