connecting-to-logseq
Manages connections to Logseq graphs via HTTP API, CLI, or MCP Server. Auto-invokes when users mention connecting to Logseq, API tokens, graph paths, connection issues, or backend configuration. Handles backend detection, environment setup, and connectivity troubleshooting.
Best use case
connecting-to-logseq is best used when you need a repeatable AI agent workflow instead of a one-off prompt. It is especially useful for teams working in multi. Manages connections to Logseq graphs via HTTP API, CLI, or MCP Server. Auto-invokes when users mention connecting to Logseq, API tokens, graph paths, connection issues, or backend configuration. Handles backend detection, environment setup, and connectivity troubleshooting.
Manages connections to Logseq graphs via HTTP API, CLI, or MCP Server. Auto-invokes when users mention connecting to Logseq, API tokens, graph paths, connection issues, or backend configuration. Handles backend detection, environment setup, and connectivity troubleshooting.
Users should expect a more consistent workflow output, faster repeated execution, and less time spent rewriting prompts from scratch.
Practical example
Example input
Use the "connecting-to-logseq" skill to help with this workflow task. Context: Manages connections to Logseq graphs via HTTP API, CLI, or MCP Server. Auto-invokes when users mention connecting to Logseq, API tokens, graph paths, connection issues, or backend configuration. Handles backend detection, environment setup, and connectivity troubleshooting.
Example output
A structured workflow result with clearer steps, more consistent formatting, and an output that is easier to reuse in the next run.
When to use this skill
- Use this skill when you want a reusable workflow rather than writing the same prompt again and again.
When not to use this skill
- Do not use this when you only need a one-off answer and do not need a reusable workflow.
- Do not use it if you cannot install or maintain the related files, repository context, or supporting tools.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/connecting-to-logseq/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How connecting-to-logseq Compares
| Feature / Agent | connecting-to-logseq | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Manages connections to Logseq graphs via HTTP API, CLI, or MCP Server. Auto-invokes when users mention connecting to Logseq, API tokens, graph paths, connection issues, or backend configuration. Handles backend detection, environment setup, and connectivity troubleshooting.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Connecting to Logseq
## When to Use This Skill
This skill auto-invokes when:
- User wants to connect Claude to their Logseq graph
- Setting up Logseq integration or API tokens
- Troubleshooting connection issues
- Configuring graph paths or backends
- User mentions "connect to logseq", "logseq api", "logseq token"
- Questions about HTTP API, CLI, or MCP server setup
**Setup Scripts**: See `{baseDir}/scripts/` for initialization utilities.
## Available Backends
| Backend | Requires Logseq Running | Read | Write | Best For |
|---------|------------------------|------|-------|----------|
| HTTP API | Yes | Full | Full | Real-time, interactive |
| CLI | No | Full | Limited | Offline, batch, CI/CD |
| MCP Server | Yes (via HTTP) | Full | Full | Claude-native tools |
## Quick Start
### 1. Enable Logseq HTTP API
In Logseq:
1. **Settings** → **Advanced** → **Developer mode**: ON
2. **Settings** → **Advanced** → **HTTP APIs server**: ON
3. **Settings** → **Advanced** → **Authorization tokens** → Create token
### 2. Set Environment Variable
```bash
export LOGSEQ_API_TOKEN="your-token-here"
```
### 3. Initialize Plugin
Run the setup wizard:
```bash
python {baseDir}/scripts/init-environment.py
```
Or use the command: `/logseq:init`
## Backend Details
### HTTP API (Primary)
**URL**: `http://127.0.0.1:12315/api`
**Request Format**:
```json
POST /api
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN
{
"method": "logseq.Editor.getPage",
"args": ["PageName"]
}
```
**Common Methods**:
- `logseq.App.getCurrentGraph` - Get current graph info
- `logseq.Editor.getPage` - Get page by name
- `logseq.Editor.getBlock` - Get block by UUID
- `logseq.DB.datascriptQuery` - Execute Datalog query
- `logseq.Editor.insertBlock` - Create new block
### CLI (@logseq/cli)
**Installation**:
```bash
npm install -g @logseq/cli
```
**Usage**:
```bash
# Query local graph
logseq query "[:find ?title :where [?p :block/title ?title]]" --graph ~/logseq/my-graph
# With running Logseq (in-app mode)
logseq query "..." --in-app -a YOUR_TOKEN
```
### MCP Server
The plugin includes a custom MCP server that exposes Logseq operations as Claude tools.
**Location**: `servers/logseq-mcp/`
**Build**:
```bash
cd servers/logseq-mcp
npm install
npm run build
```
## Configuration File
**Location**: `.claude/logseq-expert/env.json`
```json
{
"backend": "auto",
"http": {
"url": "http://127.0.0.1:12315",
"token": "${LOGSEQ_API_TOKEN}"
},
"cli": {
"graphPath": "/path/to/graph",
"inApp": false
},
"mcp": {
"enabled": true
},
"preferences": {
"defaultGraph": null,
"confirmWrites": false,
"backupBeforeWrite": false
}
}
```
## Troubleshooting
### "Cannot connect to Logseq"
1. **Check Logseq is running** with HTTP API enabled
2. **Verify port**: Default is 12315, check Settings → Advanced
3. **Check firewall**: Ensure localhost:12315 is accessible
4. **Test manually**:
```bash
curl -X POST http://127.0.0.1:12315/api \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"method":"logseq.App.getCurrentGraph"}'
```
### "Authentication failed"
1. **Verify token**: Check it matches what's in Logseq settings
2. **Token format**: Ensure no extra whitespace
3. **Environment variable**: Check `echo $LOGSEQ_API_TOKEN`
### "CLI not found"
1. **Install globally**: `npm install -g @logseq/cli`
2. **Or use npx**: `npx @logseq/cli --help`
3. **Check PATH**: Ensure npm global bin is in PATH
### "MCP server not working"
1. **Build server**: `cd servers/logseq-mcp && npm run build`
2. **Check Node.js**: Requires Node 18+
3. **Verify HTTP API**: MCP server uses HTTP API internally
## Scripts Reference
| Script | Purpose |
|--------|---------|
| `init-environment.py` | Interactive setup wizard |
| `detect-backend.py` | Auto-detect available backends |
| `test-connection.py` | Test connectivity |
| `preflight-checks.sh` | Validate environment |
Run scripts from plugin root:
```bash
python logseq-expert/scripts/init-environment.py
```
## Security Notes
- **Never commit tokens** to version control
- Use **environment variables** for sensitive data
- Token in config supports `${VAR}` syntax for env vars
- HTTP API only listens on localhost by defaultRelated Skills
writing-to-logseq
Expert in writing data to Logseq DB graphs via HTTP API. Auto-invokes when users want to create pages, add blocks, update content, set properties, or sync conversation notes to their Logseq graph. Provides CRUD operations with safety guidelines.
reading-logseq-data
Expert in reading data from Logseq DB graphs via HTTP API or CLI. Auto-invokes when users want to fetch pages, blocks, or properties from Logseq, execute Datalog queries against their graph, search content, or retrieve backlinks and relationships. Provides the logseq-client library for operations.
querying-logseq-data
Expert in building Datalog queries for Logseq DB graphs. Auto-invokes when users need help writing Logseq queries, understanding Datalog syntax, optimizing query performance, or working with the Datascript query engine. Covers advanced query patterns, pull syntax, aggregations, and DB-specific query techniques.
building-logseq-plugins
Expert guidance for building Logseq plugins compatible with the new DB architecture. Auto-invokes when users want to create Logseq plugins, work with the Logseq Plugin API, extend Logseq functionality, or need help with plugin development for DB-based graphs. Covers plugin structure, API usage, and DB-specific considerations.
azure-quotas
Check/manage Azure quotas and usage across providers. For deployment planning, capacity validation, region selection. WHEN: "check quotas", "service limits", "current usage", "request quota increase", "quota exceeded", "validate capacity", "regional availability", "provisioning limits", "vCPU limit", "how many vCPUs available in my subscription".
raindrop-io
Manage Raindrop.io bookmarks with AI assistance. Save and organize bookmarks, search your collection, manage reading lists, and organize research materials. Use when working with bookmarks, web research, reading lists, or when user mentions Raindrop.io.
zlibrary-to-notebooklm
自动从 Z-Library 下载书籍并上传到 Google NotebookLM。支持 PDF/EPUB 格式,自动转换,一键创建知识库。
discover-skills
当你发现当前可用的技能都不够合适(或用户明确要求你寻找技能)时使用。本技能会基于任务目标和约束,给出一份精简的候选技能清单,帮助你选出最适配当前任务的技能。
web-performance-seo
Fix PageSpeed Insights/Lighthouse accessibility "!" errors caused by contrast audit failures (CSS filters, OKLCH/OKLAB, low opacity, gradient text, image backgrounds). Use for accessibility-driven SEO/performance debugging and remediation.
project-to-obsidian
将代码项目转换为 Obsidian 知识库。当用户提到 obsidian、项目文档、知识库、分析项目、转换项目 时激活。 【激活后必须执行】: 1. 先完整阅读本 SKILL.md 文件 2. 理解 AI 写入规则(默认到 00_Inbox/AI/、追加式、统一 Schema) 3. 执行 STEP 0: 使用 AskUserQuestion 询问用户确认 4. 用户确认后才开始 STEP 1 项目扫描 5. 严格按 STEP 0 → 1 → 2 → 3 → 4 顺序执行 【禁止行为】: - 禁止不读 SKILL.md 就开始分析项目 - 禁止跳过 STEP 0 用户确认 - 禁止直接在 30_Resources 创建(先到 00_Inbox/AI/) - 禁止自作主张决定输出位置
obsidian-helper
Obsidian 智能笔记助手。当用户提到 obsidian、日记、笔记、知识库、capture、review 时激活。 【激活后必须执行】: 1. 先完整阅读本 SKILL.md 文件 2. 理解 AI 写入三条硬规矩(00_Inbox/AI/、追加式、白名单字段) 3. 按 STEP 0 → STEP 1 → ... 顺序执行 4. 不要跳过任何步骤,不要自作主张 【禁止行为】: - 禁止不读 SKILL.md 就开始工作 - 禁止跳过用户确认步骤 - 禁止在非 00_Inbox/AI/ 位置创建新笔记(除非用户明确指定)
internationalizing-websites
Adds multi-language support to Next.js websites with proper SEO configuration including hreflang tags, localized sitemaps, and language-specific content. Use when adding new languages, setting up i18n, optimizing for international SEO, or when user mentions localization, translation, multi-language, or specific languages like Japanese, Korean, Chinese.