MCP-Logseq
Connects MCP-compatible AI assistants to Logseq graphs, enabling block-first operations, block references, and context graph building.
README
MCP-Logseq
An AI bridge for Logseq graphs using the Model Context Protocol (MCP). Connect any MCP-compatible AI assistant (Claude, Cursor, Windsurf, etc.) to your Logseq knowledge base with deep integration for blocks and block references.
Ported from mcp-obsidian with Logseq-specific features:
- Block-first operations — Read, append, and reference individual blocks
- Block references — Create
((block-uuid))links between blocks - Context graph — Resolve refs for AI context, get backlinks, build knowledge graphs over time
Quick Start
-
Install Node.js (v18+)
-
Configure your MCP client (e.g. Cursor):
Add to your MCP config (e.g.
~/.cursor/mcp.jsonor Cursor Settings → MCP):{ "mcpServers": { "logseq": { "command": "npx", "args": ["mcp-logseq", "/path/to/your/logseq/graph"] } } }Replace
/path/to/your/logseq/graphwith your actual Logseq graph directory (the folder containingjournals/,pages/,.logseq/). -
Test — Ask your AI:
- "List files in my Logseq graph"
- "Read the page journals/2024_01_15.md"
- "Search for blocks containing 'machine learning'"
- "Get block abc-123-def and show what references it"
Logseq Concepts
Blocks
Logseq content is organized in blocks — each bullet (-) is a block. Blocks have:
- UUID — stable ID (
id:: uuidin markdown) - Content — main text
- Properties —
key:: valuemetadata - Hierarchy — indentation = parent/child
Block References
- Reference:
((block-uuid))— links to a block - Embed:
{{embed ((block-uuid))}}— renders block content inline
Use create_block_ref to add refs and read_page with resolveBlockRefs: true to expand them for AI context.
MCP Tools
Page Operations
| Tool | Description |
|---|---|
read_page |
Read page with blocks; optional resolveBlockRefs for AI context |
write_page |
Write page (overwrite/append/prepend) |
list_directory |
List files and folders |
search_blocks |
Search block content and properties |
read_multiple_pages |
Batch read (max 10) |
get_frontmatter |
Get frontmatter only |
update_frontmatter |
Update frontmatter |
delete_note |
Delete page (requires confirmation) |
move_note |
Move/rename page |
patch_note |
Replace string in page |
manage_tags |
Add/remove/list tags |
get_notes_info |
Metadata without content |
get_graph_stats |
Notes, folders, size, recent files |
Block Operations (Logseq-specific)
| Tool | Description |
|---|---|
read_block |
Get block by UUID (searches entire graph) |
append_block |
Add block to page (optionally under parent) |
get_block_refs |
Get blocks that reference a given block (backlinks) |
create_block_ref |
Insert ((uuid)) into a block |
Example: Building a Context Graph
- Search for relevant blocks:
search_blockswith query "project ideas" - Read a block:
read_blockwith UUID from results - Get backlinks:
get_block_refsto see what links to it - Create links:
create_block_refto connect related blocks - Read with context:
read_pagewithresolveBlockRefs: trueto expand refs for AI
Over time, the AI can build a map of your knowledge graph by following block references.
Development
npm install
npm run build
npm start /path/to/graph # Run with tsx
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.