andrewtubman/logseq-mcp
If you are the rightful owner of logseq-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Logseq MCP Server is a Ruby-based Model Context Protocol server that allows AI assistants to interact with your Logseq graph by reading, searching, and modifying it.
Logseq MCP Server
A Ruby MCP (Model Context Protocol) server that enables AI assistants to read, search, and modify your Logseq graph.
Early Build Warning
This is an early-stage project. While it has been tested, bugs may exist. Please backup your Logseq graph regularly before using this tool.
Prerequisites
- Ruby 3.4+
- Logseq desktop app (with HTTP API enabled)
- Bundler
Enabling the Logseq API Server
- Open Logseq
- Go to Settings (gear icon)
- Navigate to Features
- Enable HTTP APIs server
- Set an Authorization token (save this for later)
- Restart Logseq
The API server runs on http://localhost:12315 by default.
Important: Logseq must be running for the MCP server to work.
Installation
git clone https://github.com/yourusername/logseq-mcp.git
cd logseq-mcp
bundle install
MCP Configuration
Add to your ~/.cursor/mcp.json, ~/.claude.json etc.
{
"mcpServers": {
"logseq": {
"command": "/path/to/logseq-mcp/bin/logseq-mcp",
"cwd": "/path/to/logseq-mcp",
"env": {
"LOGSEQ_API_TOKEN": "your-token-here"
}
}
}
}
Replace /path/to/logseq-mcp with the actual path where you cloned the repository.
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
LOGSEQ_API_TOKEN | Yes | - | Authorization token from Logseq settings |
LOGSEQ_API_URL | No | http://localhost:12315 | Logseq API server URL |
Available Tools
get_page
Get a Logseq page by name with its block tree.
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Page name |
include_children | boolean | No | Include nested blocks (default: true) |
get_block
Get a specific block by its UUID.
| Parameter | Type | Required | Description |
|---|---|---|---|
uuid | string | Yes | Block UUID |
include_children | boolean | No | Include nested child blocks (default: true) |
search
Search Logseq using DSL queries.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | DSL query string |
Example queries:
"search term"- Full-text search(page-property :type "book")- Find pages with property
update_block
Update the content of a block.
| Parameter | Type | Required | Description |
|---|---|---|---|
uuid | string | Yes | Block UUID |
content | string | Yes | New content for the block |
create_page
Create a new page.
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Page name |
properties | object | No | Page properties (key-value pairs) |
redirect | boolean | No | Redirect to page in Logseq UI (default: false) |
create_block
Create a new block in a page.
| Parameter | Type | Required | Description |
|---|---|---|---|
content | string | Yes | Block content |
position | string | Yes | append, prepend, or after |
page | string | No | Page name (required for append/prepend) |
sibling_uuid | string | No | Sibling block UUID (required for after) |
delete_block
Delete a block.
| Parameter | Type | Required | Description |
|---|---|---|---|
uuid | string | Yes | Block UUID to delete |
list_pages
List all pages in the graph.
| Parameter | Type | Required | Description |
|---|---|---|---|
namespace | string | No | Filter by namespace (e.g., "projects") |