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.
/plugin marketplace add C0ntr0lledCha0s/claude-code-plugin-automations/plugin install logseq-expert@claude-code-plugin-automationsThis skill is limited to using the following tools:
assets/env.example.jsonreferences/cli-guide.mdreferences/http-api-guide.mdreferences/troubleshooting.mdThis skill auto-invokes when:
Setup Scripts: See {baseDir}/scripts/ for initialization utilities.
| 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 |
In Logseq:
export LOGSEQ_API_TOKEN="your-token-here"
Run the setup wizard:
python {baseDir}/scripts/init-environment.py
Or use the command: /logseq:init
URL: http://127.0.0.1:12315/api
Request Format:
POST /api
Content-Type: application/json
Authorization: Bearer YOUR_TOKEN
{
"method": "logseq.Editor.getPage",
"args": ["PageName"]
}
Common Methods:
logseq.App.getCurrentGraph - Get current graph infologseq.Editor.getPage - Get page by namelogseq.Editor.getBlock - Get block by UUIDlogseq.DB.datascriptQuery - Execute Datalog querylogseq.Editor.insertBlock - Create new blockInstallation:
npm install -g @logseq/cli
Usage:
# 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
The plugin includes a custom MCP server that exposes Logseq operations as Claude tools.
Location: servers/logseq-mcp/
Build:
cd servers/logseq-mcp
npm install
npm run build
Location: .claude/logseq-expert/env.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
}
}
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"}'
echo $LOGSEQ_API_TOKENnpm install -g @logseq/clinpx @logseq/cli --helpcd servers/logseq-mcp && npm run build| 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:
python logseq-expert/scripts/init-environment.py
${VAR} syntax for env varsThis skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.