Logseq MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add -e "LOGSEQ_API_TOKEN=${LOGSEQ_API_TOKEN}" logseq -- npx logseq-mcp-server
Required:LOGSEQ_API_TOKEN+ 3 optional
README.md

Connects AI assistants to Logseq knowledge graphs via the Model Context Protocol.

logseq-mcp-server

A TypeScript Model Context Protocol (MCP) server that connects AI assistants to your Logseq knowledge graph. Read, write, search, and manage pages, blocks, journals, and tags through the MCP protocol.

Features

  • 17 tools covering Pages, Blocks, Search, Journals, and Graph operations
  • Full CRUD for pages and blocks
  • Full-text search across the graph
  • Batch block insertion with nested children
  • Block property management
  • Backlink (linked references) retrieval
  • Journal page creation and tag listing
  • Dual transport: stdio (local) and HTTP (Hono-based, portable across runtimes)

Prerequisites

  1. Logseq installed and running
  2. HTTP APIs server enabled in Logseq:
    • Settings > Features > Enable "HTTP APIs server"
    • Click the API button > "Start server"
    • Generate a token: API panel > Authorization tokens
  3. Node.js >= 18

Quick Start

Claude Desktop

Add to Settings > Developer > Edit Config:

{
  "mcpServers": {
    "logseq": {
      "command": "npx",
      "args": ["logseq-mcp-server"],
      "env": {
        "LOGSEQ_API_TOKEN": "your_token_here"
      }
    }
  }
}

Claude Code

claude mcp add logseq-mcp-server \
  --env LOGSEQ_API_TOKEN=your_token_here \
  -- npx logseq-mcp-server

From Source

git clone https://github.com/user/logseq-mcp-server.git
cd logseq-mcp-server
npm install
npm run build
LOGSEQ_API_TOKEN=your_token npm start

Environment Variables

Variable Required Default Description
LOGSEQ_API_TOKEN Yes - Bearer token from Logseq HTTP API
LOGSEQ_API_URL No http://127.0.0.1:12315 Logseq HTTP API URL
TRANSPORT No stdio Transport mode: stdio or http
PORT No 3000 HTTP port (when TRANSPORT=http)

HTTP Transport

When running with TRANSPORT=http, the server uses Hono with WebStandardStreamableHTTPServerTransport from the MCP SDK.

LOGSEQ_API_TOKEN=your_token TRANSPORT=http PORT=3000 npm start

Endpoints:

  • POST|GET|DELETE /mcp - MCP Streamable HTTP protocol
  • GET /health - Health check
curl http://localhost:3000/health
# {"status":"ok","server":"logseq-mcp-server"}

Available Tools

Pages

Tool Description
logseq_list_pages List pages with filtering (journal, namespace) and pagination
logseq_get_page Get page metadata by name or UUID
logseq_get_page_content Get full block tree rendered as indented Markdown
logseq_create_page Create a new page with optional initial content and properties
logseq_delete_page Permanently delete a page
logseq_rename_page Rename a page (updates all references)
logseq_get_page_linked_references Get backlinks - pages and blocks that reference a page

Blocks

Tool Description
logseq_get_block Get a block by UUID with optional children
logseq_insert_block Insert a block relative to a page or block
logseq_append_block Append a block at the end of a page
logseq_update_block Update block content and properties
logseq_remove_block Permanently remove a block
logseq_move_block Move a block to a new position
logseq_insert_batch_blocks Insert multiple blocks at once (supports nesting)
logseq_block_property Read or write a single block property

Search & Graph

Tool Description
logseq_search Full-text search across pages and blocks
logseq_create_journal Create a journal page for a specific date
logseq_get_graph_info Get current graph name and path
logseq_get_all_tags List all tags in the graph

Architecture

src/
├── index.ts              # Entry point, server init, transport selection
├── constants.ts          # Shared constants
├── types.ts              # TypeScript type definitions
├── schemas/
│   └── index.ts          # Zod input validation schemas
├── services/
│   ├── logseq-client.ts  # Logseq HTTP API client
│   └── formatters.ts     # Response formatting helpers
└── tools/
    ├── page-tools.ts     # Page CRUD tools
    ├── block-tools.ts    # Block CRUD tools
    └── search-graph-tools.ts  # Search, journal, graph tools
MCP Client (Claude, etc.)
    ↓ stdio or HTTP
MCP Server (index.ts, Hono)
    ↓ registers tool groups
Tools (page-tools, block-tools, search-graph-tools)
    ↓ calls service methods
LogseqClient (logseq-client.ts)
    ↓ POST /api { method, args }
Logseq HTTP API (local instance)

Development

npm install        # Install dependencies
npm run build      # Compile TypeScript
npm run dev        # Watch mode (tsc --watch)
npm run inspect    # Test with MCP Inspector

License

Apache-2.0

Tools (19)

logseq_list_pagesList pages with filtering and pagination
logseq_get_pageGet page metadata by name or UUID
logseq_get_page_contentGet full block tree rendered as indented Markdown
logseq_create_pageCreate a new page with optional initial content and properties
logseq_delete_pagePermanently delete a page
logseq_rename_pageRename a page and update all references
logseq_get_page_linked_referencesGet backlinks for a page
logseq_get_blockGet a block by UUID
logseq_insert_blockInsert a block relative to a page or block
logseq_append_blockAppend a block at the end of a page
logseq_update_blockUpdate block content and properties
logseq_remove_blockPermanently remove a block
logseq_move_blockMove a block to a new position
logseq_insert_batch_blocksInsert multiple blocks at once
logseq_block_propertyRead or write a single block property
logseq_searchFull-text search across pages and blocks
logseq_create_journalCreate a journal page for a specific date
logseq_get_graph_infoGet current graph name and path
logseq_get_all_tagsList all tags in the graph

Environment Variables

LOGSEQ_API_TOKENrequiredBearer token from Logseq HTTP API
LOGSEQ_API_URLLogseq HTTP API URL
TRANSPORTTransport mode: stdio or http
PORTHTTP port when TRANSPORT=http

Configuration

claude_desktop_config.json
{"mcpServers": {"logseq": {"command": "npx", "args": ["logseq-mcp-server"], "env": {"LOGSEQ_API_TOKEN": "your_token_here"}}}}

Try it

Search my Logseq graph for all notes related to 'project alpha' and summarize them.
Create a new journal entry for today and add a block with my daily tasks.
Find the page 'Meeting Notes' and list all blocks that reference it.
Rename the page 'Draft' to 'Final Version' and update all links.
List all tags currently used in my knowledge graph.

Frequently Asked Questions

What are the key features of Logseq?

Full CRUD operations for pages and blocks. Full-text search across the entire knowledge graph. Batch block insertion with support for nested children. Backlink and linked reference retrieval. Dual transport support via stdio and HTTP.

What can I use Logseq for?

Automating the creation of daily journal entries with pre-filled task lists.. Refactoring knowledge graph structure by renaming pages and updating references.. Querying complex research notes across multiple pages using AI-assisted search.. Batch importing structured data or meeting notes into Logseq blocks..

How do I install Logseq?

Install Logseq by running: npx logseq-mcp-server

What MCP clients work with Logseq?

Logseq works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Logseq docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare