Logseq MCP Server
Connects AI assistants to Logseq knowledge graphs to read, write, and search pages, blocks, and journals via the Model Context Protocol. It features 17 tools for full graph management, including CRUD operations, batch block insertion, and full-text search.
README
logseq-mcp-server
A TypeScript Model Context Protocol (MCP) server that connects AI assistants to your Logseq knowledge graph. Read, write, search, and manage pages, blocks, journals, and tags through the MCP protocol.
Features
- 17 tools covering Pages, Blocks, Search, Journals, and Graph operations
- Full CRUD for pages and blocks
- Full-text search across the graph
- Batch block insertion with nested children
- Block property management
- Backlink (linked references) retrieval
- Journal page creation and tag listing
- Dual transport: stdio (local) and HTTP (Hono-based, portable across runtimes)
Prerequisites
- Logseq installed and running
- HTTP APIs server enabled in Logseq:
- Settings > Features > Enable "HTTP APIs server"
- Click the API button > "Start server"
- Generate a token: API panel > Authorization tokens
- Node.js >= 18
Quick Start
Claude Desktop
Add to Settings > Developer > Edit Config:
{
"mcpServers": {
"logseq": {
"command": "npx",
"args": ["logseq-mcp-server"],
"env": {
"LOGSEQ_API_TOKEN": "your_token_here"
}
}
}
}
Claude Code
claude mcp add logseq-mcp-server \
--env LOGSEQ_API_TOKEN=your_token_here \
-- npx logseq-mcp-server
From Source
git clone https://github.com/user/logseq-mcp-server.git
cd logseq-mcp-server
npm install
npm run build
LOGSEQ_API_TOKEN=your_token npm start
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
LOGSEQ_API_TOKEN |
Yes | - | Bearer token from Logseq HTTP API |
LOGSEQ_API_URL |
No | http://127.0.0.1:12315 |
Logseq HTTP API URL |
TRANSPORT |
No | stdio |
Transport mode: stdio or http |
PORT |
No | 3000 |
HTTP port (when TRANSPORT=http) |
HTTP Transport
When running with TRANSPORT=http, the server uses Hono with WebStandardStreamableHTTPServerTransport from the MCP SDK.
LOGSEQ_API_TOKEN=your_token TRANSPORT=http PORT=3000 npm start
Endpoints:
POST|GET|DELETE /mcp- MCP Streamable HTTP protocolGET /health- Health check
curl http://localhost:3000/health
# {"status":"ok","server":"logseq-mcp-server"}
Available Tools
Pages
| Tool | Description |
|---|---|
logseq_list_pages |
List pages with filtering (journal, namespace) and pagination |
logseq_get_page |
Get page metadata by name or UUID |
logseq_get_page_content |
Get full block tree rendered as indented Markdown |
logseq_create_page |
Create a new page with optional initial content and properties |
logseq_delete_page |
Permanently delete a page |
logseq_rename_page |
Rename a page (updates all references) |
logseq_get_page_linked_references |
Get backlinks - pages and blocks that reference a page |
Blocks
| Tool | Description |
|---|---|
logseq_get_block |
Get a block by UUID with optional children |
logseq_insert_block |
Insert a block relative to a page or block |
logseq_append_block |
Append a block at the end of a page |
logseq_update_block |
Update block content and properties |
logseq_remove_block |
Permanently remove a block |
logseq_move_block |
Move a block to a new position |
logseq_insert_batch_blocks |
Insert multiple blocks at once (supports nesting) |
logseq_block_property |
Read or write a single block property |
Search & Graph
| Tool | Description |
|---|---|
logseq_search |
Full-text search across pages and blocks |
logseq_create_journal |
Create a journal page for a specific date |
logseq_get_graph_info |
Get current graph name and path |
logseq_get_all_tags |
List all tags in the graph |
Architecture
src/
├── index.ts # Entry point, server init, transport selection
├── constants.ts # Shared constants
├── types.ts # TypeScript type definitions
├── schemas/
│ └── index.ts # Zod input validation schemas
├── services/
│ ├── logseq-client.ts # Logseq HTTP API client
│ └── formatters.ts # Response formatting helpers
└── tools/
├── page-tools.ts # Page CRUD tools
├── block-tools.ts # Block CRUD tools
└── search-graph-tools.ts # Search, journal, graph tools
MCP Client (Claude, etc.)
↓ stdio or HTTP
MCP Server (index.ts, Hono)
↓ registers tool groups
Tools (page-tools, block-tools, search-graph-tools)
↓ calls service methods
LogseqClient (logseq-client.ts)
↓ POST /api { method, args }
Logseq HTTP API (local instance)
Development
npm install # Install dependencies
npm run build # Compile TypeScript
npm run dev # Watch mode (tsc --watch)
npm run inspect # Test with MCP Inspector
License
Apache-2.0
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.