LogSeq MCP server

Integrates with LogSeq API to enable automated note-taking, knowledge graph analysis, and workflow automation for developers and knowledge workers.
Back to servers
Setup instructions
Provider
Daniel Zholkovsky
Release date
Feb 04, 2025
Language
Python
Package
Stats
2.2K downloads
22 stars

The Logseq MCP Server provides direct integration with Logseq's knowledge base, enabling large language models to interact with Logseq graphs, create pages, manage blocks, and organize information programmatically through the Model Context Protocol.

Installation

Using pip

Install the server using pip:

pip install mcp-server-logseq

From source

Clone and set up the repository:

git clone https://github.com/dailydaniel/logseq-mcp.git
cd logseq-mcp
cp .env.example .env
uv sync

Run the server:

python -m mcp_server_logseq

Configuration

API Key Setup

  1. Generate an API token in Logseq by navigating to API → Authorization tokens
  2. Set the environment variable:
export LOGSEQ_API_TOKEN=your_token_here

Alternatively, pass the token via command line:

python -m mcp_server_logseq --api-key=your_token_here

Graph Configuration

The default URL is http://localhost:12315. To customize:

python -m mcp_server_logseq --url=http://your-logseq-instance:port

Usage with Claude Desktop

Add the following configuration to your Claude Desktop setup:

{
  "mcpServers": {
    "logseq": {
      "command": "uvx",
      "args": ["mcp-server-logseq"],
      "env": {
        "LOGSEQ_API_TOKEN": "<YOUR_KEY>",
        "LOGSEQ_API_URL": "http://127.0.0.1:12315"
      }
    }
  }
}

If you encounter errors, try using version 0.0.1:

{
  "mcpServers": {
    "logseq": {
      "command": "uvx",
      "args": ["mcp-server-logseq==0.0.1"],
      "env": {
        "LOGSEQ_API_TOKEN": "<YOUR_KEY>",
        "LOGSEQ_API_URL": "http://127.0.0.1:12315"
      }
    }
  }
}

Available Tools

Block Operations

  • logseq_insert_block - Create new blocks in Logseq

    • Parameters:
      • parent_block (string): Parent block UUID or page name
      • content (string, required): Block content
      • is_page_block (boolean): Create as page-level block
      • before (boolean): Insert before parent block
      • custom_uuid (string): Custom UUIDv4 for block
  • logseq_edit_block - Enter block editing mode

    • Parameters:
      • src_block (string, required): Block UUID
      • pos (number): Cursor position
  • logseq_exit_editing_mode - Exit editing mode

    • Parameters:
      • select_block (boolean): Keep block selected

Page Operations

  • logseq_create_page - Create new pages

    • Parameters:
      • page_name (string, required): Page name
      • properties (object): Page properties
      • journal (boolean): Create as journal page
      • format (string): Page format (markdown/org)
  • logseq_get_page - Get page details

    • Parameters:
      • src_page (string, required): Page identifier
      • include_children (boolean): Include child blocks
  • logseq_get_all_pages - List all pages

    • Parameters:
      • repo (string): Repository name

Content Retrieval

  • logseq_get_current_page - Get active page/block

    • Parameters: None
  • logseq_get_current_blocks_tree - Current page's block hierarchy

    • Parameters: None
  • logseq_get_editing_block_content - Get content of active block

    • Parameters: None
  • logseq_get_page_blocks_tree - Get page's block structure

    • Parameters:
      • src_page (string, required): Page identifier

Usage Examples

Create Meeting Notes Page

Create new page "Team Meeting 2024-03-15" with properties:
- Tags: #meeting #engineering
- Participants: Alice, Bob, Charlie
- Status: pending

Add Task Block to Existing Page

Add task to [[Project Roadmap]]:
- [ ] Finalize API documentation
- Due: 2024-03-20
- Priority: high

Create Journal Entry with First Block

Create journal entry for today with initial content:
- Morning standup completed
- Started work on new authentication system

Debugging

Use the MCP inspector for debugging:

npx @modelcontextprotocol/inspector uv --directory . run mcp-server-logseq

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "logseq" '{"command":"uvx","args":["mcp-server-logseq"],"env":{"LOGSEQ_API_TOKEN":"<YOUR_KEY>","LOGSEQ_API_URL":"http://127.0.0.1:12315"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "logseq": {
            "command": "uvx",
            "args": [
                "mcp-server-logseq"
            ],
            "env": {
                "LOGSEQ_API_TOKEN": "<YOUR_KEY>",
                "LOGSEQ_API_URL": "http://127.0.0.1:12315"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "logseq": {
            "command": "uvx",
            "args": [
                "mcp-server-logseq"
            ],
            "env": {
                "LOGSEQ_API_TOKEN": "<YOUR_KEY>",
                "LOGSEQ_API_URL": "http://127.0.0.1:12315"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later