Skip to main content
Glama
mcp-pkm-logseq

mcp-pkm-logseq

by ruliana

mcp-pkm-logseq MCP server

A MCP server for interacting with your Logseq Personal Knowledge Management system using custom instructions

Components

Resources

  • logseq://guide - Initial instructions on how to interact with this knowledge base

Tools

  • get_personal_notes_instructions() - Get instructions on how to use the personal notes tool

  • get_personal_notes(topics, from_date, to_date) - Retrieve personal notes from Logseq that are tagged with the specified topics

  • get_todo_list(done, from_date, to_date) - Retrieve the todo list from Logseq

Related MCP server: Logseq MCP Tools

Configuration

The following environment variables can be configured:

  • LOGSEQ_API_KEY: API key for authenticating with Logseq (default: "this-is-my-logseq-mcp-token")

  • LOGSEQ_URL: URL where the Logseq HTTP API is running (default: "http://localhost:12315")

Quickstart

Install

Claude Desktop and Cursor

On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json On Windows: %APPDATA%/Claude/claude_desktop_config.json

"mcpServers": {
  "mcp-pkm-logseq": {
    "command": "uvx",
    "args": [
      "mcp-pkm-logseq"
    ],
    "env": {
      "LOGSEQ_API_TOKEN": "your-logseq-api-token",
      "LOGSEQ_URL": "http://localhost:12315"
    }
  }
}

Claude Code

claude mcp add mcp-pkm-logseq uvx mcp-pkm-logseq

Start Logseq server

Logseq's HTTP API is an interface that runs within your desktop Logseq application. When enabled, it starts a local HTTP server (default port 12315) that allows programmatic access to your Logseq knowledge base. The API supports querying pages and blocks, searching content, and potentially modifying content through authenticated requests.

To enable the Logseq HTTP API server:

  1. Open Logseq and go to Settings (upper right corner)

  2. Navigate to Advanced

  3. Enable "Developer mode"

  4. Enable "HTTP API Server"

  5. Set your API token (this should match the LOGSEQ_API_KEY value in the MCP server configuration)

For more detailed instructions, see: https://logseq-copilot.eindex.me/doc/setup

Create MCP PKM Logseq Page

Create a page named "MCP PKM Logseq" in your Logseq graph to serve as the guide for AI assistants. Add the following content:

  • Description of your tagging system (e.g., which tags represent projects, areas, resources)

  • List of frequently used tags and what topics they cover

  • Common workflows you use to organize information

  • Naming conventions for pages and blocks

  • Instructions on how you prefer information to be retrieved

  • Examples of useful topic combinations for searching

  • Any context about your personal knowledge management approach

This page will be displayed whenever the AI thinks it needs to understand the user.

Development

Building and Publishing

To prepare the package for distribution:

  1. Sync dependencies and update lockfile:

uv sync
  1. Build package distributions:

uv build

This will create source and wheel distributions in the dist/ directory.

  1. Publish to PyPI:

uv publish

Note: You'll need to set PyPI credentials via environment variables or command flags:

  • Token: --token or UV_PUBLISH_TOKEN

  • Or username/password: --username/UV_PUBLISH_USERNAME and --password/UV_PUBLISH_PASSWORD

Debugging

Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.

You can launch the MCP Inspector via npm with this command:

npx @modelcontextprotocol/inspector uv --directory /Users/ronie/MCP/mcp-pkm-logseq run mcp-pkm-logseq

Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.

Add Development Servers Configuration to Claude Desktop

"mcpServers": {
  "mcp-pkm-logseq": {
    "command": "uv",
    "args": [
      "--directory",
      "/<parent-directories>/mcp-pkm-logseq",
      "run",
      "mcp-pkm-logseq"
    ],
    "env": {
      "LOGSEQ_API_TOKEN": "your-logseq-api-token",
      "LOGSEQ_URL": "http://localhost:12315"
    }
  }
}

Available Tools

3 tools
get_personal_notesA

Retrieve personal notes from Logseq.

Use this to find relavant information about a specific topic or about user preferences.
It will return all information that is tagged with the topics from the user's personal
knowledge base.

The information is returned in markdown format, each item in the list is a separate
unit of information. Hierachical information is returned as a nested list.

The returning markdown contains text in double square brackets, like this:
`[[topic]]`. These are links to other topics, you can follow them to get more
information. Try variations of the topic to find the most relevant information.

Dates are expressed as:
1. today|yesterday|tomorrow|now
2. <number><unit> like 1d, 2w, 3m, 4y, 2h, 30min

Args:
    topics: A list of topics to search for. Topics are case-insensitive. Topics
            are optional if there is a date range.
    from_date (optional): The start date to filter the notes.
    to_date (optional): The end date to filter the notes.

Returns:
    A markdown formatted string containing the information with the given topics.
    Empty if no information is found.

Inputs: topics (required), from_date, to_date.

get_personal_notes_instructionsA

Get instructions on how to use the get_personal_notes tool.

This will return instructions on how the user organizes their personal notes in Logseq.

It will contain common tags (topics), what they mean, and the workflows the user
uses to organize their notes.

Inputs: no named parameters.

get_todo_listA

Retrieve the todo list from Logseq.

Use this to get a list of all the todos in the user's personal knowledge base.

Dates are expressed as:
1. today|yesterday|tomorrow|now
2. <number><unit> like 1d, 2w, 3m, 4y, 2h, 30min

Args:
    done: Whether to get the done todos or the todo todos.
    from_date (optional): The start date to filter the todos.
    to_date (optional): The end date to filter the todos.

Returns:
    A markdown formatted string containing the todos.

Inputs: done, from_date, to_date.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a distinct purpose: retrieving notes, retrieving instructions for notes retrieval, and retrieving todos. No overlap or ambiguity between them.

    Naming Consistency5/5

    All tools follow the consistent 'get_' prefix and a descriptive noun pattern (get_personal_notes, get_personal_notes_instructions, get_todo_list). No naming style mixing.

    Tool Count4/5

    With only 3 tools, the server is minimal but appropriate for a read-only retrieval interface over a personal knowledge base. Slightly scoped down but not underdeveloped for its purpose.

    Completeness3/5

    Covers retrieval of notes and todos, but lacks any creation, update, or deletion capabilities. While the server may be intentionally read-only, obvious lifecycle operations are missing, limiting agent workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers