logseq-mcp

andrewtubman/logseq-mcp

3.2

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.

Tools
8
Resources
0
Prompts
0

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

  1. Open Logseq
  2. Go to Settings (gear icon)
  3. Navigate to Features
  4. Enable HTTP APIs server
  5. Set an Authorization token (save this for later)
  6. 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

VariableRequiredDefaultDescription
LOGSEQ_API_TOKENYes-Authorization token from Logseq settings
LOGSEQ_API_URLNohttp://localhost:12315Logseq API server URL

Available Tools

get_page

Get a Logseq page by name with its block tree.

ParameterTypeRequiredDescription
namestringYesPage name
include_childrenbooleanNoInclude nested blocks (default: true)

get_block

Get a specific block by its UUID.

ParameterTypeRequiredDescription
uuidstringYesBlock UUID
include_childrenbooleanNoInclude nested child blocks (default: true)

search

Search Logseq using DSL queries.

ParameterTypeRequiredDescription
querystringYesDSL 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.

ParameterTypeRequiredDescription
uuidstringYesBlock UUID
contentstringYesNew content for the block

create_page

Create a new page.

ParameterTypeRequiredDescription
namestringYesPage name
propertiesobjectNoPage properties (key-value pairs)
redirectbooleanNoRedirect to page in Logseq UI (default: false)

create_block

Create a new block in a page.

ParameterTypeRequiredDescription
contentstringYesBlock content
positionstringYesappend, prepend, or after
pagestringNoPage name (required for append/prepend)
sibling_uuidstringNoSibling block UUID (required for after)

delete_block

Delete a block.

ParameterTypeRequiredDescription
uuidstringYesBlock UUID to delete

list_pages

List all pages in the graph.

ParameterTypeRequiredDescription
namespacestringNoFilter by namespace (e.g., "projects")