Logseq MCP Tools

Logseq MCP-Tools
Dieses Projekt bietet eine Reihe von Model Context Protocol (MCP)-Tools, die es KI-Agenten ermöglichen, mit Ihrer lokalen Logseq-Instanz zu interagieren.
Installation
Stellen Sie sicher, dass Sie Python 3.11+ installiert haben
Dieses Repository klonen
Installieren Sie Abhängigkeiten:
pip install -e .
Related MCP server: Logseq MCP Tools
Aufstellen
Stellen Sie sicher, dass in Ihrem Logseq die API aktiviert ist.
Gehen Sie in Logseq zu Einstellungen > Erweitert > Entwicklermodus > Entwicklermodus aktivieren
Gehen Sie dann zu Plugins > Logseq Developer Plugin aktivieren
Legen Sie außerdem in den erweiterten Einstellungen ein API-Token fest
Starten Sie Logseq neu
Konfigurieren Sie den MCP-Server in Ihrer Cursor-MCP-Konfigurationsdatei (normalerweise unter
~/.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" } } } }
ODER
Konfigurieren Sie Claude Code für die Verwendung des MCP-Servers mit:
claude mcp addUmfang auswählen
Wählen Sie Stdio
LOGSEQ_API_URL=http://localhost:12315 LOGSEQ_TOKEN=your-token-here /opt/homebrew/bin/uvx logseq-mcp
Verwendung mit Cursor und Claude
Hinzufügen zu den MCP-Tools von Cursor
Konfigurieren Sie den MCP-Server wie oben im Abschnitt „Setup“ gezeigt
Öffnen Sie den Cursor und gehen Sie zum MCP-Bedienfeld (Seitenleiste).
Das Logseq-Tool sollte in Ihrer Liste der verfügbaren Tools erscheinen
Verwendung mit Claude
Wenn Sie Claude in Cursor verwenden, müssen Sie ihm mit einer Eingabeaufforderung ähnlich der folgenden mitteilen, dass Ihnen Logseq-Tools zur Verfügung stehen:
„Sie haben Zugriff auf Logseq-Tools, die Ihnen bei der Interaktion mit meinem Logseq-Diagramm helfen können. Sie können Funktionen wie logseq.get_all_pages(), logseq.get_page(name), logseq.create_page(name) usw. verwenden.“
Verfügbare Tools
Alle Tools sind unter dem logseq -Namespace verfügbar:
Seiten
logseq.get_all_pages: Ruft eine Liste aller Seiten im Logseq-Diagramm ablogseq.get_page: Ruft eine bestimmte Seite nach Namen ablogseq.create_page: Eine neue Seite erstellenlogseq.delete_page: Löscht eine Seite und alle ihre Blöcke
Blöcke
logseq.get_page_blocks: Alle Blöcke von einer bestimmten Seite abrufenlogseq.get_block: Holen Sie sich einen bestimmten Block nach IDlogseq.create_block: Einen neuen Block auf einer Seite erstellenlogseq.insert_block: Fügt einen Block als untergeordnetes Element eines anderen Blocks ein.logseq.update_block: Aktualisieren Sie einen vorhandenen Blocklogseq.move_block: Verschiebt einen Block an einen anderen Ortlogseq.remove_block: Entfernt einen Block und alle seine untergeordneten Elementelogseq.search_blocks: Suche nach Blöcken, die einer Abfrage entsprechen
Arbeiten mit Logseq
Journalseiten
Journalseiten in Logseq haben ein bestimmtes Format und bestimmte Attribute:
Verwenden Sie beim Erstellen oder Zugreifen auf Journalseiten das Format „mmm dth, yyyy“ (z. B. „4. April 2025“)
Journalseiten werden von Logseq automatisch mit der richtigen Datierung formatiert
Journalseiten haben spezielle Attribute, die automatisch von Logseq festgelegt werden:
journal?: true - Zeigt an, dass dies eine Journalseite istjournalDay: JJJJMMTT – Das Datum im numerischen Format (z. B. 20250404 für den 4. April 2025)
Beispiel:
await logseq.create_page("Apr 4th, 2025")
Wichtig: Sie müssen die Attribute „ journal? oder journalDay nicht manuell festlegen. Wenn Sie eine Seite mit dem richtigen Datumsformat (z. B. „4. April 2025“) erstellen, wird sie automatisch als Journalseite mit den entsprechenden Attributen konfiguriert.
Blockstruktur und Formatierung
Blöcke in Logseq haben einige wichtige Eigenschaften, die man verstehen muss:
Automatische Aufzählungszeichen : Alle Blöcke werden in der Logseq-Benutzeroberfläche automatisch als Aufzählungszeichen dargestellt
Seitenlinks : Erstellen Sie Links mit doppelten Klammern:
[[Page Name]]Hierarchische Blöcke :
Blockstrukturdaten enthalten hierarchische Informationen:
parent: Die ID des übergeordneten Blockslevel: Die Einrückungsebene (1 für oberste Ebene, 2+ für eingerückte Blöcke)left: Der Block links (normalerweise der übergeordnete Block bei eingerückten Blöcken)
Blockinhalt : Beim Erstellen von Blöcken können Sie Textformatierungen einschließen:
Grundlegendes Markdown wird unterstützt (fett, kursiv usw.)
Aufzählungspunkte innerhalb eines Blocks werden möglicherweise nur eingeschränkt unterstützt
Mehrzeiliger Inhalt wird unterstützt, unterliegt aber möglicherweise den Parsing-Regeln von Logseq
Journalblöcke : Auf Journalseiten erstellte Blöcke erben besondere Attribute:
journal?wahrjournalDay: JJJJMMTT – Dasselbe wie die Journalseite
Hinweis: Wie bei Journalseiten werden diese Blockattribute automatisch von Logseq verwaltet. Sie müssen die Attribute journal? oder journalDay beim Erstellen von Blöcken auf Journalseiten nicht manuell festlegen.
Anwendungsbeispiele für allgemeine Aufgaben
Arbeiten mit dem Cursor-Agenten: Wenn Sie Logseq MCP-Tools in Cursor konfiguriert haben, können Sie dem Agenten Eingabeaufforderungen wie die folgenden geben:
„Erstellen Sie eine neue Seite mit dem Namen ‚Besprechungsnotizen‘ mit Aufzählungspunkten für die heutige Tagesordnung.“
„Fügen Sie die heutigen Aufgaben meiner Tagebuchseite mit einem Abschnitt ‚Aufgaben‘ hinzu.“
„Aktualisieren Sie den heutigen Journaleintrag mit [[Projektplan]] und setzen Sie sein untergeordnetes Element auf ‚Meilenstein 1 abgeschlossen‘.“
„Durchsuchen Sie mein Diagramm nach Blöcken zum Thema ‚Python-Projekte‘ und organisieren Sie sie auf einer neuen Seite.“
Der Agent verwendet die entsprechenden Logseq-Tools, um diese Vorgänge an Ihrem Diagramm durchzuführen.
Available Tools
13 toolscreate_blockA
Creates a new block on a page in the Logseq graph.
IMPORTANT NOTES:
1. All blocks are automatically formatted as bullet points in Logseq UI
2. To create links to other pages, use double brackets: [[Page Name]]
When creating blocks on journal pages:
- The block will inherit the "journal?" and "journalDay" attributes from the page
- "journalDay" will be in YYYYMMDD format (e.g., 20250404 for April 4, 2025)
Args:
page_name (str): The name of the page to create the block on.
content (str): The content of the new block.
properties (dict, optional): Properties to set on the new block.
Returns:
dict: Information about the created block.
Inputs: page_name (required), content (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").
Journal pages are specially formatted in Logseq with automatic dating.
When you create a journal page, Logseq automatically:
- Sets "journal?": true
- Sets "journalDay": YYYYMMDD (e.g., 20250404 for April 4, 2025)
- Formats the page as a journal entry
Args:
name (str): The name of the new page.
properties (dict, optional): Properties to set on the new page.
Returns:
dict: Information about the created page.
Inputs: name (required), properties.
delete_pageA
Deletes a page from the Logseq graph.
This operation removes the specified page and all its blocks. This action cannot be undone.
For journal pages, use the format "mmm dth, yyyy" (e.g., "Apr 4th, 2025").
Args:
name (str): The name of the page to delete.
Returns:
dict: Result of the deletion operation.
Inputs: name (required).
get_all_pagesA
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: A 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 information about its hierarchical structure:
- parent: The parent block's ID
- level: The indentation level (1 for top-level, 2+ for indented blocks)
- left: The block to the left (typically the parent for indented blocks)
If the block is from a journal page, it will include:
- "journal?": true
- "journalDay": YYYYMMDD - Date in numeric format
Args:
block_id (str): The ID of the block to retrieve.
Returns:
dict: Information about the requested block.
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").
Note that journal pages are automatically created in Logseq with this date format.
Journal pages have specific attributes:
- "journal?": true - Indicates this is a journal page
- "journalDay": YYYYMMDD - The date in numeric format (e.g., 20250404 for April 4, 2025)
Args:
name (str): The name of the page to retrieve.
Returns:
dict: Information about the requested page.
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 information about their hierarchical structure:
- parent: The parent block's ID
- level: The indentation level (1 for top-level, 2+ for indented blocks)
- left: The block to the left (typically the parent for indented blocks)
Blocks from journal pages will have:
- "journal?": true
- "journalDay": YYYYMMDD - The date in numeric format (e.g., 20250404)
Args:
page_name (str): The name of the page to retrieve blocks from.
Returns:
list: A list of blocks from the specified page.
Inputs: page_name (required).
get_page_linked_referencesA
Gets all linked references to a specific page in the Logseq graph.
This returns blocks that contain links to the specified page using
the Logseq double bracket notation: [[Page Name]].
For journal pages, use the format "mmm dth, yyyy" (e.g., "Apr 4th, 2025").
Args:
page_name (str): The name of the page to find references to.
Returns:
list: A 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.
This allows for creating hierarchical content by adding children to existing blocks.
IMPORTANT NOTES:
1. All blocks are automatically formatted as bullet points in Logseq UI
2. To create links to other pages, use double brackets: [[Page Name]]
3. The new block will be inserted at the beginning or end of the parent's children
depending on the 'before' parameter
When inserting blocks into journal pages:
- The block will inherit the "journal?" and "journalDay" attributes
- "journalDay" will be in YYYYMMDD format (e.g., 20250404 for April 4, 2025)
Args:
parent_block_id (str): The ID of the parent block to insert under.
content (str): The content of the new block.
properties (dict, optional): Properties to set on the new block.
before (bool, optional): Whether to insert at the beginning of children.
Default is False (append at the end).
Returns:
dict: Information about the created block.
Inputs: parent_block_id (required), content (required), properties, before.
move_blockA
Moves a block to a new location in the graph.
This allows for reorganizing the structure of blocks in the graph by moving
a block (and all its children) to a different location.
IMPORTANT NOTES:
1. The block will maintain its children when moved
2. The hierarchical position depends on the 'as_child' parameter:
- If as_child=True: The block becomes a child of the target block
- If as_child=False: The block becomes a sibling after the target block
Args:
block_id (str): The ID of the block to move.
target_block_id (str): The ID of the target block to move to.
as_child (bool, optional): Whether to make the block a child of the target.
Default is False (insert as sibling).
Returns:
dict: Result of the move operation.
Inputs: block_id (required), target_block_id (required), as_child.
remove_blockA
Removes a block from the Logseq graph.
This operation permanently removes the specified block and all its children.
This action cannot be undone.
To remove a block, you need its block ID, which can be obtained from:
- get_page_blocks() function
- get_block() function
- search_blocks() function
Args:
block_id (str): The ID of the block to remove.
Returns:
dict: Result of the removal operation.
Inputs: block_id (required).
search_blocksA
Searches for blocks matching a query in the Logseq graph.
Examples of useful queries:
- page:"Page Name" - find all blocks on a specific page
- "search term" - find blocks containing the term
- page:"Apr 4th, 2025" - find all blocks in a journal
- [[Page Name]] - find references to a specific page
Returned blocks from journal pages will include:
- "journal?": true
- "journalDay": YYYYMMDD - The date in numeric format
Args:
query (str): The search query.
Returns:
list: A list of blocks matching the search query.
Inputs: query (required).
update_blockA
Updates an existing block in the Logseq graph.
IMPORTANT NOTES:
1. All blocks are automatically formatted as bullet points in Logseq UI
2. To create links to other pages, use double brackets: [[Page Name]]
When updating blocks on journal pages:
- The "journal?" and "journalDay" attributes will be preserved
- "journalDay" will remain in YYYYMMDD format (e.g., 20250404)
Args:
block_id (str): The ID of the block to update.
content (str): The new content for the block.
properties (dict, optional): Properties to update on the block.
Returns:
dict: 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 clearly distinct purpose with no overlap. For example, create_block and insert_block serve different functions (creating a block on a page vs. inserting a block as a child), and get_page_blocks and search_blocks target different retrieval methods. The descriptions reinforce these distinctions, making misselection unlikely.
All tool names follow a consistent verb_noun pattern with snake_case, such as create_block, get_page, and update_block. This uniformity makes the tool set predictable and easy to navigate, with no deviations in naming conventions.
With 13 tools, the set is well-scoped for managing a Logseq graph, covering essential operations like CRUD for pages and blocks, hierarchical manipulation, and search. Each tool serves a clear purpose without redundancy, making the count appropriate for the domain.
The tool set provides comprehensive coverage for Logseq graph management, including full CRUD for pages and blocks, hierarchical operations (move_block, insert_block), retrieval methods (get_all_pages, search_blocks), and advanced features like linked references. There are no obvious gaps that would hinder agent workflows.
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.1050 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 local Logseq knowledge graphs, supporting operations like creating/editing pages and blocks, searching content, and managing journal entries.1315MIT
- AlicenseNot gradedqualityBmaintenanceA Model Context Protocol (MCP) server implementation that enables AI assistants to interact with Anytype's API through natural language, allowing users to manage their knowledge base through conversation.71,433 npm544MIT