Logseq MCP Tools
This server allows AI agents to interact with a local Logseq instance programmatically to manage pages and blocks in a graph.
Pages Operations:
Get a list of all pages
Retrieve, create, or delete specific pages
Handle journal pages with automatic date formatting and attributes
Get linked references to a page
Block Operations:
Retrieve, create, update, move, or remove blocks
Insert blocks as children or siblings of other blocks
Manage hierarchical structures and block-specific attributes
Move blocks with their children
Additional Functions:
Search for blocks matching specific queries
Retrieve blocks that reference other pages or journal entries
Enables AI agents to interact with a local Logseq instance by providing tools for managing pages and blocks, including creating, updating, deleting, and searching content within a Logseq graph.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Logseq MCP Tools add today's tasks to my journal page with a 'Tasks' section"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Logseq MCP Tools
This project provides a set of Model Context Protocol (MCP) tools that enable AI agents to interact with your local Logseq instance.
Installation
Ensure you have Python 3.11+ installed
Clone this repository
Install dependencies:
pip install -e .
Related MCP server: Logseq MCP Tools
Setup
Make sure your Logseq has the API enabled.
In Logseq, go to Settings > Advanced > Developer mode > Enable Developer mode
Then, go to Plugins > Turn on Logseq Developer Plugin
Also set an API token in the Advanced settings
Restart Logseq
Configure the MCP server in 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" } } } }
OR
Configure Claude Code to use the MCP server with:
claude mcp addSelect scope
Select Stdio
LOGSEQ_API_URL=http://localhost:12315 LOGSEQ_TOKEN=your-token-here /opt/homebrew/bin/uvx logseq-mcp
Using with Cursor and Claude
Adding to Cursor's MCP Tools
Configure the MCP server as shown above in the Setup section
Open Cursor and go to the MCP panel (sidebar)
The Logseq tool should appear in your list of available tools
Using with Claude
When using Claude in Cursor, you'll need to inform it that you have Logseq tools available with a prompt similar to:
"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."
Available Tools
All tools are available under the logseq namespace:
Pages
logseq.get_all_pages: Get 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 blocks
Blocks
logseq.get_page_blocks: Get all blocks from a specific pagelogseq.get_block: Get 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 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 query
Working with Logseq
Journal Pages
Journal pages in Logseq have a specific format and attributes:
Use the format "mmm dth, yyyy" (e.g., "Apr 4th, 2025") when creating or accessing journal pages
Journal pages are automatically formatted by Logseq with proper dating
Journal pages have special attributes that are automatically set by Logseq:
journal?: true - Indicates this is a journal pagejournalDay: YYYYMMDD - The date in numeric format (e.g., 20250404 for April 4, 2025)
Example:
await logseq.create_page("Apr 4th, 2025")
Important: You do not need to manually set the journal? or journalDay attributes. Simply creating a page with the proper date format (e.g., "Apr 4th, 2025") will automatically configure it as a journal page with the appropriate attributes.
Block Structure and Formatting
Blocks in Logseq have some important characteristics to understand:
Automatic Bullets: All blocks are automatically rendered as bullet points in the Logseq UI
Page Links: Create links using double brackets:
[[Page Name]]Hierarchical Blocks:
Block structure data contains hierarchical information:
parent: The parent block's IDlevel: The indentation level (1 for top-level, 2+ for indented blocks)left: The block to the left (typically the parent for indented blocks)
Block Content: When creating blocks, you can include text formatting:
Basic Markdown is supported (bold, italic, etc.)
Bullet points within a block may have limited support
Multi-line content is supported but may be subject to Logseq's parsing rules
Journal Blocks: Blocks created in journal pages inherit special attributes:
journal?: truejournalDay: YYYYMMDD - Same as the journal page
Note: Like journal pages, these block attributes are automatically handled by Logseq. You don't need to manually set the journal? or journalDay attributes when creating blocks on journal pages.
Example Usage for Common Tasks
Working with the Cursor agent: When you have Logseq MCP tools configured in Cursor, you can give the agent prompts like:
"Create a new page called 'Meeting Notes' with bullet points for today's agenda"
"Add today's tasks to my journal page with a 'Tasks' section"
"Update today's journal entry with [[Project Plan]], set its child element to 'Completed milestone 1'"
"Search my graph for blocks about 'python projects' and organize them on a new page"
The agent will use the appropriate Logseq tools to carry out these operations on your graph.
Available Tools
13 toolscreate_blockA
Creates a new block on a page in the Logseq graph.
Note: Blocks are automatically formatted as bullet points in Logseq UI.
Use [[Page Name]] to create links to other pages.
Args:
page_name: The name of the page to create the block on.
content: The content of the new block.
properties: Optional properties to set on the new block.
Returns:
Information about the created block.
Inputs: content (required), page_name (required), properties.
create_pageA
Creates a new page in the Logseq graph.
For journal pages, use the format "mmm dth, yyyy" (e.g., "Apr 4th, 2025").
Logseq automatically sets "journal?": true and "journalDay": YYYYMMDD.
Args:
name: The name of the new page.
properties: Optional properties to set on the new page.
Returns:
Information about the created page.
Inputs: name (required), properties.
delete_pageA
Deletes a page from the Logseq graph.
⚠️ This removes the page and all its blocks. Cannot be undone.
Args:
name: The name of the page to delete.
Returns:
Result of the deletion operation.
Inputs: name (required).
get_all_pagesB
Gets all pages from the Logseq graph.
Journal pages can be identified by the "journal?" attribute set to true and
will include a "journalDay" attribute in the format YYYYMMDD.
Returns:
List of all pages in the Logseq graph.
Inputs: no named parameters.
get_blockA
Gets a specific block from the Logseq graph by its ID.
The returned block contains hierarchical structure information:
- parent: The parent block's ID
- level: The indentation level
- left: The block to the left
Args:
block_id: The ID of the block to retrieve.
Returns:
Information about the requested block, or None if not found.
Inputs: block_id (required).
get_pageA
Gets a specific page from the Logseq graph by name.
For journal pages, use the format "mmm dth, yyyy" (e.g., "Apr 4th, 2025").
Journal pages have specific attributes:
- "journal?": true - Indicates this is a journal page
- "journalDay": YYYYMMDD - The date in numeric format
Args:
name: The name of the page to retrieve.
Returns:
Information about the requested page, or None if not found.
Inputs: name (required).
get_page_blocksA
Gets all blocks from a specific page in the Logseq graph.
For journal pages, use the format "mmm dth, yyyy" (e.g., "Apr 4th, 2025").
Returned blocks contain hierarchical structure information:
- parent: The parent block's ID
- level: The indentation level (1 for top-level, 2+ for indented)
- left: The block to the left (typically the parent for indented blocks)
Args:
page_name: The name of the page to retrieve blocks from.
Returns:
List of blocks from the specified page.
Inputs: page_name (required).
get_page_linked_referencesA
Gets all linked references to a specific page.
Returns blocks containing [[Page Name]] links to the specified page.
Args:
page_name: The name of the page to find references to.
Returns:
List of blocks that reference the specified page.
Inputs: page_name (required).
insert_blockA
Inserts a new block as a child of the specified parent block.
Creates hierarchical content by adding children to existing blocks.
The new block is inserted at the beginning (before=True) or end (before=False)
of the parent's children.
Args:
parent_block_id: The ID of the parent block to insert under.
content: The content of the new block.
properties: Optional properties to set on the new block.
before: Whether to insert at the beginning of children (default: False).
Returns:
Information about the created block.
Inputs: content (required), parent_block_id (required), before, properties.
move_blockA
Moves a block to a new location in the graph.
Moves a block and all its children to a different location.
- as_child=True: Block becomes a child of the target
- as_child=False: Block becomes a sibling after the target
Args:
block_id: The ID of the block to move.
target_block_id: The ID of the target block to move to.
as_child: Whether to make the block a child of the target (default: False).
Returns:
Result of the move operation.
Inputs: block_id (required), target_block_id (required), as_child.
remove_blockA
Removes a block from the Logseq graph.
⚠️ Permanently removes the block and all its children. Cannot be undone.
Args:
block_id: The ID of the block to remove.
Returns:
Result of the removal operation.
Inputs: block_id (required).
search_blocksA
Searches for blocks matching a query in the Logseq graph.
Query examples:
- page:"Page Name" - blocks on a specific page
- "search term" - blocks containing the term
- [[Page Name]] - references to a specific page
Args:
query: The search query.
Returns:
List of blocks matching the search query.
Inputs: query (required).
update_blockB
Updates an existing block in the Logseq graph.
Use [[Page Name]] to create links to other pages.
Args:
block_id: The ID of the block to update.
content: The new content for the block.
properties: Optional properties to update on the block.
Returns:
Information about the updated block.
Inputs: block_id (required), content (required), properties.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Each tool has a distinct purpose targeting specific resources and actions in the Logseq graph. For example, create_block vs. insert_block clearly differentiate between creating a top-level block and inserting a child block, while get_page_blocks and search_blocks serve different retrieval functions. No tools appear to overlap in functionality.
All tools follow a consistent verb_noun pattern with snake_case naming (e.g., create_block, get_page, update_block). The verbs are clear and appropriate (create, get, delete, search, update, move, remove, insert), and the nouns consistently refer to Logseq entities (block, page). There are no deviations in naming conventions.
With 13 tools, this server is well-scoped for managing a Logseq graph, covering core operations without bloat. The count aligns with the domain's complexity, providing comprehensive functionality for pages and blocks (e.g., CRUD operations, hierarchical management, search) without being excessive or insufficient.
The tool set offers complete coverage for Logseq graph management, including full CRUD for pages and blocks, hierarchical operations (insert_block, move_block), search capabilities, and reference tracking. There are no obvious gaps; agents can perform all essential workflows from creation to deletion with support for linking and properties.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Related MCP Servers
- AlicenseBqualityBmaintenanceA server that enables LLMs to programmatically interact with Logseq knowledge graphs, allowing creation and management of pages and blocks.1030 PyPI47MIT
- AlicenseNot gradedqualityDmaintenanceA 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.70MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol server that enables AI agents to interact with a local Logseq instance, allowing operations like creating pages, managing blocks, and searching across a knowledge graph.131MIT
- AlicenseAqualityDmaintenanceAn MCP server for interacting with Logseq graphs, enabling AI assistants to read, create, and manipulate Logseq content.8MIT