Logseq API MCP Server logo

Logseq API MCP Server

Community
gustavo-meilus

A MCP server that uses Logseq API to extract and interact with Logseq notes.

Publishergustavo-meilus
Repositorylogseq-api-mcp
LanguagePython
Forks
9
Stars
30
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Logseq API MCP Server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    30 stars and 9 forks from the linked repository.

logseq-api-mcp

Your AI assistant starts every session blind to your Logseq knowledge graph. logseq-api-mcp fixes that: 21 tools to read, write, query, and search your notes — auto-registered the moment you drop a Python file into src/tools/.

Python License: MIT CI Coverage Tests Stars


Quick Start

Step 1 — Install

bash
git clone https://github.com/gustavo-meilus/logseq-api-mcp.git
cd logseq-api-mcp
uv sync

Step 2 — Configure

bash
cp .env.template .env
# open .env and set LOGSEQ_API_ENDPOINT and LOGSEQ_API_TOKEN

Getting your token: open Logseq, go to Settings → Features → Developer mode, enable HTTP APIs server, and copy the token shown. The default endpoint is http://127.0.0.1:12315/api.

Step 3 — Connect

jsonc
// ~/.claude/claude_desktop_config.json
{
  "mcpServers": {
    "logseq-api": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/logseq-api-mcp", "python", "src/server.py"],
      "env": {
        "LOGSEQ_API_ENDPOINT": "http://127.0.0.1:12315/api",
        "LOGSEQ_API_TOKEN": "your_token_here"
      }
    }
  }
}

Restart Claude Desktop. All 21 tools are live.


Tools

Read (12 tools)

ToolWhat it does
get_all_pagesEvery page with ID, UUID, journal flag, and namespace
get_page_blocksHierarchical block tree with IDs, UUIDs, and child counts
get_page_linksPages linking to a target page
get_page_backlinksFull backlink analysis including block-level references
get_block_contentBlock detail with properties and immediate children
get_all_page_contentComplete page: properties, blocks, DB refs expanded
get_linked_flashcardsQ&A flashcard pairs from a page and all linked pages
searchFull-text search across blocks, pages, and file names
queryRaw Datalog / DSL queries against the graph
find_pages_by_propertyFilter pages by property key and optional value
get_pages_from_namespaceAll pages under a Logseq namespace
get_pages_tree_from_namespaceNested tree of namespace pages

Write (10 tools)

ToolWhat it does
create_pageCreate a page with optional properties and format
delete_pageRemove a page permanently
rename_pageRename a page and update all references
update_pageAppend or replace content on an existing page
append_block_in_pageAdd blocks at the end of a page
edit_blockReplace a block's content by UUID
update_blockUpdate block content by UUID
insert_nested_blockInsert a child or sibling block relative to another block
delete_blockDelete a block by UUID
set_block_propertiesSet structured properties on a block (DB-mode only)

Configuration

VariableDefaultDescription
LOGSEQ_API_ENDPOINThttp://127.0.0.1:12315/apiLogseq HTTP API base URL
LOGSEQ_API_TOKEN(required)Bearer auth token
LOGSEQ_VERIFY_SSLtrueSet false to skip TLS verification
LOGSEQ_DB_MODEfalseEnable Logseq database-format API paths
LOGSEQ_EXCLUDE_TAGS(empty)Comma-separated tags — pages with any tag are hidden
LOGSEQ_LOG_LEVELWARNINGLog level: DEBUG, INFO, WARNING, ERROR

DB-Mode

Logseq's newer database format stores graph data in SQLite rather than markdown files. Set LOGSEQ_DB_MODE=true to unlock set_block_properties, UUID-reference resolution in get_all_page_content, and Datalog-powered queries in find_pages_by_property. Tools that do not apply in DB-mode return a clear error rather than silently failing.


Privacy

Any page tagged with a tag from LOGSEQ_EXCLUDE_TAGS disappears from every read operation. Enforcement runs at query time, so toggling the variable takes effect immediately.

OperationBehavior when page is excluded
get_all_pagesExcluded pages absent from the listing
searchExcluded pages and their blocks stripped from results
queryResults post-filtered against excluded page names
find_pages_by_propertyResults post-filtered
get_page_backlinksExcluded source pages removed
get_all_page_contentReturns ❌ Access denied for the excluded page

Adding a Tool

Create src/tools/my_tool.py. No imports, no registration, no config changes needed. The discovery system picks it up on the next server start.

python
from typing import List
from mcp.types import TextContent
from src.client.logseq_client import LogseqClient
from src.client.config import LogseqConfig, load_config
from src.logging_setup import get_logger

_log = get_logger(__name__)

async def _run(
    client: LogseqClient, config: LogseqConfig, param: str
) -> List[TextContent]:
    try:
        _log.debug("%s called", __name__)
        result = await client.some_api_method(param)
        return [TextContent(type="text", text=str(result))]
    except Exception as exc:
        _log.error("exception in %s: %s", __name__, exc, exc_info=True)
        return [TextContent(type="text", text=f"❌ Error: {exc}")]

async def my_tool(param: str) -> List[TextContent]:
    """One-line description — this becomes the MCP tool description."""
    cfg = load_config()
    return await _run(LogseqClient(cfg), cfg, param)

The _run(client, config, ...) pattern keeps the logic testable via FakeLogseqClient in tests/conftest.py. Function names starting with _ are not registered.


Development

bash
uv sync --dev                                                        # all deps
uv run --group test pytest tests/ -v                                 # test suite (345 tests)
uv run --group test pytest tests/ --cov=src --cov-fail-under=85      # coverage gate
uv run ruff check --fix && uv run ruff format                        # lint + format
uv run mypy src/ --ignore-missing-imports                            # type check
uv run bandit -r src/                                                # security scan
uv run mcp dev src/server.py                                         # MCP inspector

Star History

Star History Chart


License

MIT — see LICENSE.


Made for the Logseq and MCP communities.

Installation

TypingMind
{
  "mcpServers": {
    "logseq-api-mcp": {
      "command": "uv",
      "args": [
        "run",
        "mcp",
        "run",
        "src/server.py"
      ]
    }
  }
}

Use Logseq API MCP Server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Logseq API MCP Server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Logseq API MCP Server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Logseq API MCP Server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "logseq-api-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Logseq API MCP Server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Logseq API MCP Server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Logseq API MCP Server to help me with this task?
Logseq API MCP Server
Sure. I read it.
Here is what I found using Logseq API MCP Server.

Frequently asked questions

What is the Logseq API MCP Server MCP server used for?

Logseq API MCP Server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Logseq API MCP Server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Logseq API MCP Server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Logseq API MCP Server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Logseq API MCP Server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Logseq API MCP Server MCP to TypingMind?

Logseq API MCP Server runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Logseq API MCP Server MCP provide in TypingMind?

Logseq API MCP Server exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Logseq API MCP Server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Logseq API MCP Server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇