MCP Logseq Knowledge Base
Provides tools for searching notes, reading pages, querying tags, reading journal date ranges, and consolidating project notes from a local Logseq graph.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MCP Logseq Knowledge Base
A Model Context Protocol (MCP) server that enables AI assistants to interact with Logseq knowledge base files. This server provides tools for searching notes, reading pages, querying by tags, and consolidating project information.
Features
Full-text search across all Logseq pages with context-aware results
Page retrieval by name to read complete note contents
Tag-based queries to find pages by hashtags
Journal navigation with date range filtering
Project consolidation to aggregate all notes tagged with a project tag
Smart caching with incremental index updates for optimal performance
Incremental indexing that only re-reads changed files
Related MCP server: Logseq MCP Server
Available Tools
Tool | Description |
| Full-text search across all Logseq pages |
| Read a specific Logseq page by name |
| List all pages in a folder (pages, journals, or all) |
| Find all pages containing a specific |
| Read journal entries between dates (YYYY-MM-DD) |
| Aggregate all notes tagged with a project tag |
| Get a list of all tags used in the knowledge base |
| Force a full re-scan of the Logseq graph |
Installation
Prerequisites
Python 3.10 or higher
Poetry for dependency management
A Logseq graph directory
Setup
Clone the repository:
git clone <repository-url> cd mcp-python-logseqInstall dependencies with Poetry:
poetry install
Configure with Claude Code
Add this MCP server to Claude Code using one of these methods:
Method 1: Using claude mcp add
claude mcp add logseq \
-e LOGSEQ_DIR="~/logseq-graph" \
-e CACHE_TTL=300 \
-- poetry run python /path/to/mcp-python-logseq/server.pyMethod 2: Using fastmcp install
poetry run fastmcp install claude-code server.py \
--server-name "logseq" \
--env LOGSEQ_DIR=~/logseq-graph \
--env CACHE_TTL=300Configure with Other MCP Clients
Add the following to your MCP client configuration:
{
"mcpServers": {
"logseq": {
"command": "poetry",
"args": [
"run",
"python",
"/path/to/mcp-python-logseq/server.py"
],
"env": {
"LOGSEQ_DIR": "~/logseq-graph",
"CACHE_TTL": "300"
}
}
}
}Environment Variables
Variable | Description | Default |
| Path to your Logseq graph directory |
|
| Cache time-to-live in seconds |
|
Usage Examples
Search for Notes
"Search my notes for 'machine learning'"The AI will use search_notes("machine learning") to find relevant content.
Read a Specific Page
"Show me my notes on the Python project"The AI will use get_page("Python project") to retrieve the page content.
Query by Tag
"What notes do I have tagged with #work?"The AI will use get_pages_by_tag("work") to list all matching pages.
Journal Entries
"Show me journal entries from last week"The AI will use get_journal_range("2025-03-25", "2025-03-31") to retrieve entries.
Project Consolidation
"Summarize all my notes for the website redesign project"The AI will use consolidate_project("website-redesign") to gather all related notes.
Architecture
The server is built on:
FastMCP: A high-level Python library for building MCP servers
LogseqIndex: A custom indexing class that:
Scans
.mdfiles in the Logseq directoryExtracts metadata (tags, modification times)
Implements incremental updates for efficiency
Caches results to minimize I/O operations
Indexing Strategy
The LogseqIndex uses a two-tier caching strategy:
File Index Cache: Incrementally updates based on file modification times
Full directory scan every
CACHE_TTLseconds to detect new/deleted filesFast path for checking only known files between scans
Result Cache: Caches tool outputs with configurable TTL per tool
Search results: 5 minutes
Page content: 1 minute
Project consolidation: 10 minutes
Development
Project Structure
.
├── server.py # Main MCP server implementation
├── pyproject.toml # Poetry configuration
├── README.md # This file
├── doc.md # Installation guide
├── fastmcp_documentation.md # FastMCP reference
└── command.txt # Example CLI commandsRunning Locally
# Set environment variables
export LOGSEQ_DIR="~/Documents/MyLogseqGraph"
export CACHE_TTL=300
# Run the server
poetry run python server.pyTesting with MCP Inspector
npx @modelcontextprotocol/inspector poetry run python server.pyRequirements
Python >= 3.10, < 4.0
fastmcp >= 3.1.1, < 4.0.0
See pyproject.toml for full dependency specifications.
License
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See LICENSE for details.
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
Acknowledgments
Built with FastMCP by Josh Fell
Inspired by the Model Context Protocol specification
Created for integration with Logseq personal knowledge management
Note: This is a community project and is not officially affiliated with Logseq or Anthropic.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Personal wiki and memory layer for AI assistants. Persistent, structured memory across sessions.
Persistent memory and knowledge graph for AI assistants — keyword + vector + graph search.
Search and reason over your Obsidian-style Markdown vault, right from ChatGPT.
Personal context for every AI: search, read, and write back to your private Markdown library.
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.39 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.119 npm6MIT
- 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.Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to query and interact with a graph database of markdown notes, extracting entities like wikilinks, mentions, and hashtags.MIT