Logseq API MCP server

Logseq API MCP server

logseq-api-mcp•bygustavo-meilus

An MCP server exposing 21 tools to read, write, query, and search a Logseq knowledge graph through the Logseq HTTP API.

License: MIT•Runtime: Awaiting documentation review•Category: productivity work

WHAT IT DOES

  • •Provides 12 read tools for listing pages, inspecting block trees, page links and backlinks, block and page content, flashcards, full-text search, and Datalog/DSL queries.
  • •Provides 10 write tools to create, delete, rename, and update pages; append, edit, insert, and delete blocks; and set block properties in DB-mode.
  • •Supports Logseq's newer database format, which stores graph data in SQLite, via a configuration flag that unlocks DB-specific behavior.
  • •Enforces tag-based privacy at query time so pages with configured tags are hidden from read operations.

BEST FOR

  • •Letting an AI assistant search and read a personal Logseq note graph.
  • •Automating Logseq page and block edits from an MCP client.
  • •Running structured Datalog or DSL queries against Logseq graph data.

ABOUT LOGSEQ-API-MCP

Logseq API MCP server is cataloged as an MCP server attributed to gustavo-meilus. An MCP server exposing 21 tools to read, write, query, and search a Logseq knowledge graph through the Logseq HTTP API. It is categorized under productivity work. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Logseq API MCP server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

How are private pages kept out of tool results?

Pages tagged with any tag listed in LOGSEQ_EXCLUDE_TAGS are removed from every read operation, enforced at query time so changes apply immediately.

Can the server work with Logseq's database format?

Yes; setting LOGSEQ_DB_MODE=true unlocks DB-mode features such as block property setting, UUID-reference resolution, and Datalog-powered property queries.

Upstream README

View this exact version on GitHub

README.md · 711e9d649a77 · Fetched 2026-11-13 09:46:26 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

logseq-api-mcp

Your AI assistant starts every session blind to your Logseq knowledge graph. logseq-api-mcp fixes that: 21 tools to read, write, query, and search your notes — auto-registered the moment you drop a Python file into src/tools/.

Python License: MIT CI Coverage Tests Stars

Architecture: AI Client → logseq-api-mcp (21 tools, privacy) → Logseq API → Knowledge Graph

Quick Start

Step 1 — Install

git clone https://github.com/gustavo-meilus/logseq-api-mcp.git
cd logseq-api-mcp
uv sync

Step 2 — Configure

cp .env.template .env
# open .env and set LOGSEQ_API_ENDPOINT and LOGSEQ_API_TOKEN

Getting your token: open Logseq, go to Settings → Features → Developer mode, enable HTTP APIs server, and copy the token shown. The default endpoint is http://127.0.0.1:12315/api.

Step 3 — Connect

// ~/.claude/claude_desktop_config.json
{
  "mcpServers": {
    "logseq-api": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/logseq-api-mcp", "python", "src/server.py"],
      "env": {
        "LOGSEQ_API_ENDPOINT": "http://127.0.0.1:12315/api",
        "LOGSEQ_API_TOKEN": "your_token_here"
      }
    }
  }
}

Restart Claude Desktop. All 21 tools are live.


Tools

Read (12 tools)

ToolWhat it does
get_all_pagesEvery page with ID, UUID, journal flag, and namespace
get_page_blocksHierarchical block tree with IDs, UUIDs, and child counts
get_page_linksPages linking to a target page
get_page_backlinksFull backlink analysis including block-level references
get_block_contentBlock detail with properties and immediate children
get_all_page_contentComplete page: properties, blocks, DB refs expanded
get_linked_flashcardsQ&A flashcard pairs from a page and all linked pages
searchFull-text search across blocks, pages, and file names
queryRaw Datalog / DSL queries against the graph
find_pages_by_propertyFilter pages by property key and optional value
get_pages_from_namespaceAll pages under a Logseq namespace
get_pages_tree_from_namespaceNested tree of namespace pages

Write (10 tools)

ToolWhat it does
create_pageCreate a page with optional properties and format
delete_pageRemove a page permanently
rename_pageRename a page and update all references
update_pageAppend or replace content on an existing page
append_block_in_pageAdd blocks at the end of a page
edit_blockReplace a block's content by UUID
update_blockUpdate block content by UUID
insert_nested_blockInsert a child or sibling block relative to another block
delete_blockDelete a block by UUID
set_block_propertiesSet structured properties on a block (DB-mode only)

Configuration

VariableDefaultDescription
LOGSEQ_API_ENDPOINThttp://127.0.0.1:12315/apiLogseq HTTP API base URL
LOGSEQ_API_TOKEN(required)Bearer auth token
LOGSEQ_VERIFY_SSLtrueSet false to skip TLS verification
LOGSEQ_DB_MODEfalseEnable Logseq database-format API paths
LOGSEQ_EXCLUDE_TAGS(empty)Comma-separated tags — pages with any tag are hidden
LOGSEQ_LOG_LEVELWARNINGLog level: DEBUG, INFO, WARNING, ERROR

DB-Mode

Logseq's newer database format stores graph data in SQLite rather than markdown files. Set LOGSEQ_DB_MODE=true to unlock set_block_properties, UUID-reference resolution in get_all_page_content, and Datalog-powered queries in find_pages_by_property. Tools that do not apply in DB-mode return a clear error rather than silently failing.


Privacy

Any page tagged with a tag from LOGSEQ_EXCLUDE_TAGS disappears from every read operation. Enforcement runs at query time, so toggling the variable takes effect immediately.

OperationBehavior when page is excluded
get_all_pagesExcluded pages absent from the listing
searchExcluded pages and their blocks stripped from results
queryResults post-filtered against excluded page names
find_pages_by_propertyResults post-filtered
get_page_backlinksExcluded source pages removed
get_all_page_contentReturns ❌ Access denied for the excluded page

Adding a Tool

Create src/tools/my_tool.py. No imports, no registration, no config changes needed. The discovery system picks it up on the next server start.

from typing import List
from mcp.types import TextContent
from src.client.logseq_client import LogseqClient
from src.client.config import LogseqConfig, load_config
from src.logging_setup import get_logger

_log = get_logger(__name__)

async def _run(
    client: LogseqClient, config: LogseqConfig, param: str
) -> List[TextContent]:
    try:
        _log.debug("%s called", __name__)
        result = await client.some_api_method(param)
        return [TextContent(type="text", text=str(result))]
    except Exception as exc:
        _log.error("exception in %s: %s", __name__, exc, exc_info=True)
        return [TextContent(type="text", text=f"❌ Error: {exc}")]

async def my_tool(param: str) -> List[TextContent]:
    """One-line description — this becomes the MCP tool description."""
    cfg = load_config()
    return await _run(LogseqClient(cfg), cfg, param)

The _run(client, config, ...) pattern keeps the logic testable via FakeLogseqClient in tests/conftest.py. Function names starting with _ are not registered.


Development

uv sync --dev                                                        # all deps
uv run --group test pytest tests/ -v                                 # test suite (345 tests)
uv run --group test pytest tests/ --cov=src --cov-fail-under=85      # coverage gate
uv run ruff check --fix && uv run ruff format                        # lint + format
uv run mypy src/ --ignore-missing-imports                            # type check
uv run bandit -r src/                                                # security scan
uv run mcp dev src/server.py                                         # MCP inspector

Star History

Star History Chart


License

MIT — see LICENSE.


Made for the Logseq and MCP communities.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Logseq API MCP server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/logseq-api-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related productivity work MCP Servers

Alternative and complementary servers in the same category

View all in productivity work →
Tuqui hosted MCP server for Odoo
tuqui-odoo-mcp-for-claude-chatgpt•tuqui-ai

Tuqui is a hosted MCP server that connects Odoo with Claude and ChatGPT so users can ask about sales, stock, customers and overdue invoices in plain language.

Repository stats unavailable
Productivity & Ops