Logseq API MCP Server

A MCP server that uses Logseq API to extract and interact with Logseq notes.

Local serverstdioPython

What is the Logseq API MCP server?

Most developer tooling work still happens through a UI a human drives. Logseq API MCP server moves it into the conversation instead. A MCP server that uses Logseq API to extract and interact with Logseq notes.

The short version

The tools it exposes

The server publishes 14 tools. What each one is for:

  • get_all_pages — Every page with ID, UUID, journal flag, and namespace
  • get_page_blocks — Hierarchical block tree with IDs, UUIDs, and child counts
  • get_page_links — Pages linking to a target page
  • get_page_backlinks — Full backlink analysis including block-level references
  • get_block_content — Block detail with properties and immediate children
  • get_all_page_content — Complete page: properties, blocks, DB refs expanded
  • get_linked_flashcards — Q&A flashcard pairs from a page and all linked pages
  • search — Full-text search across blocks, pages, and file names
  • query — Raw Datalog / DSL queries against the graph
  • find_pages_by_property — Filter pages by property key and optional value
  • get_pages_from_namespace — All pages under a Logseq namespace
  • get_pages_tree_from_namespace — Nested tree of namespace pages

Getting it running

Setup follows the usual MCP pattern — install or clone the server, register it in your client's configuration file, restart the client. The configuration blocks on this page cover the common clients.

What it needs from you

Configuration is passed through the environment: LOGSEQ_API_ENDPOINT, LOGSEQ_API_TOKEN. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

How it compares

This sits in the developer tooling group, where several servers overlap in what they claim to do but differ sharply once you actually set them up. Logseq API's toolset — get_all_pages, get_page_blocks, get_page_links and 11 more — is a fair guide to whether it matches your workflow. It is maintained by gustavo-meilus; worth a glance at recent repository activity before you build anything load-bearing on it.

We check each listing at SyncDev against the project's documentation before it goes live — if something here drifts out of date, it is a bug worth reporting.

Things to watch

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 14 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch Logseq API.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

Available tools

ToolWhat it does
get_all_pagesEvery page with ID, UUID, journal flag, and namespace
get_page_blocksHierarchical block tree with IDs, UUIDs, and child counts
get_page_linksPages linking to a target page
get_page_backlinksFull backlink analysis including block-level references
get_block_contentBlock detail with properties and immediate children
get_all_page_contentComplete page: properties, blocks, DB refs expanded
get_linked_flashcardsQ&A flashcard pairs from a page and all linked pages
searchFull-text search across blocks, pages, and file names
queryRaw Datalog / DSL queries against the graph
find_pages_by_propertyFilter pages by property key and optional value
get_pages_from_namespaceAll pages under a Logseq namespace
get_pages_tree_from_namespaceNested tree of namespace pages
create_pageCreate a page with optional properties and format
delete_pageRemove a page permanently

How to install the Logseq API MCP server

// ~/.claude/claude_desktop_config.json
{
  "mcpServers": {
    "logseq-api": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/logseq-api-mcp", "python", "src/server.py"],
      "env": {
        "LOGSEQ_API_ENDPOINT": "http://127.0.0.1:12315/api",
        "LOGSEQ_API_TOKEN": "your_token_here"
      }
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

VariableDescriptionRequired
LOGSEQ_API_ENDPOINTConfiguration value read at startup.Optional
LOGSEQ_API_TOKENCredential the server authenticates with.Yes

Example prompts to try

  • Use Logseq API to get all pages.
  • Use Logseq API to get page blocks.
  • Use Logseq API to get page links.

Frequently asked questions

Python 3.11 or higher and the `uv` package installer. The Logseq desktop app must be running with its HTTP API server enabled.