Skip to main content
Glama
MCP server for LogSeq

MCP server for LogSeq

by ergut

LogSeq 的 MCP 服务器

MCP 服务器通过其 API 与 LogSeq 交互。

成分

工具

服务器实现了多个工具来与 LogSeq 交互:

  • list_graphs:列出所有可用的图表

  • list_pages:列出当前图表中的所有页面

  • get_page_content:返回单个页面的内容

  • 搜索:搜索所有页面的内容

  • create_page:创建新页面

  • update_page:更新现有页面的内容

  • delete_page:删除页面

示例提示

最好先指示 Claude 使用 LogSeq。这样它就会始终调用该工具。

提示示例:

  • 获取我最新会议记录的内容并进行总结

  • 搜索所有提及项目 X 的页面并解释上下文

  • 使用今天的会议记录创建新页面

  • 使用最新更新更新项目状态页面

Related MCP server: Logseq MCP Server

配置

LogSeq API 配置

您可以通过两种方式使用 LogSeq API 设置配置环境:

  1. 添加到服务器配置(首选)

{
  "mcp-logseq": {
    "command": "uvx",
    "args": [
      "mcp-logseq"
    ],
    "env": {
      "LOGSEQ_API_TOKEN": "<your_api_token_here>",
      "LOGSEQ_API_URL": "http://localhost:12315"
    }
  }
}
  1. 在工作目录中创建一个包含所需变量的.env文件:

LOGSEQ_API_TOKEN=your_token_here
LOGSEQ_API_URL=http://localhost:12315

发展

建筑

准备分发包:

  1. 同步依赖项并更新锁文件:

uv sync

调试

由于 MCP 服务器通过 stdio 运行,调试起来可能比较困难。为了获得最佳调试体验,我们建议使用MCP Inspector 。

您可以通过npm启动 MCP Inspector:

npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-logseq run mcp-logseq

Available Tools

17 tools
create_pageA

Create a new page in Logseq with properly structured blocks.

Fails if a page with the same title already exists (use update_page to modify existing pages). This makes retries safe: re-sending a create_page that timed out will not create numbered duplicates like "Page(1)".

Markdown content is automatically parsed into Logseq's block hierarchy:

  • Headings (# ## ###) create nested sections

  • Lists (- or 1.) become proper block trees

  • Code blocks are preserved as single blocks

  • YAML frontmatter (---) becomes page properties

Example content:

---
tags: [project, active]
priority: high
---

# Project Title
Introduction paragraph.

## Tasks
- Task 1
  - Subtask A
- Task 2

Inputs: title (required), content, properties.

delete_blockB

Delete a block from LogSeq by its UUID.

Inputs: block_uuid (required).

delete_pageB

Delete a page from LogSeq.

Inputs: page_name (required).

find_pages_by_propertyA

Find all pages that have a specific property, optionally filtered by value. Simpler alternative to the full query DSL.

Inputs: property_name (required), limit, property_value.

get_blockA

Get a single block by its UUID. Returns the block content, properties, and child blocks (recursively). Useful for inspecting a specific block after finding its UUID via search or query.

Inputs: block_uuid (required), format, include_children.

get_page_contentB

Get the content of a specific page from LogSeq.

Inputs: page_name (required), format, max_depth, resolve_refs.

get_pages_from_namespaceA

Get all pages within a namespace hierarchy (flat list). Use this to discover subpages of a parent page.

Inputs: namespace (required).

get_pages_tree_from_namespaceA

Get pages within a namespace as a hierarchical tree structure. Useful for understanding the full page hierarchy.

Inputs: namespace (required).

insert_nested_blockA

Insert a new block as a child or sibling of an existing block, enabling nested hierarchical structures

Inputs: content (required), parent_block_uuid (required), sibling, properties.

list_pagesA

Lists all pages in a LogSeq graph, each with its last-updated time (UTC). To find recently modified pages, use sort='updated' (most recent first) and/or updated_since.

Inputs: sort, limit, updated_since, include_journals.

queryB

Execute a Logseq DSL query to search pages and blocks. Supports property queries, tag queries, task queries, and logical combinations. Raw datalog ({:query ...} / [:find ...]) is not supported. See https://docs.logseq.com/#/page/queries for query syntax.

Inputs: query (required), limit, format, result_type.

rename_pageA

Rename an existing page. All references throughout the graph will be automatically updated.

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

set_block_propertiesA

Set properties on a block in Logseq DB-mode. Properties must be defined on the block's tag/class. Use property display names (e.g. 'Content status', not the internal ident).

Inputs: block_uuid (required), properties (required).

update_blockB

Update the content of an existing LogSeq block by UUID.

Inputs: content (required), block_uuid (required).

update_pageA

Update a page in Logseq with new content and/or properties.

Supports two modes:

  • append: Add new blocks after existing content (default)

  • replace: Clear all existing blocks and add new content

Markdown is parsed into proper block hierarchy just like create_page. YAML frontmatter in content will be merged with explicit properties.

Inputs: page_name (required), mode, content, properties.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 17 tools

    Disambiguation5/5

    Each tool targets a distinct resource and action: pages, blocks, search/query, namespaces, and properties. Overlaps like query vs find_pages_by_property are explicitly framed as simple alternatives, so an agent can choose correctly.

    Naming Consistency4/5

    Mostly consistent verb_noun snake_case (list_pages, get_block, create_page), but 'query' and 'search' are bare verbs, a minor deviation from the pattern.

    Tool Count4/5

    17 tools is slightly above the ideal 3-15 range for a cohesive set, though each covers a distinct operation. The count feels a bit heavy but not excessive for LogSeq's complexity.

    Completeness4/5

    Core CRUD for pages and blocks is covered, plus searching, querying, backlinks, and namespace navigation. Minor gaps remain (e.g., explicit block creation on a page, move/reorder operations), but agents can work around them.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with your local Logseq knowledge base through advanced search, content creation, template management, and knowledge organization with privacy-first, local-only operations.
      23 npm
      7
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables AI assistants like Claude to directly read, write, search, and navigate your local Logseq knowledge graph, including managing journals, pages, backlinks, and page relationships without manual copy-pasting.
      11
      10 npm
      6
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Connects AI assistants to Logseq knowledge graphs to read, write, and search pages, blocks, and journals via the Model Context Protocol. It features 17 tools for full graph management, including CRUD operations, batch block insertion, and full-text search.
      23 npm
      Apache 2.0