Skip to content

MCP Server

Lokus ships with a built-in Model Context Protocol (MCP) server that lets AI assistants read, write, search, and manage your entire knowledge base. The server auto-starts with Lokus and provides 68 tools across 12 categories — notes, workspace, databases, canvas, kanban, graph, templates, themes, daily notes, tasks, search, and workspace context.

MCP is an open standard that gives AI assistants structured access to external tools and data. Instead of copying and pasting content into your AI chat, MCP lets the assistant directly interact with your workspace.

Without MCP: You paste note content into the chat manually. The AI has no context about your workspace structure, links, or other files.

With MCP: The AI can search your entire knowledge base, create and edit notes, traverse your knowledge graph, manage kanban boards, and run workspace maintenance — all through natural language.

AI Assistant (Claude, etc.)
|
| MCP Protocol (JSON-RPC)
|
Lokus MCP Server
├── Stdio Transport (desktop clients)
└── HTTP Transport (CLI clients, port 3456)
|
| Tool Router (68 tools)
|
Your Workspace (local Markdown files)

The server supports two transports:

  • Stdio — for desktop AI clients like Claude Desktop. The AI spawns the server as a child process.
  • HTTP — for CLI-based AI clients. Lokus starts an HTTP server on localhost:3456 that accepts MCP requests at /mcp.

Both transports are local-only. No data leaves your machine.

On first launch, Lokus:

  1. Extracts the MCP server to ~/.lokus/mcp-server/.
  2. Creates a Claude Desktop config at ~/.lokus/mcp-server/claude_desktop_config.json.
  3. Creates a CLI config at ~/.lokus/mcp-server/cline_mcp_settings.json.
  4. Starts the HTTP server on port 3456.
  5. Registers all 68 tools.

No manual configuration required. Check the status bar at the bottom of Lokus — it shows “MCP: Running” with a green indicator when the server is active.

Terminal window
curl http://localhost:3456/health

Expected response:

{"status":"ok","server":"lokus-mcp","version":"1.0.1"}

Copy the generated config into Claude Desktop’s settings, or point it to the file directly:

{
"mcpServers": {
"lokus": {
"command": "node",
"args": [
"~/.lokus/mcp-server/index.js"
]
}
}
}

To specify a workspace path:

{
"mcpServers": {
"lokus": {
"command": "node",
"args": ["~/.lokus/mcp-server/index.js"],
"env": {
"LOKUS_WORKSPACE": "/path/to/your/workspace"
}
}
}
}

Add this to your .mcp.json file in your project root or home directory:

{
"mcpServers": {
"lokus": {
"url": "http://localhost:3456/mcp"
}
}
}

Any client that supports the MCP specification works. Use stdio transport for desktop apps and HTTP transport for CLI tools. The HTTP endpoint is http://localhost:3456/mcp and accepts standard JSON-RPC 2.0 requests.

Smart workspace detection and context switching. The server auto-detects your active workspace using this priority chain: current directory > LOKUS_WORKSPACE env var > Lokus app API > MCP context > last-used config > default location.

ToolDescription
list_all_workspacesList all available Lokus workspaces
set_workspace_contextSet the active workspace for all subsequent operations
get_current_contextCheck which workspace is currently active
match_workspace_by_nameFind a workspace from natural language (e.g., “my work notes”)
clear_workspace_contextReset the active workspace context
detect_workspace_from_textAnalyze text for workspace references

Create, read, update, delete, and analyze notes.

ToolDescription
list_notesList notes with metadata, sorted by name/modified/size
read_noteRead full content of a note
create_noteCreate a note with optional frontmatter
update_noteUpdate existing note content
delete_noteDelete a note
search_notesSearch notes by content or title
get_note_linksGet all outgoing wiki links from a note
get_note_backlinksGet all notes that link to a specific note
extract_note_metadataExtract frontmatter and metadata
rename_noteRename a note and update references

Workspace-level operations and statistics.

ToolDescription
get_workspace_infoComprehensive workspace information
get_workspace_statsStatistics: note count, total size, etc.
list_foldersList all folders up to a specified depth
get_workspace_settingsRead workspace-specific settings
search_workspaceGlobal full-text search across all file types
get_recent_filesRecently modified files

Manage structured data in Lokus Bases.

ToolDescription
list_basesList all databases in the workspace
get_baseGet schema and records for a specific base
create_baseCreate a new base with a schema definition
add_base_recordAdd a record to a base
query_baseQuery records with filters
update_base_recordUpdate an existing record
delete_base_recordDelete a record
get_base_statsStatistics for a base

Work with Lokus Canvas (visual whiteboard).

ToolDescription
list_canvasesList all canvases
get_canvasGet canvas data including shapes and connections
create_canvasCreate a new canvas
add_canvas_shapeAdd a shape (text, rectangle, arrow, etc.)
get_canvas_connectionsGet all arrows/connections between shapes
export_canvasExport canvas data

Manage kanban boards and cards.

ToolDescription
list_boardsList all kanban boards
get_boardGet board with columns and cards
create_boardCreate a board with columns (supports date-based columns)
add_cardAdd a card to a column
move_cardMove a card between columns
update_cardUpdate card content or properties
get_board_statsBoard statistics

Navigate and analyze the knowledge graph built from wiki links.

ToolDescription
get_graph_overviewOverview of the entire knowledge graph
get_node_connectionsAll connections for a specific note
find_pathFind the shortest path between two notes
get_orphan_notesFind notes with no connections
get_hub_notesFind the most-connected notes
get_clustersIdentify clusters of related notes

Create and manage reusable note templates. Templates support variables: {{date}}, {{time}}, {{cursor}}, {{title}}, and custom variables.

ToolDescription
list_templatesList templates, optionally filtered by category
create_templateCreate a template with variables and metadata
read_templateRead a template’s content and metadata
update_templateUpdate an existing template
delete_templateDelete a template

Create, manage, and apply editor themes. Themes use 20+ CSS custom property tokens.

ToolDescription
list_themesList built-in and custom themes
get_themeGet theme details including all tokens
create_themeCreate a custom theme
update_themeModify a theme’s tokens
delete_themeDelete a custom theme
apply_themeApply a theme to the editor
get_current_themeGet the currently active theme
export_themeExport a theme to JSON
import_themeImport a theme from JSON
ToolDescription
daily_noteOpen or create a daily note. Actions: today, yesterday, tomorrow, date, list. Notes are stored in the Daily Notes/ folder with yyyy-MM-dd.md filenames.
ToolDescription
manage_tasksList, search, update, and get stats for tasks across all notes. Parses checkbox syntax: - [ ] todo, - [x] done, - [/] in progress, - [!] urgent, - [?] question, - [-] cancelled, - [>] delegated.

Graph-enhanced search that combines full-text matching with knowledge graph traversal.

ToolDescription
smart_searchFull-text search enhanced with wiki link graph traversal. Returns matching notes plus their connected notes.
explore_topicNavigate the knowledge graph from a starting point to discover related content.
VariableDescriptionDefault
LOKUS_WORKSPACEWorkspace pathAuto-detected
LOKUS_MCP_PORTHTTP server port3456
LOKUS_LOG_LEVELLogging verbosity (debug, info, error)info
LOKUS_CACHE_SIZECache size in MB500
LOKUS_AUTO_STARTAuto-start the MCP servertrue
"List all notes in my workspace, sorted by last modified."

The AI calls list_notes with sortBy: "modified" and returns the results.

"Create a note called 'Meeting Notes - Feb 22' with the summary we just discussed."

The AI calls create_note with the path and content.

"Find all notes mentioning 'machine learning' and show me how they're connected."

The AI calls smart_search to find matching notes, then get_node_connections to map relationships.

"Show me all urgent tasks across my workspace."

The AI calls manage_tasks with action search and status filter urgent.

"What are the most connected notes in my workspace? Are there any orphan notes?"

The AI calls get_hub_notes and get_orphan_notes to analyze graph structure.

Send MCP requests to the HTTP endpoint using JSON-RPC 2.0:

Terminal window
# List all tools
curl -X POST http://localhost:3456/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
# Call a tool
curl -X POST http://localhost:3456/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"method":"tools/call",
"params":{
"name":"list_notes",
"arguments":{"sortBy":"modified"}
},
"id":2
}'
  • Local-only connections. The HTTP server binds to localhost. No remote access by default.
  • No authentication required. The server trusts local processes. If you expose the port externally (not recommended), add authentication middleware.
  • File system permissions. The server respects OS-level read/write permissions.
  • No external network calls. The MCP server never phones home or calls external APIs.
  • Audit logging. All tool calls are logged to ~/.lokus/mcp-server/logs/server.log.
  1. Check if port 3456 is already in use:
    Terminal window
    lsof -i :3456
  2. Verify Node.js 18+ is installed:
    Terminal window
    node --version
  3. Check server logs:
    Terminal window
    tail -f ~/.lokus/mcp-server/logs/server.log
  4. Delete ~/.lokus/mcp-server/ and restart Lokus to rebuild.
  1. Confirm the config file exists and points to the correct path:
    Terminal window
    cat ~/.lokus/mcp-server/claude_desktop_config.json
  2. Restart your AI client after adding the configuration.
  3. Test the HTTP endpoint directly:
    Terminal window
    curl http://localhost:3456/health

Set the workspace explicitly:

Terminal window
export LOKUS_WORKSPACE="/path/to/your/workspace"

Or use the set_workspace_context tool to switch workspaces within a conversation.

  • Reduce cache size: export LOKUS_CACHE_SIZE=250
  • Lower log level: export LOKUS_LOG_LEVEL=error
  • Archive old content into a separate workspace.

The MCP server also exposes documentation resources that AI assistants can read, including a Markdown syntax reference covering wiki links, math equations, task checkboxes, and highlights. Access resources via the resources/list and resources/read MCP methods.