Logseq MCP (logseq-mcp-af600fde)

MCP文档知识

提供方 alvinteh-git

文档知识 stdio · 本地进程 无需鉴权 社区 / 第三方 Claude DesktopClaudeClineVS Code
查看接入方式

用于与Logseq知识图谱交互的MCP协议服务器,支持AI助手对Logseq内容进行读写和管理操作。

一句话选型结论

按资料字段整理

Logseq MCP (logseq-mcp-af600fde) 属于文档知识类 MCP 服务器,stdio · 本地进程,无需鉴权,可直接接入 Claude Desktop、Claude、Cline 等,有可直接执行的安装命令。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类文档知识 传输方式stdio · 本地进程 鉴权无需鉴权 部署方式本地部署
GitHub 星标 0 仓库热度,无公开仓库时显示未标注
工具数 9 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

文档知识
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量9暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

支持客户端

适用场景

知识管理Python本地部署AI集成笔记系统协议服务器隐私保护

安装与配置

stdio · 本地进程 无需鉴权
客户端在本机拉起子进程,数据不出本机
pip install -e .

这条命令只是入口,具体启动参数请按官方文档补齐,不要直接照搬到别的服务器。

  1. 1
    准备运行环境

    stdio 服务在本地起进程,需要先装好 Node.js 等运行时,再按安装命令拉取依赖。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后客户端会列出约 9 个工具,随便调一个只读工具确认能返回结果。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
文档检索问答

在你的文档库里按问题找答案。

知识库读写

把新资料写进知识库,随用随取。

内容整理

把零散资料归纳成结构化笔记。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 资料标注 9 个工具,职责相对集中,接入后不容易误操作。
  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已适配 Claude Desktop、Claude、Cline,换客户端不用重新研究配置。
  • 资料标注无需鉴权,装好就能连。

先想清楚的地方

  • stdio 方式要求本地装好运行时(如 Node.js),换机器要重新装一遍。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在文档知识场景里让模型直接调用外部能力的人。
  • 已经在用 Claude Desktop、Claude 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
Logseq MCP (logseq-mcp-af600fde)当前 9 stdio · 本地进程 本地部署 有 2026-05-17
dify 未标注 stdio · 本地进程 本地部署 有 2026-04-11
open-webui 未标注 stdio · 本地进程 本地部署 有 2026-04-11
JeecgBoot 未标注 stdio · 本地进程 本地部署 有 2026-04-11
Cherry Studio 未标注 未标注 未标注 无 2026-05-17
mempalace 未标注 stdio · 本地进程 本地部署 有 2026-04-11

服务器档案

文档知识
字段来自项目仓库与公开索引,中文说明由本站标注
提供方alvinteh-git上游标注的维护方 alvinteh-git
分类文档知识本站按上游分类展示
连接方式stdio · 本地进程客户端在本机拉起子进程,数据不出本机
鉴权方式无需鉴权远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · 未标注本地安装时用到的包标识与运行时
部署类型本地部署上游给出的部署形态
最近核验2026-05-17上游最后核验时间

详细介绍

12.8 KB
来自项目仓库与上游目录的原文,未做删改

Logseq MCP Server

An MCP (Model Context Protocol) server for interacting with Logseq graphs, enabling AI assistants to read, create, and manipulate Logseq content.

Features

  • Block Operations: Create, update, and delete blocks
  • Page Management: Create pages, retrieve page content, search pages
  • Query Execution: Execute Datalog queries against your Logseq graph
  • Journal Support: Access journal pages by date with automatic format conversion
  • Privacy-First Logging: Automatic sanitization of sensitive data in logs
  • MCP Protocol: Full compliance with the Model Context Protocol specification

Quick Setup

Automated Setup (Recommended)

We provide a setup wizard that will guide you through the installation:```bash

Clone the repository

git clone https://github.com/yourusername/logseq-mcp.git
cd logseq-mcp

Run the setup wizard

./deploy.sh


The setup wizard will:
1. Check your Python version (3.13+ required)
2. Install uv package manager (if not present)
3. Install all dependencies
4. Configure your Logseq API connection
5. Test the connection to Logseq
6. Generate configuration for Claude Desktop or Cline

### Prerequisites

- Python 3.13+
- Logseq with API enabled
- uv (recommended) or pip for package management

### Manual Installation

If you prefer to set up manually instead of using the setup wizard:

#### Using uv (recommended)```bash
# Clone the repository
git clone https://github.com/yourusername/logseq-mcp.git
cd logseq-mcp

# Install dependencies
uv pip install --system -e .

# Install development dependencies (optional)
uv pip install --system -e ".[dev]"

Using pip```bash

Clone the repository

git clone https://github.com/yourusername/logseq-mcp.git
cd logseq-mcp

Install dependencies

pip install -e .

Install development dependencies (optional)

pip install -e ".[dev]"


## Configuration

### Logseq Configuration

1. Copy the example environment file:```bash
   cp env/.env.example env/.env
   ```

2. Configure your Logseq API settings in `env/.env`:```env
   LOGSEQ_API_HOST=localhost
   LOGSEQ_API_PORT=12315
   ```

3. Enable the Logseq API in your Logseq settings

### Claude Desktop Configuration

The setup wizard (`./deploy.sh`) will generate the configuration for you. If you need to configure manually, add the following to your Claude Desktop configuration file:

**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json````json
{
  "mcpServers": {
    "logseq": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/logseq-mcp",
        "run",
        "--with",
        ".",
        "--refresh",
        "--python",
        "3.13",
        "python",
        "-m",
        "logseq_mcp_server"
      ],
      "env": {
        "LOGSEQ_API_HOST": "localhost",
        "LOGSEQ_API_PORT": "12315",
        "LOGSEQ_MCP_LOG_LEVEL": "INFO",
        "LOGSEQ_MCP_PROJECT_ROOT": "/path/to/logseq-mcp"
      }
    }
  }
}

> Security note: Delete operations are disabled by default to prevent accidental or
> AI-initiated data loss. Add "LOGSEQ_DELETE_ENABLED": "true" to the env block only
> when you explicitly want the AI assistant to be able to delete blocks.

Important Notes:
- Replace ALL instances of /path/to/logseq-mcp with the actual absolute path to your cloned repository (in args AND env)
- The --directory argument sets UV's working directory
- The --with . argument tells UV to install the local package before running
- The --refresh flag ensures UV uses the latest code (important during development)
- The LOGSEQ_MCP_PROJECT_ROOT environment variable ensures logs are saved in the project directory
- Ensure Logseq is running with the API server enabled before starting Claude Desktop
- You may need to configure authentication if your Logseq API requires a token

To enable the delete_block tool, add LOGSEQ_DELETE_ENABLED to the env block:```json
"env": {
"LOGSEQ_API_HOST": "localhost",
"LOGSEQ_API_PORT": "12315",
"LOGSEQ_DELETE_ENABLED": "true"
}


**Troubleshooting**:
- If you see errors about cached code, run `uv cache clean` to clear UV's cache
- Check logs in the `logs/` directory of the project for detailed error information

After updating the configuration, restart Claude Desktop to connect to the Logseq MCP server.

### Cline (VS Code Extension) Configuration

For Cline users, the setup wizard will provide the configuration. You can also manually add the server to your Cline settings in VS Code:

1. Open VS Code Settings
2. Navigate to Extensions > Cline > MCP Servers
3. Add the configuration provided by the setup wizard

### Logging and Privacy

The server includes privacy-focused logging that protects your personal data by default:

#### Privacy Features

- **Default Privacy Mode**: Personal data like page names, content, and queries are automatically sanitized
- **Automatic Log Rotation**: Prevents disk space issues with configurable size/time-based rotation
- **Configurable Retention**: Set how long to keep logs before automatic deletion

#### Logging Modes

1. **Privacy Mode** (default): Sanitizes sensitive information
   - Page names: `"My Private Notes"` → `"My P***otes"` (preserves partial visibility)
   - Content: Replaced with `[content_123_chars]`
   - Queries: Hidden as `[datalog_query_45_chars]`
   - File paths: `/Users/john/Documents` → `/Users/***/Documents`
   - Block IDs: Anonymized to `block_a1b2c3` (consistent hashing)

2. **Debug Mode**: Full logging for troubleshooting
   - Enable with `LOGSEQ_MCP_LOG_MODE=debug`
   - Shows complete data (use only when needed)

3. **Minimal Mode**: Only errors and warnings
   - Enable with `LOGSEQ_MCP_LOG_MODE=minimal`

#### Configuration```bash
# Environment variables
LOGSEQ_MCP_LOG_MODE=privacy          # privacy, debug, or minimal (default: privacy)
LOGSEQ_MCP_LOG_LEVEL=INFO            # DEBUG, INFO, WARNING, ERROR (default: INFO)
LOGSEQ_MCP_LOG_RETENTION_DAYS=7      # Days to keep logs (default: none)
LOGSEQ_MCP_LOG_MAX_SIZE=10MB         # Max file size before rotation (default: 10MB)
LOGSEQ_MCP_DEBUG=true                # Enable console output (default: false)
LOGSEQ_MCP_LOG_FILE=/custom/path.log # Custom log location (optional)

Example Privacy Mode Log Entry```json

{
"timestamp": "2025-01-15T10:30:45Z",
"level": "INFO",
"logger": "logseq_mcp_server.logging_config",
"message": "Tool get_page completed successfully",
"tool_name": "get_page",
"arguments": {
"name": "My Pnal"
},
"result": {
"success": true,
"page": {
"originalName": "My P
nal",
"uuid": "block_7d4e8c"
}
},
"duration_ms": 45
}


#### Viewing Logs```bash
# View logs in real-time
tail -f logs/logseq-mcp.log

# Search logs while respecting privacy
grep '"level": "ERROR"' logs/logseq-mcp.log

Temporary Debug Mode

When troubleshooting issues:```bash

Run with debug logging temporarily

LOGSEQ_MCP_LOG_MODE=debug python -m logseq_mcp_server

Or in Claude Desktop config (temporarily):

"env": {
"LOGSEQ_MCP_LOG_MODE": "debug",
"LOGSEQ_MCP_LOG_RETENTION_DAYS": "1"
}


**Important**: Remember to switch back to privacy mode after debugging to protect your personal data.

## Usage

### Running the Server```bash
# Run with default stdio transport
python -m logseq_mcp_server

# Run with SSE transport
LOGSEQ_MCP_TRANSPORT=sse python -m logseq_mcp_server

# Run with MCP CLI
mcp run src/logseq_mcp_server/server.py

Available Tools

Block Operations

  • create_block: Create a new block in a page
  • update_block: Update an existing block's content or properties
  • delete_block: Delete a block (disabled by default; requires LOGSEQ_DELETE_ENABLED=true)

Page Operations

  • create_page: Create a new page
  • get_all_pages: Get all pages in the current graph
  • get_page: Retrieve a page and its content
  • get_journal_page: Get a journal page by date (supports various date formats)
  • search_pages: Search for pages by query

Query Operations

  • execute_query: Execute Datalog queries (supports optional input parameters for parameterized queries)

Working with Journal Pages

The get_journal_page tool provides a convenient way to retrieve journal pages by date, automatically converting various date formats to Logseq's journal page naming convention.

Supported Date Formats

The tool accepts dates in multiple formats:
- ISO format: "2023-12-25"
- US format: "12/25/2023"
- EU format: "25/12/2023"
- Abbreviated pre-formatted: "Dec 25th, 2023"
- Python date/datetime objects (when using the API directly)

Example Usage```json

// Get today's journal page
{
"tool": "get_journal_page",
"arguments": {
"date": "2024-01-15"
}
}

// Get journal with blocks
{
"tool": "get_journal_page",
"arguments": {
"date": "01/15/2024",
"include_children": true
}
}


The tool converts the provided date to Logseq's abbreviated journal format (e.g., `"Dec 25th, 2023"`) before fetching the page.

### Executing Datalog Queries

The `execute_query` tool runs Datalog queries against the graph. It also accepts an optional `inputs` array for parameterized queries.```json
// Simple query
{
  "tool": "execute_query",
  "arguments": {
    "query": "[:find ?name :where [?p :block/name ?name]]"
  }
}

// Parameterized query
{
  "tool": "execute_query",
  "arguments": {
    "query": "[:find ?b :in $ ?tag :where [?b :block/refs ?r] [?r :block/name ?tag]]",
    "inputs": ["meeting"]
  }
}

Troubleshooting

If you encounter issues during setup:

  1. Python Version: Ensure you have Python 3.13+ installedbash python3 --version

  2. Logseq API: Make sure the API server is enabled in Logseq:
    - Settings > Advanced > Enable "API Server"
    - Default port is 12315

  3. Connection Issues: Test the connection manually:bash cd logseq-mcp python tests/tools/test_logseq.py get-all-pages --limit 5

  4. Logs: Check the logs directory for detailed error information:bash tail -f logs/logseq-mcp.log

  5. Clean Install: If all else fails, try a clean installation:```bash
    # Remove existing installation
    rm -rf .venv build dist *.egg-info

# Run setup wizard again
./deploy.sh
```

Development

Testing with the Test Harness

A standalone test harness (tests/tools/test_logseq.py) is provided for rapid testing and debugging of Logseq API calls without going through the MCP protocol. This tool is useful for:
- Debugging API connectivity issues
- Testing raw API methods directly
- Exploring Logseq API capabilities interactively
- Verifying API responses before implementing MCP tools

Usage examples:```bash

Test specific methods

python tests/tools/test_logseq.py get-page "MCP Server"
python tests/tools/test_logseq.py get-page "Test Page" --show-raw
python tests/tools/test_logseq.py get-all-pages --limit 5
python tests/tools/test_logseq.py search "test"

Test journal pages

python tests/tools/test_logseq.py get-page "December 25th, 2023" # Get journal by formatted name

Raw API calls

python tests/tools/test_logseq.py raw logseq.Editor.getCurrentGraph
python tests/tools/test_logseq.py raw logseq.Editor.getPage "My Page"

Interactive REPL mode

python tests/tools/test_logseq.py interactive

Verbose mode for debugging

python tests/tools/test_logseq.py get-page "MCP Server" --verbose


The test harness provides:
- Direct access to LogseqClient without MCP overhead
- Pretty-printed JSON output
- Interactive REPL for exploration
- Full request/response logging
- Command history in interactive mode

#### Important Note on Logseq API Arguments

Most Logseq API methods expect arguments to be wrapped in arrays, even for single values:
- **Correct**: `logseq.Editor.getPage ["MCP Server"]`
- **Incorrect**: `logseq.Editor.getPage "MCP Server"`

Methods that require array format: getPage, getPageBlocksTree, getBlock, removeBlock, createPage, insertBlock, updateBlock.
Methods that use string format: search, q (queries).

### Running Tests```bash
# Run all tests
pytest

# Run with coverage
pytest --cov=src/logseq_mcp_server tests/

# Run specific test
pytest tests/unit/test_tools.py -v

Code Quality```bash

Run linter

ruff check src/ tests/

Format code

ruff format src/ tests/
```

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feat/amazing-feature)
  3. Commit your changes using conventional commits
  4. Push to the branch (git push origin feat/amazing-feature)
  5. Open a Pull Request

Conventional Commits

This project uses conventional commits. Examples:
- feat(tools): add block creation tool
- fix(api): handle empty query results
- docs(readme): update installation instructions

See CLAUDE.md for detailed development guidelines.

License

This project is private and proprietary. All rights reserved.

Acknowledgments

  • Built with the MCP SDK
  • Integrates with Logseq

常见问题

8 问
答案由本站依据条目字段整理,不引用上游原文
Logseq MCP (logseq-mcp-af600fde) 怎么安装?

在客户端按下面的安装命令接入:pip install -e .。装完在客户端配置里引用同一个包或端点。

Logseq MCP (logseq-mcp-af600fde) 怎么在 Claude Desktop、Claude、Cline 里配置?

它的传输方式是stdio · 本地进程,在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,配置才会生效。

Logseq MCP (logseq-mcp-af600fde) 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Logseq MCP (logseq-mcp-af600fde) 需要 API Key 吗?

资料标注为无需认证,装好就能连;如果实际调用时报鉴权错误,按官方文档补上凭据。

Logseq MCP (logseq-mcp-af600fde) 支持哪些客户端?

资料标注支持 Claude Desktop、Claude、Cline、VS Code;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

Logseq MCP (logseq-mcp-af600fde) 能提供哪些能力?

资料显示约 9 个工具;能力标签包括 知识管理、笔记系统、Python、Claude、隐私保护。具体工具清单以官方文档为准。

Logseq MCP (logseq-mcp-af600fde) 需要什么运行环境?

属于本地进程,需要在本机装好运行环境。

Logseq MCP (logseq-mcp-af600fde) 是本地还是远程?

它是本地进程(stdio),由客户端在本机拉起。传输方式为stdio · 本地进程。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-05-17。