MCP Server

IWE provides an MCP (Model Context Protocol) server that gives AI agents direct access to your knowledge graph. The MCP server exposes the same operations as the CLI — search, retrieve, create, refactor — through a standardized protocol that AI tools can use natively.

Setup

The MCP server runs as a stdio process. You configure it by pointing your AI tool to the iwec binary and setting the working directory to your knowledge graph.

Tools

The MCP server exposes 13 tools for reading, writing, and refactoring documents.

Reading

ToolDescription
iwe_findSearch documents with fuzzy matching and relationship filters
iwe_retrieveFetch documents with depth expansion, parent context, backlinks
iwe_treeView hierarchical document structure
iwe_statsGet knowledge graph statistics and broken link reports
iwe_squashExpand block references into a single flat document

Writing

ToolDescription
iwe_createCreate a new document from title and content
iwe_updateReplace the full content of an existing document
iwe_deleteDelete a document and clean up all references

Refactoring

ToolDescription
iwe_renameRename a document key with automatic link updates
iwe_extractExtract a section into a new document with block reference
iwe_inlineReplace a block reference with the referenced content
iwe_normalizeRe-format all documents for consistent formatting
iwe_attachAttach a document to a target using configured actions

All write and refactoring tools support a dry_run parameter to preview changes before applying them.

Prompts

The server provides three built-in prompts that guide AI agents through common workflows:

PromptDescription
exploreGet an overview of the knowledge graph with key statistics
reviewReview a specific document with full context
refactorAnalyze a document and suggest restructuring operations

Resources

The server exposes knowledge graph data as MCP resources:

URIDescription
iwe://documents/{key}Individual document content
iwe://treeFull hierarchical document tree
iwe://statsAggregate knowledge graph statistics
iwe://configConfiguration with templates and actions

File watching

The MCP server watches the knowledge graph directory for changes. When you edit markdown files in your editor, the server automatically updates its in-memory graph. There is no need to restart the server after making changes.