Skip to main content
Glama

Logseq MCP Server

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" } } } }

可用工具

块操作

  • 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 端点(页面链接、查询支持)
  • 提高区块操作能力
  • 添加模板支持
  • 增强错误处理

Related MCP Servers

  • -
    security
    F
    license
    -
    quality
    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.
    Last updated -
    45
    TypeScript
    • Apple
  • -
    security
    A
    license
    -
    quality
    A Model Context Protocol server that enables LLMs to interact with GraphQL APIs by providing schema introspection and query execution capabilities.
    Last updated -
    470
    1
    MIT License
    • Apple
  • -
    security
    F
    license
    -
    quality
    A Model Context Protocol server that enables LLMs to interact with GraphQL APIs by providing schema introspection and query execution capabilities.
    Last updated -
    1
    TypeScript
    • Apple
    • Linux
  • A
    security
    A
    license
    A
    quality
    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.
    Last updated -
    13
    15
    Python
    MIT License
    • Apple
    • Linux

View all related MCP servers

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dailydaniel/logseq-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server