Home / MCP / Logseq MCP Server

Logseq MCP Server

Exposes MCP endpoints to interact with your local Logseq graph through a local stdio server.

python
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "logseq": {
            "command": "/opt/homebrew/bin/uvx",
            "args": [
                "logseq-mcp"
            ],
            "env": {
                "LOGSEQ_API_URL": "http://localhost:12315",
                "LOGSEQ_TOKEN": "your-token-here"
            }
        }
    }
}

This MCP server lets AI agents interact with your local Logseq instance by running a lightweight, local process that speaks a defined MCP interface. It enables you to issue commands to create, read, update, and organize pages and blocks within your Logseq graph from AI-powered tools or agents.

How to use

You will run a local MCP server that exposes Logseq operations under the logseq namespace. Connect your MCP client (for example, Cursor or Claude) to this server so the agent can perform tasks like listing pages, reading blocks, creating pages, and editing journal entries. Give the agent prompts that reference the available functions, such as logseq.get_all_pages(), logseq.get_page(name), logseq.create_page(name), logseq.delete_page, and similar block-oriented operations.

How to install

# Prerequisites
python3.11+

# Install the MCP server package in editable mode
pip install -e .
```

```bash
# Logseq setup steps you perform locally inside Logseq
# 1) Enable Developer mode
# 2) Turn on Logseq Developer Plugin
# 3) Set an API token in Advanced settings
# 4) Restart Logseq
{
  "mcpServers": {
    "logseq": {
      "command": "/opt/homebrew/bin/uvx",
      "args": ["logseq-mcp"],
      "env": {
        "LOGSEQ_API_URL": "http://localhost:12315",
        "LOGSEQ_TOKEN": "your-token-here"
      }
    }
  }
}

If you also want to connect Claude Code to the MCP server, run this command to add the MCP integration and configure the environment values shown above. Use the exact command and environment variables as shown below.

claude mcp add
```
- Select scope
- Select Stdio
- `LOGSEQ_API_URL=http://localhost:12315 LOGSEQ_TOKEN=your-token-here /opt/homebrew/bin/uvx logseq-mcp

Additional setup notes

The server is designed to run locally in stdio mode, invoking the uvx runtime with the logseq-mcp subcommand. It reads connection details from the provided environment variables so your client can authenticate and reach the local API at the specified URL.

Notes on working with Logseq

Journal pages and blocks follow Logseq conventions. You can create pages or blocks through the MCP tools and the agent will handle journal page formatting and special attributes automatically as you manipulate content.

Examples of common tasks

- Create a new page called Meeting Notes and add a bullet list for today’s agenda. - Retrieve all blocks from a page and then insert a new block under a specific parent. - Update a block’s content or move it to a different location within the page’s hierarchy.

Available tools

logseq.get_all_pages

Return a list of all pages in the Logseq graph.

logseq.get_page

Return the content and metadata of a specific page by name.

logseq.create_page

Create a new page with the given name.

logseq.delete_page

Delete a page and all its blocks.

logseq.get_page_blocks

Fetch all blocks from a specified page.

logseq.get_block

Retrieve a single block by its ID.

logseq.create_block

Create a new block on a given page.

logseq.insert_block

Insert a block as a child of another block.

logseq.update_block

Update the content of an existing block.

logseq.move_block

Move a block to a different location within the page.

logseq.remove_block

Remove a block and all of its children.

logseq.search_blocks

Search for blocks matching a query across the graph.