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.
What this skill does
# 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 default
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.