The Logseq MCP Server provides direct integration with Logseq's knowledge base, enabling large language models to interact with Logseq graphs, create pages, manage blocks, and organize information programmatically through the Model Context Protocol.
Install the server using pip:
pip install mcp-server-logseq
Clone and set up the repository:
git clone https://github.com/dailydaniel/logseq-mcp.git
cd logseq-mcp
cp .env.example .env
uv sync
Run the server:
python -m mcp_server_logseq
export LOGSEQ_API_TOKEN=your_token_here
Alternatively, pass the token via command line:
python -m mcp_server_logseq --api-key=your_token_here
The default URL is http://localhost:12315. To customize:
python -m mcp_server_logseq --url=http://your-logseq-instance:port
Add the following configuration to your Claude Desktop setup:
{
"mcpServers": {
"logseq": {
"command": "uvx",
"args": ["mcp-server-logseq"],
"env": {
"LOGSEQ_API_TOKEN": "<YOUR_KEY>",
"LOGSEQ_API_URL": "http://127.0.0.1:12315"
}
}
}
}
If you encounter errors, try using version 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 - Create new blocks in Logseq
parent_block
(string): Parent block UUID or page namecontent
(string, required): Block contentis_page_block
(boolean): Create as page-level blockbefore
(boolean): Insert before parent blockcustom_uuid
(string): Custom UUIDv4 for blocklogseq_edit_block - Enter block editing mode
src_block
(string, required): Block UUIDpos
(number): Cursor positionlogseq_exit_editing_mode - Exit editing mode
select_block
(boolean): Keep block selectedlogseq_create_page - Create new pages
page_name
(string, required): Page nameproperties
(object): Page propertiesjournal
(boolean): Create as journal pageformat
(string): Page format (markdown/org)logseq_get_page - Get page details
src_page
(string, required): Page identifierinclude_children
(boolean): Include child blockslogseq_get_all_pages - List all pages
repo
(string): Repository namelogseq_get_current_page - Get active page/block
logseq_get_current_blocks_tree - Current page's block hierarchy
logseq_get_editing_block_content - Get content of active block
logseq_get_page_blocks_tree - Get page's block structure
src_page
(string, required): Page identifierCreate 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
Use the MCP inspector for debugging:
npx @modelcontextprotocol/inspector uv --directory . run mcp-server-logseq
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "logseq" '{"command":"uvx","args":["mcp-server-logseq"],"env":{"LOGSEQ_API_TOKEN":"<YOUR_KEY>","LOGSEQ_API_URL":"http://127.0.0.1:12315"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"logseq": {
"command": "uvx",
"args": [
"mcp-server-logseq"
],
"env": {
"LOGSEQ_API_TOKEN": "<YOUR_KEY>",
"LOGSEQ_API_URL": "http://127.0.0.1:12315"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"logseq": {
"command": "uvx",
"args": [
"mcp-server-logseq"
],
"env": {
"LOGSEQ_API_TOKEN": "<YOUR_KEY>",
"LOGSEQ_API_URL": "http://127.0.0.1:12315"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect