Logseq MCP Tools
STDIOMCP server providing AI assistants with structured access to Logseq knowledge graph.
MCP server providing AI assistants with structured access to Logseq knowledge graph.
A Model Context Protocol (MCP) server that provides AI assistants with structured access to your Logseq knowledge graph.
This project creates an MCP server that allows AI assistants like Claude to interact with your Logseq knowledge base. It provides tools for:
To install Logseq Tools for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @joelhooks/logseq-mcp-tools --client claude
# Using npm npm install # Using yarn yarn install # Using pnpm pnpm install
cp .env.template .env # Edit .env with your Logseq authentication token
This project includes a .env.template
file that you can copy and rename to .env
.
You can find your Logseq auth token by:
The server can be started using:
# Using the npm script npm start # Or directly with tsx npx tsx index.ts
Follow the Claude MCP Quickstart guide:
brew install node
claude_desktop_config.json
file. Replace its contents with:{ "mcpServers": { "logseq": { "command": "npx", "args": ["tsx", "/path/to/your/index.ts"] } } }
IMPORTANT: Replace /path/to/your/index.ts
with the exact absolute path to your index.ts file (e.g., /Users/username/Code/logseq-mcp-tools/index.ts
)
Now you can chat with Claude and ask it to use your Logseq data:
Follow the Cursor MCP documentation:
npx tsx "/path/to/index.ts"
Now you can use Claude in Cursor with your Logseq data.
When using the Claude API or CLI tools, you can add the MCP service with:
claude mcp add "logseq" npx tsx "/path/to/index.ts"
Retrieves a list of all pages in your Logseq graph.
Gets the content of a specific page.
Parameters:
pageName
: The name of the page to retrieveGenerates a summary of journal entries for a specified date range.
Parameters:
dateRange
: Natural language date range like "today", "this week", "last month", "this year", etc.This tool will:
Creates a new page in your Logseq graph.
Parameters:
pageName
: Name for the new pagecontent
: (Optional) Initial content for the pageSearches for pages by name.
Parameters:
query
: Search query to filter pages by nameFinds all pages that reference a specific page.
Parameters:
pageName
: The page name for which to find backlinksPerforms a comprehensive analysis of your knowledge graph.
Parameters:
daysThreshold
: (Optional) Number of days to look back for "recent" content (default: 30)Features:
Analyzes your knowledge graph to identify potential gaps and areas for improvement.
Parameters:
minReferenceCount
: (Optional) Minimum references to consider (default: 3)includeOrphans
: (Optional) Include orphaned pages in analysis (default: true)Features:
Analyzes patterns in your journal entries over time.
Parameters:
timeframe
: (Optional) Time period to analyze (e.g., "last 30 days", "this year")includeMood
: (Optional) Analyze mood patterns if present (default: true)includeTopics
: (Optional) Analyze topic patterns (default: true)Features:
Executes natural language queries using Logseq's DataScript capabilities.
Parameters:
request
: Natural language description of what you want to findincludeQuery
: (Optional) Include the generated Datalog query in resultsadvanced
: (Optional) Use advanced analysis featuresFeatures:
Uses AI to analyze your graph and suggest interesting connections.
Parameters:
minConfidence
: (Optional) Minimum confidence score for suggestions (0-1, default: 0.6)maxSuggestions
: (Optional) Maximum number of suggestions to return (default: 10)focusArea
: (Optional) Topic or area to focus suggestions aroundFeatures:
The server is built using:
To extend with new tools, add additional server.tool()
definitions in index.ts
.
If you're using a Node.js version manager like fnm or nvm, Claude Desktop won't be able to access the Node.js binaries properly, as it runs outside of your shell environment where the PATH is modified.
Solution: Install a system-wide Node.js with Homebrew:
brew install node
This ensures Node.js is available to all applications, including Claude Desktop.
.env
matches the one set in Logseqnpx tsx index.ts
directly in your terminal to verify it worksMonitor logs in real-time:
# macOS tail -n 20 -F ~/Library/Logs/Claude/mcp*.log
For more detailed debugging information, refer to the official MCP debugging documentation.