MCP Hub
Back to servers

Logseq MCP Server

Connects 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.

glama
Updated
Feb 7, 2026

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

VariableRequiredDefaultDescription
LOGSEQ_API_TOKENYes-Bearer token from Logseq HTTP API
LOGSEQ_API_URLNohttp://127.0.0.1:12315Logseq HTTP API URL
TRANSPORTNostdioTransport mode: stdio or http
PORTNo3000HTTP 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

ToolDescription
logseq_list_pagesList pages with filtering (journal, namespace) 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 (updates all references)
logseq_get_page_linked_referencesGet backlinks - pages and blocks that reference a page

Blocks

ToolDescription
logseq_get_blockGet a block by UUID with optional children
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 (supports nesting)
logseq_block_propertyRead or write a single block property

Search & Graph

ToolDescription
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

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

Reviews

No reviews yet

Sign in to write a review