Skip to main content
Glama
Logseq MCP Server

Logseq MCP Server

by dailydaniel

Logseq MCP 服务器

模型上下文协议 (MLM) 服务器,可与 Logseq 知识库直接集成。该服务器支持 LLM 与 Logseq 图表交互、创建页面、管理区块,并以编程方式组织信息。

与 Claude Desktop 一起使用

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

如果出现错误,请使用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"
      }
    }
  }
}

Related MCP server: Logseq MCP Tools

可用工具

块操作

  • logseq_insert_block - 在 Logseq 中创建新块参数:

    • parent_block (字符串):父块 UUID 或页面名称

    • content (字符串,必需):阻止内容

    • is_page_block (布尔值):创建为页面级块

    • before (布尔值):在父块之前插入

    • custom_uuid (字符串):块的自定义 UUIDv4

  • logseq_edit_block - 进入块编辑模式参数:

    • src_block (字符串,必需):块 UUID

    • pos (数字):光标位置

  • logseq_exit_editing_mode - 退出编辑模式参数:

    • select_block (布尔值):保持块被选中

页面操作

  • logseq_create_page - 创建新页面参数:

    • page_name (字符串,必需):页面名称

    • properties (对象):页面属性

    • journal (布尔值):创建为日志页面

    • format (字符串):页面格式(markdown/org)

  • logseq_get_page - 获取页面详细信息参数:

    • src_page (字符串,必需):页面标识符

    • include_children (布尔值):包含子块

  • logseq_get_all_pages - 列出所有页面参数:

    • repo (字符串):存储库名称

内容检索

  • logseq_get_current_page - 获取活动页面/块参数:无

  • logseq_get_current_blocks_tree - 当前页面的块层次结构参数:无

  • logseq_get_editing_block_content - 获取活动块的内容参数:无

  • logseq_get_page_blocks_tree - 获取页面的块结构参数:

    • src_page (字符串,必需):页面标识符

提示

logseq_insert_block

在 Logseq参数中创建一个新块:

  • parent_block :父块引用(页面名称或 UUID)

  • content :块内容

  • is_page_block :对于页面级块设置为 true

logseq_create_page

创建一个新的 Logseq 页面参数:

  • page_name :页面名称

  • properties :页面属性为 JSON

  • journal :对于日记页面,设置为 true

安装

使用 pip

pip install mcp-server-logseq

从源头

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

运行服务器:

python -m mcp_server_logseq

配置

API 密钥

  1. 在 Logseq 中生成 API 令牌:API → 授权令牌

  2. 设置环境变量:

export LOGSEQ_API_TOKEN=your_token_here

或者通过命令行传递:

python -m mcp_server_logseq --api-key=your_token_here

图形配置

默认 URL: http://localhost:12315自定义:

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

示例

创建会议记录页面

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

将任务块添加到现有页面

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

使用第一个块创建日记帐分录

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

调试

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

贡献

我们欢迎为增强 Logseq 集成做出贡献:

  • 添加新的 API 端点(页面链接、查询支持)

  • 提高区块操作能力

  • 添加模板支持

  • 增强错误处理

Available Tools

10 tools
logseq_create_pageB

Create a new page in Logseq with optional properties. Features: - Journal page creation with date formatting - Custom page properties (tags, status, etc.) - Format selection (Markdown/Org-mode) - Automatic first block creation Perfect for template-based page creation and knowledge management.

Inputs: page_name (required), create_first_block, format, journal, +1 more.

logseq_edit_blockC

Enter editing mode for a specific block

Inputs: src_block (required), pos.

logseq_exit_editing_modeC

Exit current editing mode

Inputs: select_block.

logseq_get_all_pagesC

List all pages in the graph with basic metadata

Inputs: repo.

logseq_get_current_pageB

Retrieves the currently active page or block in the user's workspace

Inputs: no named parameters.

logseq_get_current_page_contentB

Get hierarchical block structure of current page

Inputs: no named parameters.

logseq_get_editing_block_contentB

Get content of currently edited block

Inputs: no named parameters.

logseq_get_pageC

Retrieve detailed information about a specific page including metadata and content

Inputs: src_page (required), include_children.

logseq_get_page_contentC

Get block hierarchy for specific page

Inputs: src_page (required).

logseq_insert_blockA

Insert a new block into Logseq. Can create: - Page-level blocks (use is_page_block=true with page name as parent_block) - Nested blocks under existing blocks - Blocks with custom UUIDs for precise reference Supports before/after positioning and property management.

Inputs: content (required), before, custom_uuid, is_page_block, +1 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 10 tools

    Disambiguation3/5

    The tools have clear distinct purposes for core operations like creating pages, editing blocks, and retrieving content, but there is notable overlap between retrieval tools. Specifically, logseq_get_page and logseq_get_page_content both retrieve page details, and logseq_get_current_page_content and logseq_get_editing_block_content focus on current workspace content, which could cause confusion in selection. Descriptions help differentiate, but the boundaries are not perfectly distinct.

    Naming Consistency5/5

    All tool names follow a consistent snake_case pattern with a 'logseq_' prefix, using clear verb_noun combinations such as create_page, edit_block, and get_all_pages. This uniformity makes the tools predictable and easy to parse, with no deviations in style or structure across the set.

    Tool Count5/5

    With 10 tools, the count is well-scoped for a Logseq server, covering essential operations like page creation, editing, and content retrieval. Each tool serves a specific function without redundancy, fitting within the typical 3-15 range for such a domain, and no tools feel unnecessary or missing for basic interactions.

    Completeness4/5

    The tool set provides good coverage for core Logseq workflows, including CRUD-like operations for pages and blocks (create, get, edit, insert). However, there are minor gaps, such as no explicit tools for deleting pages or blocks, updating block content beyond editing mode, or managing properties post-creation, which agents might need to work around using existing tools.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that provides AI assistants with structured access to your Logseq knowledge graph, enabling retrieval, searching, analysis, and creation of content within your personal knowledge base.
      69
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A Model Context Protocol server that enables AI agents to interact with local Logseq knowledge graphs, supporting operations like creating/editing pages and blocks, searching content, and managing journal entries.
      13
      15
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A Model Context Protocol server that enables AI agents to interact with a local Logseq instance, allowing operations like creating pages, managing blocks, and searching across a knowledge graph.
      13
      1
      MIT
    • 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.
      39 npm
      7
      MIT