MCP server to work with LogSeq via the local HTTP server
Project description
MCP server for LogSeq
MCP server to interact with LogSeq via its API. Enables Claude to read, create, and manage LogSeq pages through a comprehensive set of tools.
Prerequisites
LogSeq Setup
- Install LogSeq if not already installed
- Enable HTTP APIs server in LogSeq:
- Go to Settings → Features
- Check "Enable HTTP APIs server"
- Start the API server:
- Look for the API button (🔌) in the main LogSeq interface
- Click it to open the API control panel
- Click "Start server" to start the HTTP API server at
http://localhost:12315
- Generate API token:
- In the API control panel, click "Authorization tokens"
- Create a new token (e.g., name it "logseq" or "claude")
- Copy the generated token for use in configuration
System Requirements
- Python 3.11 or higher
- LogSeq running with HTTP API enabled
- An MCP client (instructions provided for Claude Code and Claude Desktop)
Installation
This MCP server works with any MCP-compatible client. Below are setup instructions for the most common clients:
Claude Code
# Install the package
pip install mcp-logseq
# Add to Claude Code
claude mcp add mcp-logseq \
--env LOGSEQ_API_TOKEN=your_token_here \
--env LOGSEQ_API_URL=http://localhost:12315 \
-- mcp-logseq
Claude Desktop
- Install the package:
pip install mcp-logseq
-
Open Claude Desktop configuration:
- macOS: Claude Desktop → Settings → Developer → "Edit Config"
- Windows: Navigate to
%APPDATA%\Claude\claude_desktop_config.json
-
Add server configuration:
{
"mcpServers": {
"mcp-logseq": {
"command": "mcp-logseq",
"env": {
"LOGSEQ_API_TOKEN": "your_token_here",
"LOGSEQ_API_URL": "http://localhost:12315"
}
}
}
}
- Restart Claude Desktop for changes to take effect
Other MCP Clients
For other MCP clients, use the server command mcp-logseq with these environment variables:
LOGSEQ_API_TOKEN: Your LogSeq API tokenLOGSEQ_API_URL: LogSeq server URL (default:http://localhost:12315)
Installation Verification
Test LogSeq API connectivity
python -c "
from mcp_logseq.logseq import LogSeq
api = LogSeq(api_key='your_token')
result = api.list_pages()
print(f'Connected! Found {len(result)} pages')
"
Verify MCP server registration
# For Claude Code
claude mcp list
# Should show mcp-logseq in the list
Test with MCP Inspector (for debugging)
npx @modelcontextprotocol/inspector mcp-logseq
Tools
The server implements 6 tools to interact with LogSeq:
- create_page: Create a new page with content
- list_pages: List all pages in the current graph (with journal filtering)
- get_page_content: Retrieve content of a specific page (text or JSON format)
- delete_page: Remove a page from the graph
- update_page: Update existing page content and/or properties
- search: Search for content across pages, blocks, and files
Example prompts
It's good to first instruct Claude to use LogSeq. Then it will always call the tool.
Example prompts:
- Get the contents of my latest meeting notes and summarize them
- Search for all pages where Project X is mentioned and explain the context
- Create a new page with today's meeting notes
- Update the project status page with the latest updates
Configuration
Environment Variables
- LOGSEQ_API_TOKEN (required): Bearer token from LogSeq API control panel → Authorization tokens
- LOGSEQ_API_URL (optional): LogSeq server URL (default:
http://localhost:12315)
Alternative Configuration Methods
Using .env file
Create a .env file in the project directory:
LOGSEQ_API_TOKEN=your_token_here
LOGSEQ_API_URL=http://localhost:12315
Using system environment variables
export LOGSEQ_API_TOKEN=your_token_here
export LOGSEQ_API_URL=http://localhost:12315
Troubleshooting
Common Issues
"LOGSEQ_API_TOKEN environment variable required"
- Ensure LogSeq HTTP API is enabled in Settings → Features
- Start the API server using the API button (🔌) in LogSeq's main interface
- Generate and copy the API token from "Authorization tokens" in the API control panel
- Verify token is correctly set in your configuration
Connection errors to LogSeq
- Confirm LogSeq is running
- Check that HTTP API server is enabled in Settings → Features
- Important: Make sure the API server is actually started (click "Start server" in the API control panel)
- Verify the server is running on port 12315
- Test connectivity with the verification command above
MCP server not found in Claude Code
- Run
claude mcp listto check if server is registered - Verify the command and arguments in your configuration
- Check that
uvand Python dependencies are properly installed
Empty or missing page content
- Some LogSeq versions may not support all API methods
- Check LogSeq logs for API errors
- Verify page names match exactly (case-sensitive)
Development
For local development, testing, and contributing to this project, see DEVELOPMENT.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_logseq-0.1.0.tar.gz.
File metadata
- Download URL: mcp_logseq-0.1.0.tar.gz
- Upload date:
- Size: 32.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d4463069ad00dc7ef23c90c15111a3b9a9480131d5523f9944fb0a559e4d43c
|
|
| MD5 |
18559546c8b7761672ac7f1a5dad9229
|
|
| BLAKE2b-256 |
65df97a98b9a034c87801deb41e69978a955a5d2842133391962c629ffdc8027
|
File details
Details for the file mcp_logseq-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_logseq-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57ac9cd30014ecd1c2c55c58b66060ebe62ace2af3da2f01209f308025742c97
|
|
| MD5 |
69148b5c050a8517425799e1e55cdbca
|
|
| BLAKE2b-256 |
cd89afd6e5973cebb4443867aba2d0ad87de2817dc580ffe638d4fbbb6842183
|