Logseq MCP Tools provides a set of Model Context Protocol (MCP) tools that enable AI agents to interact with your local Logseq instance. These tools allow you to programmatically access and manipulate your Logseq graph, including creating and managing pages, blocks, and journal entries.
To get started with Logseq MCP Tools, you'll need:
pip install -e .
Before using the MCP tools, you must enable API access in Logseq:
Add the following to your Cursor MCP configuration file (typically at ~/.cursor/mcp.json
):
{
"mcpServers": {
"logseq": {
"command": "/opt/homebrew/bin/uvx",
"args": ["logseq-mcp"],
"env": {
"LOGSEQ_API_URL": "http://localhost:12315",
"LOGSEQ_TOKEN": "your-token-here"
}
}
}
}
Use the following command to set up the MCP server with Claude Code:
claude mcp add
When prompted:
LOGSEQ_API_URL=http://localhost:12315 LOGSEQ_TOKEN=your-token-here /opt/homebrew/bin/uvx logseq-mcp
When using Claude in Cursor, inform it about the available Logseq tools with a prompt like:
"You have access to Logseq tools that can help you interact with my Logseq graph. You can use functions like logseq.get_all_pages(), logseq.get_page(name), logseq.create_page(name), etc."
All tools are accessible under the logseq
namespace:
logseq.get_all_pages
: Retrieve a list of all pages in the Logseq graphlogseq.get_page
: Get a specific page by namelogseq.create_page
: Create a new pagelogseq.delete_page
: Delete a page and all its blockslogseq.get_page_blocks
: Get all blocks from a specific pagelogseq.get_block
: Retrieve a specific block by IDlogseq.create_block
: Create a new block on a pagelogseq.insert_block
: Insert a block as a child of another blocklogseq.update_block
: Update content of an existing blocklogseq.move_block
: Move a block to a different locationlogseq.remove_block
: Remove a block and all its childrenlogseq.search_blocks
: Search for blocks matching a queryJournal pages in Logseq have special formatting:
await logseq.create_page("Apr 4th, 2025")
When working with blocks, keep in mind:
[[Page Name]]
With Logseq MCP tools configured in Cursor, you can give the agent prompts like:
The agent will use the appropriate Logseq tools to carry out these operations on your graph.
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 > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.