Skip to main content
Glama

ya-logseq-mcp

Python MCP server for Logseq.

What This Is

ya-logseq-mcp exposes Logseq read/write tools over MCP stdio so MCP clients can automate page and block workflows.

Related MCP server: MCP-Logseq

Why ya-logseq-mcp

ya-logseq-mcp is a Python MCP server that exposes Logseq read and write operations as MCP tools, targeting Claude Desktop and any compatible MCP stdio client. It deduplicates blocks by UUID at read time and returns lean responses by default.

Tools

Tool

Description

health

Ping Logseq and return graph name and page count

get_page

Return a page entity and deduplicated block tree by page name

get_block

Get a single block by UUID

list_pages

List pages with optional namespace filter

get_references

Get backlinks to a page (pages that reference this page)

page_create

Create a new page with optional properties and initial blocks

block_append

Append blocks to a page; accepts flat strings or nested objects with content, properties, and children

block_update

Update block content by UUID

block_delete

Delete a block by UUID

delete_page

Delete a page by name

rename_page

Rename a page from old_name to new_name

move_block

Move a block before, after, or as a child of a target block

journal_today

Get or create today's journal page and return its block tree

journal_append

Append blocks to a journal page for a given date

journal_range

Return journal entries for all existing pages between start_date and end_date

Requirements

Complete this checklist before install:

  • Python 3.12+ is installed: python3 --version

  • uv is installed: uv --version

  • Logseq Desktop is running with API enabled: Settings -> Features -> Enable developer mode -> Enable API server

  • LOGSEQ_API_TOKEN is available from Logseq: Settings -> Features -> API server -> API token

Install

Clone or copy the repo, then run from the repo root:

set -euo pipefail
cd /path/to/ya-logseq-mcp
python3 --version
uv --version
uv sync

Run Locally

Script-first launch:

LOGSEQ_API_TOKEN=<token> uv run ya-logseq-mcp

Module fallback for troubleshooting only:

LOGSEQ_API_TOKEN=<token> uv run python -m logseq_mcp

expected first-run result:

  • Process starts without Python traceback.

  • MCP server stays attached to stdio while the client is connected.

  • health requests return {"status":"ok",...} from your MCP client.

MCP Client Config

Primary example for Claude Desktop (copy/paste-ready):

{
  "mcpServers": {
    "ya-logseq-mcp": {
      "command": "uv",
      "args": [
        "run",
        "--project",
        "/path/to/ya-logseq-mcp",
        "ya-logseq-mcp"
      ],
      "cwd": "/path/to/ya-logseq-mcp",
      "env": {
        "LOGSEQ_API_URL": "http://127.0.0.1:12315",
        "LOGSEQ_API_TOKEN": "<token>"
      }
    }
  }
}

Replace /path/to/ya-logseq-mcp with the absolute path to your cloned repo.

equivalent MCP clients (Cursor, VS Code MCP, custom launchers) should use the same command, args, cwd, and env shape. startup semantics: command + args must launch the ya-logseq-mcp entrypoint. parse validation for this JSON block is included in the verification commands for this plan.

Smoke Check

Run checks in this order:

  1. Unit smoke:

uv run pytest tests/test_server.py -q
  1. MCP stdio integration smoke:

export LOGSEQ_API_TOKEN=<token>
uv run pytest tests/integration/test_mcp_stdio.py -x -q -m integration

Pass/fail interpretation:

  • PASS: pytest exits 0 and reports passing tests.

  • FAIL: pytest exits non-zero or reports failures/errors.

If smoke fails:

  1. Re-check token and API availability (LOGSEQ_API_TOKEN, Logseq API enabled).

  2. Re-run locally with uv run ya-logseq-mcp --help.

  3. Follow troubleshooting and maintainer checks in RUNBOOK.md.

Docs-Only Onboarding Verification (fresh shell)

Use this when validating docs from a clean environment:

env -i HOME="$HOME" PATH="$PATH" bash -lc '
  set -euo pipefail
  cd /path/to/ya-logseq-mcp
  python3 --version
  uv --version
  uv sync
  test -n "${LOGSEQ_API_TOKEN:-}" || echo "LOGSEQ_API_TOKEN not set in fresh shell"
  uv run ya-logseq-mcp --help >/tmp/ya-logseq-mcp-help.txt
'

DOCS-01 success markers:

  • prereqs visible in output (python --version, uv --version)

  • install command succeeds (uv sync)

  • startup command reaches ready/no-traceback state (ya-logseq-mcp --help exits cleanly)

For maintainers, onboarding accuracy checks live in RUNBOOK.md.

Available Tools

15 tools
block_appendD

Inputs: page (required), blocks (required). Returns: result

block_deleteD

Inputs: uuid (required). Returns: result

block_updateD

Inputs: uuid (required), content (required). Returns: result

delete_pageD

Inputs: name (required). Returns: result

get_blockC

Get a single block by UUID.

Inputs: uuid (required), include_children. Returns: result

get_pageB

Return a page entity and deduplicated block tree by page name.

Inputs: name (required). Returns: result

get_referencesB

Get backlinks to a page (pages that reference this page).

Inputs: name (required). Returns: result

healthA

Ping Logseq and return graph name and page count.

Inputs: no named parameters. Returns: result

journal_appendD

Inputs: date (required), blocks (required). Returns: result

journal_rangeD

Inputs: end_date (required), start_date (required). Returns: result

journal_todayD

Inputs: no named parameters. Returns: result

list_pagesC

List pages with optional namespace filter.

Inputs: limit, namespace, include_journals. Returns: result

move_blockD

Inputs: uuid (required), position (required), target_uuid (required). Returns: result

page_createD

Inputs: name (required), blocks, properties. Returns: result

rename_pageD

Inputs: new_name (required), old_name (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    C2/5.0

    Scored across 15 tools

    Disambiguation3/5

    Most tools target distinct resources/actions (page vs block vs journal vs references), but several write tools have empty descriptions, leaving ambiguity between block_append, journal_append, and page_create. The boundaries are inferable from names, but not as clear as they should be.

    Naming Consistency2/5

    The set mixes verb_noun patterns (get_page, list_pages, delete_page, rename_page, move_block) with noun_verb patterns (page_create, block_append, block_update, block_delete, journal_append) and bare noun patterns (health, journal_today, journal_range). This inconsistency makes the naming convention unpredictable.

    Tool Count5/5

    Fifteen tools is within a reasonable range for a Logseq integration, and each tool covers a distinct core operation across pages, blocks, journals, and references. The surface feels well-scoped rather than padded.

    Completeness4/5

    The server covers core page/block CRUD, moving blocks, references, and journal access, which is strong lifecycle coverage for a Logseq MCP. Minor gaps remain around search, page property updates, and fetching a specific journal date directly, but agents can work around most of these.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Exposes the mindgap knowledge graph as an MCP server over stdio, providing tools to add, link, query, and manage nodes and edges in a local org-roam-style graph.
      10
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Connects MCP-compatible AI assistants to Logseq graphs, enabling block-first operations, block references, and context graph building.
      MIT
    • A
      license
      C
      quality
      D
      maintenance
      Python stdio MCP server that interfaces with the Logseq local HTTP API, enabling tools to manage pages, blocks, queries, and graph configurations in Logseq.
      64
      2
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Local-first MCP server that binds to a project opened by the Seojeom desktop app and serves its local wiki and graph data over stdio, enabling project-aware reading, searching, and writing of wiki and graph content.
      6 npm
      MIT