MCP server for LogSeq
Connect Claude to your LogSeq knowledge base to read, create, update, and organize pages and blocks, with optional semantic vector search and DB-mode property support.
List, read, and delete pages; get page content and backlinks.
Create and update pages from markdown (headings, lists, code blocks, YAML frontmatter) with append or replace modes.
Rename pages and automatically update references across the graph.
Search across pages, blocks, and files; run Logseq DSL queries; find pages by property.
Explore namespaces as flat lists or hierarchical trees.
Create, update, delete, and insert nested blocks, including block properties.
Set DB-mode class properties on blocks.
Use optional vector search tools for semantic search, index sync, and status checks if configured.
Allows interaction with LogSeq via its API, including listing graphs and pages, getting, creating, updating, and deleting pages, and searching content across all pages
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., "@MCP server for LogSeq create a new page for today's meeting notes and link it to the project overview"
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.
β¨ What You Can Do
Transform your LogSeq knowledge base into an AI-powered workspace! This MCP server enables Claude to seamlessly interact with your LogSeq graphs.
π― Real-World Examples
π Intelligent Knowledge Management
"Analyze all my project notes from the past month and create a status summary"
"Find pages mentioning 'machine learning' and create a study roadmap"
"Search for incomplete tasks across all my pages"π Automated Content Creation
"Create a new page called 'Today's Standup' with my meeting notes"
"Add today's progress update to my existing project timeline page"
"Create a weekly review page from my recent notes"π Smart Research & Analysis
"Compare my notes on React vs Vue and highlight key differences"
"Find all references to 'customer feedback' and summarize themes"
"Create a knowledge map connecting related topics across pages"π§ Semantic Search (optional, requires vector setup)
"Find everything I wrote about burnout, even if I didn't use that word"
"What notes relate to my thoughts on deep work?"
"Search across my Dutch and English notes for ideas about productivity"π€ Meeting & Documentation Workflow
"Read my meeting notes and create individual task pages for each action item"
"Get my journal entries from this week and create a summary page"
"Search for 'Q4 planning' and organize all related content into a new overview page"π‘ Key Benefits
Zero Context Switching: Claude works directly with your LogSeq data
Preserve Your Workflow: No need to export or copy content manually
Intelligent Organization: AI-powered page creation, linking, and search
Enhanced Productivity: Automate repetitive knowledge work
Semantic Vector Search (optional): Find notes by meaning using local Ollama or hosted OpenAI-compatible embeddings
DB-mode Support (opt-in): Read and write class properties on Logseq DB-mode graphs
Related MCP server: Logseq MCP Server
π Quick Start
Step 1: Enable LogSeq API
Settings β Features β Check "Enable HTTP APIs server"
Click the API button (π) in LogSeq β "Start server"
Generate API token: API panel β "Authorization tokens" β Create new
Step 2: Add to your MCP client (No Installation Required!)
Claude Code
claude mcp add mcp-logseq \
--env LOGSEQ_API_TOKEN=your_token_here \
--env LOGSEQ_API_URL=http://localhost:12315 \
-- uv run --with mcp-logseq mcp-logseqClaude Desktop
Add to your config file (Settings β Developer β Edit Config):
{
"mcpServers": {
"mcp-logseq": {
"command": "uv",
"args": ["run", "--with", "mcp-logseq", "mcp-logseq"],
"env": {
"LOGSEQ_API_TOKEN": "your_token_here",
"LOGSEQ_API_URL": "http://localhost:12315"
}
}
}
}Codex CLI
With uv installed and Logseq's HTTP API running (Step 1), add this to ~/.codex/config.toml:
[mcp_servers.logseq]
command = "uv"
args = ["run", "--with", "mcp-logseq", "mcp-logseq"]
[mcp_servers.logseq.env]
LOGSEQ_API_TOKEN = "YOUR_LOGSEQ_TOKEN"
LOGSEQ_API_URL = "http://127.0.0.1:12315"Replace YOUR_LOGSEQ_TOKEN with your Logseq token. If Codex cannot find uv, run which uv in Terminal and use the full path for command. Keep your token private.
Use the API base address above, without /mcp. Codex runs this adapter through STDIO; the adapter connects to Logseq's regular HTTP API.
Restart Codex, open a new local task, and ask:
Use Logseq to list my journal pages, then read today's journal. Do not change anything.
Keep Logseq and its API server running. Codex starts the adapter automaticallyβno tunnel or separate Terminal window is needed.
Tested with a Logseq DB graph for page listing and journal retrieval. This setup is for local Codex tasks, not cloud-hosted ChatGPT Chat.
OpenCode
Add to ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"mcp-logseq": {
"type": "local",
"command": ["uv", "run", "--with", "mcp-logseq", "mcp-logseq"],
"enabled": true,
"environment": {
"LOGSEQ_API_URL": "http://localhost:12315",
"LOGSEQ_API_TOKEN": "your_token_here"
}
}
}
}Step 3: Start Using!
"Please help me organize my LogSeq notes. Show me what pages I have."π¬ Vector Search (Optional)
Semantic search over your Logseq graph using configurable embeddings β find notes by meaning, not just keywords. Searches across all your pages using vector similarity and full-text search combined, with cross-language support.
Use Ollama for fully local embeddings, OpenAI, or another OpenAI-compatible embeddings endpoint. LanceDB remains local in every configuration. Hosted providers receive the note text being embedded.
β Full setup guide: VECTOR_SEARCH.md
π οΈ Available Tools
The server provides 17 tools with intelligent markdown parsing, plus 3 optional vector search tools:
Tool | Purpose | Example Use |
| Browse your graph; | "Which pages did I change this week?" |
| Read page content | "Get my project notes" |
| Add new pages with structured blocks | "Create a meeting notes page with agenda items" |
| Modify pages (append/replace modes) | "Update my task list" |
| Remove pages | "Delete the old draft page" |
| Remove a block by UUID | "Delete this specific block" |
| Edit block content by UUID | "Update this specific block text" |
| Read a block by UUID with its properties and children | "Show me this specific block" |
| Find content across graph | "Search for 'productivity tips'" |
| Execute Logseq DSL queries (raw datalog not supported) | "Find all TODO tasks tagged #project" |
| Search pages by property | "Find all pages with status = active" |
| List pages in a namespace | "Show all pages under Customer/" |
| Hierarchical namespace view | "Show Projects/ as a tree" |
| Rename with reference updates | "Rename 'Old Name' to 'New Name'" |
| Find pages linking to a page | "What links to this page?" |
| Insert child/sibling blocks | "Add a child block under this task" |
| Set DB-mode class properties on a block | "Set the status of this block to active" (DB-mode only) |
| Semantic search by meaning | "Find notes about shadow work or Jung" |
| Sync vector DB with graph files | "Update the search index" |
| Show vector DB health and staleness | "Is my search index up to date?" |
βοΈ Requires vector search setup β see VECTOR_SEARCH.md
π¨ Smart Markdown Parsing (v1.1.0+)
The create_page and update_page tools now automatically convert markdown into Logseq's native block structure:
Markdown Input:
---
tags: [project, active]
priority: high
---
# Project Overview
Introduction paragraph here.
## Tasks
- Task 1
- Subtask A
- Subtask B
- Task 2
## Code Example
```python
def hello():
print("Hello Logseq!")
```Result: Creates properly nested blocks with:
β Page properties from YAML frontmatter (
tags,priority)β Hierarchical sections from headings (
#,##,###)β Nested bullet lists with proper indentation
β Code blocks preserved as single blocks
β Checkbox support (
- [ ]β TODO,- [x]β DONE)
Update Modes:
append(default): Add new content after existing blocksreplace: Clear page and replace with new content
π Safe Retries & Large Writes
create_page fails with a clear error if a page with the same title already exists, instead of letting Logseq silently create numbered duplicates (Page(1), Page 2, ...). This makes retries after a timeout safe: if a previous create_page call timed out but actually committed, the retry tells you the page exists rather than fragmenting your content across ghost pages.
For large writes, prefer this pattern over one giant create_page call:
Create the page with little or no content (
create_pagewith just the title and properties)Append content in smaller chunks with
update_page(mode: append)Read back with
get_page_contentto verify the result
If you hit the "already exists" error mid-ingest, use get_page_content to see what landed, then continue with update_page instead of re-creating.
βοΈ Prerequisites
LogSeq Setup
LogSeq installed and running
HTTP APIs server enabled (Settings β Features)
API server started (π button β "Start server")
API token generated (API panel β Authorization tokens)
System Requirements
uv Python package manager
MCP-compatible client (Claude Code, Claude Desktop, etc.)
π§ Configuration
Environment Variables
LOGSEQ_API_TOKEN(required): Your LogSeq API tokenLOGSEQ_API_URL(optional): Server URL (default:http://localhost:12315)LOGSEQ_VERIFY_SSL(optional): Whether to verify the TLS certificate of anhttps://LOGSEQ_API_URL. Defaults to verifying when the URL ishttps://; set to0,false, ornoto skip verification for self-signed certificates. Any other value enables verification.LOGSEQ_API_CONNECT_TIMEOUT(optional): HTTP connect timeout in seconds (default:3)LOGSEQ_API_READ_TIMEOUT(optional): HTTP read timeout in seconds (default:6)LOGSEQ_LOG_LEVEL(optional): Log verbosity βDEBUG,INFO,WARNING,ERROR, orCRITICAL(default:INFO). Logs go to stderr. AtDEBUG, the MCP SDK's own logger stays capped atINFOso full request payloads are not logged.LOGSEQ_LOG_FILE(optional): Path to a log file. When unset (the default), nothing is written to disk. Tool calls are logged with argument names and result sizes only, so page/block content does not appear in routine logs.LOGSEQ_DB_MODE(optional): Set totrueto enable DB-mode property support. Only for Logseq DB-mode graphs (beta). Markdown/file-based graph users should leave this unset.LOGSEQ_EXCLUDE_TAGS(optional): Comma-separated tags β pages with these tags are hidden from all tools. See Privacy & Access Control below.LOGSEQ_INCLUDE_NAMESPACES(optional): Comma-separated namespace allow-list (e.g.work,projects). When set, only pages in these namespaces and their sub-pages are accessible β everything else, including top-level pages without a namespace, is hidden from listings/search and denied on direct access. See Privacy & Access Control below.LOGSEQ_EXCLUDE_NAMESPACES(optional): Comma-separated namespace deny-list (e.g.finance,work/secret). These namespaces are always blocked, taking priority over the include list. See Privacy & Access Control below.LOGSEQ_WRITE_NAMESPACES(optional): Comma-separated write allow-list (e.g.Beren). When set, write tools may only target pages in these namespaces; everything else that is readable stays read-only. Applied on top of the include/exclude rules, never instead of them. See Privacy & Access Control below.LOGSEQ_CONFIG_FILE(optional): Path to a shared JSON config file holding the graph path, ACL defaults, and thevectorblock. Env vars (LOGSEQ_EXCLUDE_TAGS,LOGSEQ_INCLUDE_NAMESPACES,LOGSEQ_EXCLUDE_NAMESPACES,LOGSEQ_WRITE_NAMESPACES) override the matching keys in this file.MCP_HTTP_AUTH_TOKEN(required for--transport http): Bearer token clients must send asAuthorization: Bearer <token>. The server refuses to start in HTTP mode without it. See Serving over HTTP.
Privacy & Access Control
Pages tagged with excluded tags are completely hidden from AI β they won't appear in listings, searches, or queries, and attempting to read them directly returns an access-denied error.
Quick setup via env var:
LOGSEQ_EXCLUDE_TAGS=private,secretVia config file (also used for vector search):
{
"logseq_graph_path": "/path/to/your/logseq/pages",
"exclude_tags": ["private", "secret"]
}Point to it with LOGSEQ_CONFIG_FILE=/path/to/config.json.
In your Logseq pages, tag any page you want to protect:
tags:: privateThe exclusion applies to all tools: list_pages, get_page_content, search, query, and the optional vector search. If you also use vector search, exclude_tags at the root is automatically merged into the vector index exclusion list β private pages are never embedded.
Namespace access control
You can restrict access to specific namespaces using LOGSEQ_INCLUDE_NAMESPACES and LOGSEQ_EXCLUDE_NAMESPACES.
Include list (strict allow-list): Only the listed namespaces and their sub-pages are visible; everything else is hidden.
LOGSEQ_INCLUDE_NAMESPACES=work,projectsExclude list (deny-list): The listed namespaces are always blocked, even if they appear in the include list.
LOGSEQ_EXCLUDE_NAMESPACES=work/secret,financeVia config file:
{
"include_namespaces": ["work", "projects"],
"exclude_namespaces": ["work/secret", "finance"],
"write_namespaces": ["work/drafts"]
}Write list (write allow-list): Everything the read rules allow stays readable, but write tools (create_page, update_page, delete_page, rename_page, update_block, delete_block, insert_nested_block, set_block_properties) may only target pages in these namespaces. Useful when an assistant should read a wider area than it may edit:
LOGSEQ_INCLUDE_NAMESPACES=Family,Beren
LOGSEQ_WRITE_NAMESPACES=Beren # reads Family/* and Beren/*, writes only Beren/*rename_page needs both the old and the new name inside the write list; block tools are checked against the block's owning page (denied if it cannot be resolved). A write outside the list returns "page 'X' is read-only for this assistant". The write list never widens read access: a write namespace not covered by the include list is still denied (a warning is logged at startup). Unset means no extra restriction. Every allowed write is logged at INFO as Write: tool=<name> page=<page name> (names only, never content).
Matching is segment-based and case-insensitive: work matches work and work/projects but not workshop. The behavior mirrors LOGSEQ_EXCLUDE_TAGS: list/search results silently omit blocked pages; direct read, write, delete, and block operations return an access-denied error.
Access control is enforced at the page level and applied across every tool: list/search/query results omit blocked pages, direct page/block access and backlinks are denied, and vector search is filtered. Block-level results from search and query are resolved back to their owning page, so a block belonging to a restricted page is filtered out of those results too.
Index-time namespace scoping (vector DB only). The keys above are query-time: every page is embedded, and blocked ones are filtered out of each response. For the vector DB you can also scope at index time β decide which namespaces are embedded into the DB at all β with include_namespaces / exclude_namespaces inside the vector block of the config file:
{
"vector": {
"enabled": true,
"include_namespaces": ["work"],
"exclude_namespaces": ["work/secret"]
}
}This is global (it shapes the shared DB for every consumer), and it keeps unwanted content off disk entirely rather than filtering it on read β useful for secrets you never want embedded, or to keep the index small when everyone only cares about a subset. Matching is the same segment-based, case-insensitive rule. Because it changes what the index contains, it only takes effect after a full re-index: logseq-sync --rebuild.
π Serving over HTTP, multi-profile & TLS
By default the server speaks stdio β your client spawns it as a subprocess, and most users need nothing more. To serve sandboxed or remote clients over the network, mcp-logseq can run as a long-lived HTTP service with bearer auth, per-profile isolation, and TLS:
mcp-logseq --transport http --host 127.0.0.1 --port 12320 # requires MCP_HTTP_AUTH_TOKENThe full deployment guide β the server-side security model, the per-profile multi-instance pattern, the separate logseq-sync writer, and native TLS / reverse-proxy setup β lives in docs/SERVING.md. Non-loopback binds over plain HTTP are refused unless you supply TLS or pass --insecure.
Alternative Setup Methods
Using .env file
# .env
LOGSEQ_API_TOKEN=your_token_here
LOGSEQ_API_URL=http://localhost:12315System environment variables
export LOGSEQ_API_TOKEN=your_token_here
export LOGSEQ_API_URL=http://localhost:12315π Verification & Testing
Test LogSeq Connection
uv run --with mcp-logseq python -c "
from mcp_logseq.logseq import LogSeq
api = LogSeq(api_key='your_token')
print(f'Connected! Found {len(api.list_pages())} pages')
"Verify MCP Registration
claude mcp list # Should show mcp-logseqDebug with MCP Inspector
npx @modelcontextprotocol/inspector uv run --with mcp-logseq mcp-logseqπ Troubleshooting
Common Issues
"LOGSEQ_API_TOKEN environment variable required"
β Enable HTTP APIs in Settings β Features
β Click π button β "Start server" in LogSeq
β Generate token in API panel β Authorization tokens
β Verify token in your configuration
"spawn uv ENOENT" (Claude Desktop)
Claude Desktop can't find uv. Use the full path:
which uv # Find your uv locationUpdate config with full path:
{
"mcpServers": {
"mcp-logseq": {
"command": "/Users/username/.local/bin/uv",
"args": ["run", "--with", "mcp-logseq", "mcp-logseq"],
"env": { "LOGSEQ_API_TOKEN": "your_token_here" }
}
}
}Common uv locations:
Curl install:
~/.local/bin/uvHomebrew:
/opt/homebrew/bin/uvPip install: Check with
which uv
Connection Issues
β Confirm LogSeq is running
β Verify API server is started (not just enabled)
β Check port 12315 is accessible
β Test with verification command above
π©βπ» Development
For local development, testing, and contributing, see DEVELOPMENT.md.
Available Tools
17 toolscreate_pageA
Create a new page in Logseq with properly structured blocks.
Fails if a page with the same title already exists (use update_page to modify existing pages). This makes retries safe: re-sending a create_page that timed out will not create numbered duplicates like "Page(1)".
Markdown content is automatically parsed into Logseq's block hierarchy:
Headings (# ## ###) create nested sections
Lists (- or 1.) become proper block trees
Code blocks are preserved as single blocks
YAML frontmatter (---) becomes page properties
Example content:
---
tags: [project, active]
priority: high
---
# Project Title
Introduction paragraph.
## Tasks
- Task 1
- Subtask A
- Task 2Inputs: title (required), content, properties.
delete_blockB
Delete a block from LogSeq by its UUID.
Inputs: block_uuid (required).
delete_pageB
Delete a page from LogSeq.
Inputs: page_name (required).
find_pages_by_propertyA
Find all pages that have a specific property, optionally filtered by value. Simpler alternative to the full query DSL.
Inputs: property_name (required), limit, property_value.
get_blockA
Get a single block by its UUID. Returns the block content, properties, and child blocks (recursively). Useful for inspecting a specific block after finding its UUID via search or query.
Inputs: block_uuid (required), format, include_children.
get_page_backlinksB
Get all pages and blocks that link to a specific page (backlinks/linked references).
Inputs: page_name (required), include_content.
get_page_contentB
Get the content of a specific page from LogSeq.
Inputs: page_name (required), format, max_depth, resolve_refs.
get_pages_from_namespaceA
Get all pages within a namespace hierarchy (flat list). Use this to discover subpages of a parent page.
Inputs: namespace (required).
get_pages_tree_from_namespaceA
Get pages within a namespace as a hierarchical tree structure. Useful for understanding the full page hierarchy.
Inputs: namespace (required).
insert_nested_blockA
Insert a new block as a child or sibling of an existing block, enabling nested hierarchical structures
Inputs: content (required), parent_block_uuid (required), sibling, properties.
list_pagesA
Lists all pages in a LogSeq graph, each with its last-updated time (UTC). To find recently modified pages, use sort='updated' (most recent first) and/or updated_since.
Inputs: sort, limit, updated_since, include_journals.
queryB
Execute a Logseq DSL query to search pages and blocks. Supports property queries, tag queries, task queries, and logical combinations. Raw datalog ({:query ...} / [:find ...]) is not supported. See https://docs.logseq.com/#/page/queries for query syntax.
Inputs: query (required), limit, format, result_type.
rename_pageA
Rename an existing page. All references throughout the graph will be automatically updated.
Inputs: new_name (required), old_name (required).
searchC
Search for content across LogSeq pages, blocks, and files
Inputs: query (required), limit, format, include_files, +2 more.
set_block_propertiesA
Set properties on a block in Logseq DB-mode. Properties must be defined on the block's tag/class. Use property display names (e.g. 'Content status', not the internal ident).
Inputs: block_uuid (required), properties (required).
update_blockB
Update the content of an existing LogSeq block by UUID.
Inputs: content (required), block_uuid (required).
update_pageA
Update a page in Logseq with new content and/or properties.
Supports two modes:
append: Add new blocks after existing content (default)
replace: Clear all existing blocks and add new content
Markdown is parsed into proper block hierarchy just like create_page. YAML frontmatter in content will be merged with explicit properties.
Inputs: page_name (required), mode, content, properties.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 17 tools
Each tool targets a distinct resource and action: pages, blocks, search/query, namespaces, and properties. Overlaps like query vs find_pages_by_property are explicitly framed as simple alternatives, so an agent can choose correctly.
Mostly consistent verb_noun snake_case (list_pages, get_block, create_page), but 'query' and 'search' are bare verbs, a minor deviation from the pattern.
17 tools is slightly above the ideal 3-15 range for a cohesive set, though each covers a distinct operation. The count feels a bit heavy but not excessive for LogSeq's complexity.
Core CRUD for pages and blocks is covered, plus searching, querying, backlinks, and namespace navigation. Minor gaps remain (e.g., explicit block creation on a page, move/reorder operations), but agents can work around them.
Maintenance
Related MCP Connectors
Query your app's logs, metrics and incidents from your AI assistant.
Search, read, and safely update Markdown notes in your connected Phasoric knowledge vaults.
Notes, kanban tasks, and a capture inbox: read and create Flow data with a personal token.
MCP-native open-source Notion alternative: read & write pages, databases and kanban boards.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with your local Logseq knowledge base through advanced search, content creation, template management, and knowledge organization with privacy-first, local-only operations.23 npm7MIT
- AlicenseBqualityCmaintenanceEnables AI assistants like Claude to directly read, write, search, and navigate your local Logseq knowledge graph, including managing journals, pages, backlinks, and page relationships without manual copy-pasting.1110 npm6MIT
- AlicenseNot gradedqualityDmaintenanceEnables external AI assistants to interact with Logseq graphs through 34 specialized tools for managing pages, blocks, journals, and tasks via the local HTTP API.MIT
- AlicenseNot gradedqualityDmaintenanceConnects AI assistants to Logseq knowledge graphs to read, write, and search pages, blocks, and journals via the Model Context Protocol. It features 17 tools for full graph management, including CRUD operations, batch block insertion, and full-text search.23 npmApache 2.0