Logseq Knowledge Graph

by joelhooks

16 stars
467 downloads
Not rated
GitHub

About

Integrates with Logseq knowledge graphs to enable retrieval, analysis, and manipulation of personal knowledge bases through tools for page content access, journal summaries, connection analysis, and concept linking.

Details

Author
joelhooks
Repository
joelhooks/logseq-mcp-tools
GitHub stars
16
Downloads
467
License
Other
Categories
Productivity, Developer Tools, Design, AI, Search, Frontend, Knowledge Base
Tags
#visualization

- Retrieve a list of all Logseq pages
- Get content and backlinks for any page
- Generate journal summaries for flexible date ranges
- Create and search pages in your graph
- Analyze knowledge graph structure and gaps
- Suggest connections between pages using AI
- Execute natural language queries via DataScript

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Logseq Knowledge Graph
    Command (node, npx, python, etc.) npx
    Arguments
    • Argument 1 tsx
    • Argument 2 /path/to/your/index.ts

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

To install Logseq Tools for Claude Desktop automatically
via Smithery:

npx -y @smithery/cli install @joelhooks/logseq-mcp-tools --client claude

1. Clone this repository
2. Install dependencies using npm, yarn, or pnpm:


The server can be started using:


To run this project with JetBrains Junie, follow these steps:

Build the Docker image:

bash
docker build -t logseq-mcp .

getAllPages

Retrieves a list of all pages in your Logseq graph.

getPage

Gets the content of a specific page. Parameters: pageName (string) - The name of the page to retrieve.

getJournalSummary

Generates a summary of journal entries for a specified date range. Parameters: dateRange (string) - Natural language date range like 'today', 'this week', 'last month', 'this year', etc.

createPage

Creates a new page in your Logseq graph. Parameters: pageName (string) - Name for the new page, content (optional string) - Initial content for the page.

searchPages

Searches for pages by name. Parameters: query (string) - Search query to filter pages by name.

getBacklinks

Finds all pages that reference a specific page. Parameters: pageName (string) - The page name for which to find backlinks.

analyzeGraph

Performs a comprehensive analysis of your knowledge graph. Parameters: daysThreshold (optional number) - Number of days to look back for 'recent' content (default: 30).

findKnowledgeGaps

Analyzes your knowledge graph to identify potential gaps and areas for improvement. Parameters: minReferenceCount (optional number) - Minimum references to consider (default: 3), includeOrphans (optional boolean) - Include orphaned pages in analysis (default: true).

analyzeJournalPatterns

Analyzes patterns in your journal entries over time. Parameters: timeframe (optional string) - Time period to analyze (e.g., 'last 30 days', 'this year'), includeMood (optional boolean) - Analyze mood patterns if present (default: true), includeTopics (optional boolean) - Analyze topic patterns (default: true).

smartQuery

Executes natural language queries using Logseq's DataScript capabilities. Parameters: request (string) - Natural language description of what you want to find, includeQuery (optional boolean) - Include the generated Datalog query in results, advanced (optional boolean) - Use advanced analysis features.

suggestConnections

Uses AI to analyze your graph and suggest interesting connections. Parameters: minConfidence (optional number) - Minimum confidence score for suggestions (0-1, default: 0.6), maxSuggestions (optional number) - Maximum number of suggestions to return (default: 10), focusArea (optional string) - Topic or area to focus suggestions around.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "logseq knowledge graph": {
            "env": {},
            "args": [
                "tsx",
                "/path/to/your/index.ts"
            ],
            "shell": false,
            "command": "npx"
        }
    }
}

Linux

{
    "env": [],
    "args": [
        "tsx",
        "/path/to/your/index.ts"
    ],
    "shell": false,
    "command": "npx"
}

Macos

{
    "env": [],
    "args": [
        "tsx",
        "/path/to/your/index.ts"
    ],
    "shell": false,
    "command": "npx"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "npx",
        "tsx",
        "/path/to/your/index.ts"
    ],
    "command": "cmd"
}

Logseq MCP Tools

smithery badge

A Model Context Protocol (MCP) server that provides AI assistants with structured access to your Logseq knowledge graph.

Overview

This project creates an MCP server that allows AI assistants like Claude to interact with your Logseq knowledge base. It
provides tools for:

- Retrieving a list of all pages
- Getting content from specific pages
- Generating journal summaries for flexible date ranges
- Extracting linked pages and exploring connections

Installation

Installing via Smithery

To install Logseq Tools for Claude Desktop automatically
via Smithery:

npx -y @smithery/cli install @joelhooks/logseq-mcp-tools --client claude

1. Clone this repository
2. Install dependencies using npm, yarn, or pnpm:

# Using npm
npm install

Using yarn

yarn install

Using pnpm

pnpm install

3. Copy the environment template and configure your Logseq token:

cp .env.template .env

Edit .env with your Logseq authentication token

Configuration

This project includes a .env.template file that you can copy and rename to .env.

You can find your Logseq auth token by:

1. Opening Logseq
2. Enabling the HTTP API in Settings > Features > Enable HTTP API
3. Setting your authentication token in Settings > Features > HTTP API Authentication Token

Usage

Running the MCP Server

The server can be started using:

# Using the npm script
npm start

Or directly with tsx

npx tsx index.ts

Connecting with Claude

Claude Desktop

Follow the Claude MCP Quickstart guide:

1. Important: Install Node.js globally via Homebrew (or whatever):

brew install node

2. Install the Claude desktop app
3. Open the Claude menu and select "Settings..."
4. Click on "Developer" in the left sidebar, then click "Edit Config"
5. This will open your 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)

6. Save the file and restart Claude Desktop

Now you can chat with Claude and ask it to use your Logseq data:

- "Show me my recent journal entries"
- "Summarize my notes from last week"
- "Find all pages related to [topic]"

Claude in Cursor

Follow the Cursor MCP documentation:

1. Open Cursor
2. Add a new MCP service from settings
3. Enter the following command:

npx tsx "/path/to/index.ts"

4. Give your service a name like "Logseq Tools"

Now you can use Claude in Cursor with your Logseq data.

Claude in Anthropic API (generic)

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"

Jetbrains Junie Setup

To run this project with JetBrains Junie, follow these steps:

Build the Docker image:

docker build -t logseq-mcp .

run in project root

Then add the following config to your Junie MCP configuration:

    "logseq": {
      "command": "c:\\Program Files\\Docker\\Docker\\resources\\bin\\docker.exe",
      "args": [
        "run",
        "-i",
        "--rm",
        "--network=host",
        "-e",
        "LOGSEQ_TOKEN=<Your Token>",
        "-e",
        "LOGSEQ_HOST=host.docker.internal",
        "logseq-mcp"
      ]
    }

Available Tools

getAllPages

Retrieves a list of all pages in your Logseq graph.

getPage

Gets the content of a specific page.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.