Enables AI assistants to interact with Logseq knowledge bases through advanced search, content retrieval, page and block editing, template management, property handling, and safe content deletion operations.
Click on "Install 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., "@Logseq MCP Serversearch for notes about project planning from last month"
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.
Logseq MCP - AI-Powered Knowledge Base Integration
Model Context Protocol (MCP) server that enables AI assistants to seamlessly interact with your Logseq knowledge base. Transform your personal notes into an AI-powered workspace with advanced search, content creation, and knowledge management capabilities.
β¨ Features
π Instant AI Integration - Connect any MCP-compatible AI to your Logseq graph
π Privacy First - All operations are local-only, no data leaves your machine
π― 4 Intuitive Tools - Unified Search/Get/Edit/Delete architecture for maximum clarity
π Advanced Search - Multi-modal discovery with templates, properties, relations, and date filters
π¨ Template System - Single-block template enforcement with proper variable substitution
β‘ Enterprise Features - Built with caching, monitoring, security, and idempotency controls
π Universal Compatibility - Works with Claude, ChatGPT, and other AI assistants
π οΈ Installation
Requirements
Node.js >= v18.0.0
Logseq with HTTP API enabled
MCP-compatible AI client (Claude Desktop, VS Code, Cursor, etc.)
One-Command Install
π Quick Setup (3 Steps)
Step 1: Configure Logseq
Enable HTTP API: Settings β Features β HTTP APIs server
Generate API Token: API β Authorization tokens β Add new token
Start server
Step 2: Choose Your AI Client
Method 1: Configuration File (Recommended)
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
After saving: Completely restart Claude Desktop
Method 2: Terminal Command
macOS/Linux:
Windows (PowerShell):
Method 1: Environment Setup
Method 2: Configuration File
Create or edit your Claude Code MCP configuration:
Method 1: Settings UI
Open VS Code Settings (Ctrl/Cmd + ,)
Search for "MCP"
Add new server with these settings:
Name:
logseqCommand:
npxArgs:
["logseq-mcp-server-server"]Environment:
LOGSEQ_API_URL=http://127.0.0.1:12315,LOGSEQ_API_TOKEN=your-api-token-here
Method 2: Settings JSON
macOS: ~/Library/Application Support/Code/User/settings.json
Windows: %APPDATA%\Code\User\settings.json
Method 3: Terminal Command
macOS:
Windows (PowerShell):
Method 1: Configuration File (Recommended)
macOS: ~/.cursor/mcp.json
Windows: %USERPROFILE%\.cursor\mcp.json
Method 2: Terminal Command
macOS/Linux:
Windows (PowerShell):
Method 1: Configuration File
macOS: ~/Library/Application Support/Windsurf/mcp.json
Windows: %APPDATA%\Windsurf\mcp.json
Method 2: Terminal Command
macOS:
Windows (PowerShell):
Add to your Continue configuration:
Add to your Zed settings:
Add to your VS Code settings.json (Cline reads the standard MCP servers map):
Run the Inspector and connect to this server locally:
Raycast AI has been rolling out MCP support. If your build exposes MCP server configuration, you can add this server similarly to the examples above (command npx, args ["logseq-mcp-server"], and the two environment variables). If you donβt see MCP settings, this may not be available in your version yet.
Method 1: Direct Command
For any MCP-compatible client, run directly:
Method 2: Standard MCP Configuration
Most MCP clients support this standard format:
Step 3: Start Using
That's it! Your AI assistant now has access to your Logseq knowledge base through 4 powerful tools.
π§ Available Tools
Logseq MCP provides 4 unified tools that handle all your knowledge base operations:
π search - Advanced Multi-Modal Discovery
Find content across your entire graph with sophisticated filtering:
Template Discovery:
templates:*to list all templatesProperty Search:
property:status=open AND date:last-weekRelationship Analysis:
backlinks:"Important Topic"Date-Based Queries:
date:today,date:last-monthCombined Filters: Complex AND/OR/NOT queries
π get - Unified Content Retrieval
Retrieve detailed information with full context:
Pages: Complete content with backlinks and graph metrics
Blocks: Hierarchical content with parent-child relationships
Templates: Template definitions with variable analysis
Properties: Page/block metadata and property schemas
Relations: Graph connections and relationship analysis
System: Health status and graph statistics
βοΈ edit - Comprehensive Content Management
Create, modify, and organize your knowledge:
Pages: Create, update, append, prepend content
Blocks: Positional operations with precise placement
Templates: Single-block enforcement with variable substitution
Properties: Metadata management and validation
Relations: Bi-directional link creation and updates
Safety: Dry-run mode, validation, and rollback support;
confirmDestroy: truerequired foroperation: "remove";control.maxOpsenforced to prevent large accidental edits
Notes:
Properties: When targeting a page, the operation resolves to the pageβs root block UUID. The page must already exist (no implicit creation).
Templates: Creation enforces the Logseq single-block template standard (single root block with content inserted as children when needed). Template insertion is append-only and requires an existing target page.
ποΈ delete - Safe Content Removal
Remove content with comprehensive safety controls:
Impact Analysis: Preview what will be affected before deletion
Confirmation Required: Explicit
confirmDestroy: truefor safetySoft Delete: Move to trash instead of permanent removal
Dependency Tracking: Handle orphaned references and relationships
π‘ Example Usage
Basic Operations
Advanced Workflows
Template System
π― Key Features
Revolutionary 4-Tool Architecture
Simplified AI Selection: Instead of 15+ confusing micro-tools, choose from 4 clear action verbs
Consistent Interface: All tools follow the same parameter patterns and response formats
Type Safety: Comprehensive validation with helpful error messages
Production Ready: Built with monitoring, caching, and reliability features
Advanced Search Capabilities
Multi-Modal Discovery: Search across pages, blocks, templates, tasks simultaneously
Sophisticated Filtering: Date ranges, properties, tags, relationships, content length
Cursor-Based Pagination: Handle large result sets efficiently (up to 100 items per page)
Query Intelligence: Automatic query type detection and optimization
Template System Excellence
Single-Block Enforcement: Templates must be single blocks (Logseq standard compliance)
Variable Substitution: Full
{{variableName}}placeholder support with validationTemplate Discovery: Easy finding and application of existing templates
Creation Validation: Automatic format checking and error prevention
Enterprise-Grade Safety
Idempotency Controls: Prevent duplicate operations with safe retry mechanisms
Dry-Run Mode: Preview all operations before execution
Confirmation Prompts: Required confirmation for destructive operations
Impact Analysis: Comprehensive dependency tracking and orphan detection
Soft Delete: Recovery options for accidental deletions
π Performance Features
Intelligent Caching System
Page Content: 5-minute TTL with smart invalidation
Graph Structure: 3-minute TTL with relationship tracking
Search Results: Optimized caching for repeated queries
Template Library: Persistent caching for faster template discovery
Connection Management
HTTP Connection Pooling: Efficient request handling
Automatic Retry Logic: Exponential backoff for reliability
Request Deduplication: Prevent duplicate concurrent operations
Timeout Management: Configurable timeouts for different operation types
Monitoring & Observability
Real-time Metrics: Operation timing, cache hit rates, error tracking
Structured Logging: Production-ready logs with sensitive data redaction
Health Monitoring: Automatic system status checks
Rate Limiting: Protection against abuse with configurable limits
π Security & Privacy
Privacy-First Design
Local-Only Operations: No data transmission to external servers
API Token Security: Tokens never logged or exposed
Input Sanitization: Comprehensive validation of all user inputs
Error Sanitization: Sensitive information stripped from error messages
Built-in Protections
Rate Limiting: Configurable protection against abuse
Content Validation: Automatic detection and prevention of malicious content
Secure Defaults: Conservative security settings out of the box
GDPR Compliance: No data collection or external transmission
π Troubleshooting
Common Issues
Problem | Solution |
Connection Refused | Ensure Logseq is running with HTTP API enabled |
Unauthorized | Check your API token and regenerate if needed |
Slow Performance | Increase timeout settings or check network connectivity |
Template Errors | Ensure templates are single blocks (Logseq requirement) |
Server Won't Start | Try |
Cache Issues | Use |
Getting the Latest Version
If you're experiencing issues, make sure you're running the latest version:
Debug Mode
Environment Variables
π Documentation
API Reference - Complete tool documentation with examples
Configuration Guide - Detailed setup and customization options
Changelog - Version history and release notes
π€ Contributing
We welcome contributions! Here's how to get started:
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Make your changes with tests
Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
Development Setup
π Community
GitHub Issues: Report bugs and request features
GitHub Discussions: Ask questions and share ideas
Documentation: Comprehensive guides and examples
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
Built with the Model Context Protocol SDK
Powered by Logseq's HTTP API
Inspired by the growing ecosystem of AI-powered knowledge management tools
Special thanks to the Logseq community for their continuous feedback and support
Transform your Logseq knowledge base into an AI-powered workspace