LogSeq

by dailydaniel

16 stars
3.3k downloads
Not rated
GitHub

About

Integrates with LogSeq API to enable automated note-taking, knowledge graph analysis, and workflow automation for developers and knowledge workers.

Details

Author
dailydaniel
Repository
dailydaniel/logseq-mcp
GitHub stars
16
Downloads
3,251
License
MIT License
Categories
Productivity, Design, Developer Tools, AI, Infrastructure, Knowledge Base, Frontend, API

- Full-text search, task lookup, and page listing with blacklist filtering
- Read pages, blocks, and run custom Datalog queries
- Write notes only in the agent’s own namespace prefix
- Gateable task status changes
- Dynamic tools generated from config queries
- Optional audit log recorded to today’s journal
- Supports both stdio and Streamable HTTP transports

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name LogSeq
    Command (node, npx, python, etc.) uvx
    Arguments
    • Argument 1 mcp-server-logseq
    Environment
    • LOGSEQ_API_URL http://127.0.0.1:12315
    • LOGSEQ_API_TOKEN <YOUR_TOKEN>

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

| Source | Token | URL |
| --- | --- | --- |
| Environment | LOGSEQ_API_TOKEN | LOGSEQ_API_URL (default http://localhost:12315) |
| CLI flag | --api-key | --url |

The token is read from the environment or --api-key; it is never stored in
code. A .env file is supported (see .env.example).

Behaviour beyond the defaults is set in a TOML file — path from
LOGSEQ_MCP_CONFIG (default ~/.config/logseq-mcp/config.toml). Custom queries
live in EDN files next to it. The server runs fine with no config file (safe
read-mostly defaults); see examples/config.toml for a
full annotated example.

| Section | Key options |
| --- | --- |
| [read] | resolve_depth — how deep to expand ((block refs)) |
| [write] | agent_write_prefix (default byAgent), allow_agents_write_any |
| [search] | files_path — graph folder; set it to use the ripgrep backend |
| [blacklist] | pages — pages (and subpages) to hide and redact everywhere |
| [tasks] | allow_status_change — gate for set_task_status |
| [audit_log] | enabled — log writes to today's journal |
| [queries.<name>] | a named query: file/inline query, register_as_tool, … |

Secrets and the API URL stay in the environment, never in this file.

The Streamable HTTP transport requires a bearer token: every request must
send Authorization: Bearer <LOGSEQ_MCP_HTTP_TOKEN>, or it gets 401. The
server refuses to start in this mode without a token set. Note this is a
distinct secret from LOGSEQ_API_TOKEN:

| Secret | Direction |
| --- | --- |
| LOGSEQ_API_TOKEN | this server → Logseq |
| LOGSEQ_MCP_HTTP_TOKEN | client (phone) → this server |

> ⚠️ A bearer token over plain HTTP is only safe on an already-encrypted
> channel. Don't expose the raw port to the open internet. The easy path for a
> home/headless host is Tailscale: install it on the host and the client,
> and reach http://<host>.<tailnet>.ts.net:8000/mcp over the encrypted
> tunnel — no domains, nginx, or certificates. (tailscale serve can add TLS
> if you want https://.)

search

Full-text search over block content. Parameters: query (string), regex (optional boolean), limit (optional integer), case_sensitive (optional boolean), exclude_journals (optional boolean).

find_tasks

Find task blocks based on optional filters. Parameters: markers (optional array), tag (optional string), under_tag (optional string), page (optional string), priority (optional string), limit (optional integer).

list_pages

List page names under a specified namespace. Parameters: prefix (optional string), depth (optional integer).

custom_query

Run a named query from the configuration. Parameters: name (string), inputs (optional object).

list_custom_queries

List the configured queries.

datascript_query

Run a raw Datalog query. Parameters: query (string), inputs (optional object), rules (optional object).

get_logseq_guide

Returns the authoritative guide for querying/writing the graph.

read_page

Read a page as a normalized block tree. Parameters: page (string), depth (optional integer).

read_block

Read a block and its children. Parameters: uuid (string), depth (optional integer).

write_note

Create, append, or replace a page under the agent's write prefix. Parameters: subpath (string), content (optional string), mode (optional string), properties (optional object).

set_page_properties

Set or remove properties on a page. Parameters: subpath (string), properties (object or null).

edit_block

Replace a block's content. Parameters: uuid (string), old_content (string), new_content (string).

create_task

Create a task block in the agent namespace. Parameters: title (string), agent (string), project (optional string), marker (optional string), priority (optional string), tags (optional array), plan_page (optional string), blocks_on (optional array), on_page (optional string).

set_task_status

Change a task's marker. Parameters: uuid (string), status (string).

query_<name>

Each config query with register_as_tool set to true is exposed as its own tool.

All read output is normalized to a flat JSON shape and passed through the
blacklist. Reads resolve ((block refs)) non-lossily (the resolved block's
uuid/status is kept so you can act on it).

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "logseq": {
            "env": {
                "LOGSEQ_API_URL": "http://127.0.0.1:12315",
                "LOGSEQ_API_TOKEN": "<YOUR_TOKEN>"
            },
            "args": [
                "mcp-server-logseq"
            ],
            "command": "uvx"
        }
    }
}

Linux

{
    "env": {
        "LOGSEQ_API_URL": "http://127.0.0.1:12315",
        "LOGSEQ_API_TOKEN": "<YOUR_TOKEN>"
    },
    "args": [
        "mcp-server-logseq"
    ],
    "command": "uvx"
}

Macos

{
    "env": {
        "LOGSEQ_API_URL": "http://127.0.0.1:12315",
        "LOGSEQ_API_TOKEN": "<YOUR_TOKEN>"
    },
    "args": [
        "mcp-server-logseq"
    ],
    "command": "uvx"
}

Windows

{
    "env": {
        "LOGSEQ_API_URL": "http://127.0.0.1:12315",
        "LOGSEQ_API_TOKEN": "<YOUR_TOKEN>"
    },
    "args": [
        "mcp-server-logseq"
    ],
    "command": "uvx"
}

Logseq MCP Server

Turn your Logseq graph into memory and workspace for AI agents. A
Model Context Protocol server for
Logseq with safety-scoped writes, an audit trail in your
daily journal, and verified queries exposed as tools. Built on FastMCP (the
high-level API of the official mcp package).

PyPI
Python 3.11+
License: MIT

<a href="https://glama.ai/mcp/servers/@dailydaniel/logseq-mcp">
Logseq Server MCP server
</a>

> Targets the file/Markdown ("OG") version of Logseq — and plain-text files
> are part of why a graph makes good agent memory: git-syncable, greppable,
> durable, no lock-in. The newer DB (SQLite) version changed the underlying
> schema; some methods may behave differently there.

Why

Agents need durable memory, and you already maintain one — your graph. The
missing piece is access you can trust: an agent should read broadly and write
usefully, but never touch what it shouldn't — and never do anything you can't
see. Three design choices make that possible:

- Namespace-scoped writes. Agents write only under their own prefix
(byAgent/ by default), plus one deliberately narrow cross-namespace channel
that can change nothing but a task's TODO/DOING/DONE marker. Blacklisted
pages are hidden and redacted from every read.
- An audit trail in your daily journal. Every successful write appends a
line like 22:30 [[byAgent]] wrote [[byAgent/readingList/...]] to today's
journal — reviewing your agents' work becomes part of a morning routine you
already have.
- Verified queries as tools. Ship known-good Datalog from config as named
tools (query_week_plan, …), so agents don't compose datascript by hand and
cheaper models stay reliable.

How I use it

I run a small fleet of Claude Code agents with this server on an always-on Mac
mini, against my live personal graph:

- Nightly research. A link dropped into the reading list from the phone; at
night an agent claims it (status:: researching), reads the article — or
shallow-clones and reads the repo — writes a structured summary onto the page
and flips it to read.
- Morning brief. At 08:30 a small model assembles a one-page dashboard —
what was read overnight, week-plan progress, current NOW/DOING tasks — and
sends a single push notification.
- One journal for everyone. The human's tasks and the agents' audit lines
interleave in the same daily note:

A daily note: human tasks and agent audit lines side by side

The pages the researcher writes — properties, summary, relevance — link straight
into the rest of the graph:

A research page written by the nightly agent

flowchart LR
    A[AI agents] -- MCP tools --> S[logseq-mcp]
    S -- HTTP API --> L[Logseq graph]
    S -. audit line per write .-> J[daily journal]
    Y((you)) --> L
    Y -- morning review --> J

Requirements

- A running Logseq with the local HTTP API server enabled
(Settings → Features → HTTP APIs server, then start it from the 🔌 menu).
- An authorization token created in the HTTP API server settings.

Usage

Claude Code

Local (stdio), token from the environment:

claude mcp add logseq --scope user --env LOGSEQ_API_TOKEN=<YOUR_TOKEN> -- uvx mcp-server-logseq

Or point it at a remote instance over Streamable HTTP (how phone and remote
sessions reach a headless host — see Transports):

claude mcp add logseq --scope user --transport http http://<host>:8000/mcp \
  --header "Authorization: Bearer <LOGSEQ_MCP_HTTP_TOKEN>"

Claude Desktop

{
  "mcpServers": {
    "logseq": {
      "command": "uvx",
      "args": ["mcp-server-logseq"],
      "env": {
        "LOGSEQ_API_TOKEN": "<YOUR_TOKEN>",
        "LOGSEQ_API_URL": "http://127.0.0.1:12315"
      }
    }
  }
}

Configuration

| Source | Token | URL |
| --- | --- | --- |
| Environment | LOGSEQ_API_TOKEN | LOGSEQ_API_URL (default http://localhost:12315) |
| CLI flag | --api-key | --url |

The token is read from the environment or --api-key; it is never stored in
code. A .env file is supported (see .env.example).

Config file (optional)

Behaviour beyond the defaults is set in a TOML file — path from
LOGSEQ_MCP_CONFIG (default ~/.config/logseq-mcp/config.toml). Custom queries
live in EDN files next to it. The server runs fine with no config file (safe
read-mostly defaults); see examples/config.toml for a
full annotated example.

| Section | Key options |
| --- | --- |
| [read] | resolve_depth — how deep to expand ((block refs)) |
| [write] | agent_write_prefix (default byAgent), allow_agents_write_any |
| [search] | files_path — graph folder; set it to use the ripgrep backend |
| [blacklist] | pages — pages (and subpages) to hide and redact everywhere |
| [tasks] | allow_status_change — gate for set_task_status |
| [audit_log] | enabled — log writes to today's journal |
| [queries.<name>] | a named query: file/inline query, register_as_tool, … |

Secrets and the API URL stay in the environment, never in this file.

Transports

By default the server runs over stdio (for Claude Desktop and other local
clients). A Streamable HTTP transport is also available for remote/networked
use (e.g. a phone client):

```bash
LOGSEQ_MCP_HTTP_TOKEN=<client-secret> \
mcp-server-logseq --transport streamable-http --host 0.0.0.0 --port 8000

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.