Skip to content

Repository files navigation

Lito Graph

Compile Markdown docs into a knowledge & workflow graph for AI agents. Expose it via MCP so IDEs and assistants can reason, plan, and act over your documentation — not just search it.

Part of the Lito documentation ecosystem.

Why

Traditional docs are flat text optimized for human reading. AI agents need structured, traversable knowledge to:

  • Discover capabilities — "What APIs act on the Workspace entity?"
  • Plan multi-step tasks — "Walk me through the onboarding workflow, step by step"
  • Stay safe — "Does this workflow require human approval? What are the guardrails?"

Lito Graph compiles your Markdown into a typed knowledge graph with nodes (concepts, APIs, workflows, steps) and edges (ACTS_ON, USES_API, NEXT_STEP_OF, etc.), then serves it over MCP.

Quick Start

Use a hosted graph (zero-install)

If your docs site already serves graph.json, any MCP client can connect with one command:

npx -y @litodocs/graph https://docs.example.com/graph.json

Build locally

# Installcd lito-graph
bun install
# Build a graph from your docs
lito-graph build -i ./docs -o ./graph.json
# Inspect it
lito-graph inspect -g ./graph.json --stats
# Start MCP server
lito-graph serve -g ./graph.json

Document Types

Add type to your Markdown frontmatter to create rich graph nodes:

Concept Docs

---
type: conceptcanonical_name: "Workspace"entity_type: "resource"aliases: ["Org Workspace"]related_entities: ["User", "Project"]
---

API Docs

---
type: apioperation_id: "create_workspace"method: "POST"path: "/v1/workspaces"resource: "Workspace"capabilities: ["create"]preconditions: ["user_authenticated"]permissions: ["workspace:write"]
---

Workflow Docs

---
type: workflowworkflow_id: "onboard_new_workspace"goal: "Onboard a new customer workspace."risk_level: "medium"requires_human_approval: true
---

Existing Lito API docs (api: "GET /users") are auto-converted — no migration needed.

CLI Commands

CommandDescription
lito-graph build -i ./docs -o ./graph.jsonCompile docs into graph
lito-graph serve -g ./graph.jsonStart MCP server on stdio
lito-graph serve -i ./docsBuild + serve in one step
lito-graph inspect -g ./graph.json --statsGraph overview
lito-graph inspect -g ./graph.json --nodesList all nodes
lito-graph inspect -g ./graph.json --orphansFind disconnected nodes
lito-graph inspect -g ./graph.json --unresolvedShow broken references

MCP Tools

The server exposes 7 tools for agents:

ToolDescription
list_nodesFilter nodes by type or tag
get_nodeFull details by ID or slug
traverseWalk edges from a node
searchKeyword search across the graph
get_workflowComplete workflow with steps + linked APIs
find_apis_for_entityAll APIs acting on an entity
get_graph_statsOverview statistics

IDE Setup

Claude Code

Add to .mcp.json in your project root:

{
"mcpServers": {
"lito-graph": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@litodocs/graph", "https://docs.example.com/graph.json"]
}
}
}

Claude Desktop / Cursor

Add to your MCP settings:

{
"mcpServers": {
"lito-graph": {
"command": "npx",
"args": ["-y", "@litodocs/graph", "https://docs.example.com/graph.json"]
}
}
}

Public Graph Hosting

Build with --base-url so every node gets a full public URL:

lito-graph build -i ./docs -o ./graph.json --base-url https://docs.example.com

Each node gets a url field agents can navigate to:

{
"title": "Create Workspace",
"slug": "/api/create-workspace",
"url": "https://docs.example.com/api/create-workspace"
}

Host graph.json alongside your docs (e.g., in public/), then any agent can connect remotely:

lito-graph serve --url https://docs.example.com/graph.json

Works with any docs framework — Lito, Mintlify, Docusaurus, Fern, VitePress, GitBook. If it has Markdown files, Lito Graph can compile them.

Lito Graph vs Context7 MCP

Lito Graph and Context7 solve different problems. Use both.

Context7Lito Graph
PurposeLook up third-party library docsOperate on your own product/domain
DataFlat text chunks (RAG)Typed nodes + 14 edge types (graph)
RelationshipsNone — isolated textACTS_ON, USES_API, RELATED_TO, etc.
PlanningSingle page at a timeFull workflows with ordered steps + linked APIs
SafetyHope the agent reads the warningrequires_human_approval, risk_level, guardrails as machine-readable fields
CompletenessTop-k search (might miss things)Graph traversal (guaranteed exhaustive)
SetupZero — works instantlyOne npx command + optional frontmatter
PrivacyCloud serviceFully local, self-hosted

When to use what

ScenarioBest tool
"How do I use Express middleware?"Context7
"What's the full onboarding flow for our platform?"Lito Graph
"What's the React useState API?"Context7
"Which of our APIs require admin permissions?"Lito Graph
"How do I configure Tailwind?"Context7
"What happens if workspace creation fails?"Lito Graph

Context7 prevents hallucinating API signatures (external knowledge). Lito Graph prevents unsafe actions on your own systems (internal knowledge).

Graph Data Model

Node Types

  • DocNode — standard documentation pages
  • ConceptNode — domain entities (Workspace, User, Project)
  • ApiNode — callable capabilities (HTTP endpoints, functions)
  • WorkflowNode — multi-step procedures with guardrails
  • StepNode — individual actions within workflows

Edge Types

  • Structural: PARENT_OF, CHILD_OF, NEXT_SECTION
  • Semantic: RELATED_TO, DEPENDS_ON, CONTAINS, DEPRECATED_BY
  • Capability: ACTS_ON, REQUIRES, EMITS, USES_API
  • Procedural: NEXT_STEP_OF, ON_FAILURE_TRIGGER, ESCALATES_TO

License

MIT

About

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages