logseq-mcp 0.0.18 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +139 -150
- package/package.json +18 -1
package/README.md
CHANGED
|
@@ -1,47 +1,56 @@
|
|
|
1
|
-
# Logseq Agent
|
|
1
|
+
# Logseq MCP Agent
|
|
2
2
|
|
|
3
|
-
A powerful
|
|
3
|
+
A powerful AI assistant that connects Logseq with Claude and other LLMs using the Model Context Protocol (MCP).
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## What is it?
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Logseq MCP Agent lets AI assistants like Claude directly interact with your Logseq knowledge graph - search your notes, create content, organize information, and manage tasks.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
npx logseq-mcp
|
|
11
|
-
```
|
|
9
|
+
MCP (Model Context Protocol) works like a "USB-C port for AI" - providing a standardized way for AI models to connect with your applications and data. This agent implements MCP to give Claude and other LLMs a direct, structured interface to your Logseq knowledge base.
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
Think of it as giving Claude direct access to your second brain.
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
npm install -g logseq-mcp
|
|
17
|
-
```
|
|
13
|
+
## Key Features
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
### 📝 Knowledge Management
|
|
16
|
+
- Search your entire graph for information
|
|
17
|
+
- Generate summaries of pages and content
|
|
18
|
+
- Create daily notes with custom sections
|
|
19
|
+
- Organize flat pages into nested structures
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
### ✅ Task Management
|
|
22
|
+
- Find all tasks with specific statuses (TODO, DOING, etc.)
|
|
23
|
+
- Extract tasks from meeting notes
|
|
24
|
+
- Create and organize task lists
|
|
25
|
+
- Track task progress
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
LOGSEQ_HOST=127.0.0.1
|
|
30
|
-
LOGSEQ_TOKEN=your_logseq_token
|
|
31
|
-
```
|
|
27
|
+
### 🔍 Search & Query
|
|
28
|
+
- Natural language search across your graph
|
|
29
|
+
- Find blocks by content
|
|
30
|
+
- Run advanced Datalog queries
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
### 📊 Content Organization
|
|
33
|
+
- Restructure content hierarchically
|
|
34
|
+
- Organize blocks by any criteria
|
|
35
|
+
- Transform flat content into nested structures
|
|
36
|
+
|
|
37
|
+
## Quick Setup
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
### Prerequisites
|
|
40
|
+
- [Logseq](https://logseq.com/) with HTTP API enabled
|
|
41
|
+
- A Logseq API token
|
|
42
|
+
- Claude Desktop or other MCP-compatible AI assistant
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
### Enabling Logseq HTTP API
|
|
45
|
+
1. In Logseq → Settings → Advanced: Enable "Developer mode"
|
|
46
|
+
2. Restart Logseq
|
|
47
|
+
3. In Settings: Enable "HTTP API server"
|
|
48
|
+
4. Copy your API token
|
|
41
49
|
|
|
50
|
+
### Setup with Claude Desktop
|
|
42
51
|
1. Open Claude Desktop settings
|
|
43
52
|
2. Navigate to MCP Servers
|
|
44
|
-
3. Add a new server
|
|
53
|
+
3. Add a new server:
|
|
45
54
|
```json
|
|
46
55
|
{
|
|
47
56
|
"mcpServers": {
|
|
@@ -57,165 +66,145 @@ To use the Logseq Agent with Claude Desktop:
|
|
|
57
66
|
}
|
|
58
67
|
}
|
|
59
68
|
```
|
|
60
|
-
4.
|
|
61
|
-
5.
|
|
62
|
-
|
|
63
|
-
## Features
|
|
64
|
-
|
|
65
|
-
### Block Management
|
|
66
|
-
|
|
67
|
-
- **Get Block**: Retrieve a block by UUID
|
|
68
|
-
- **Create Block**: Create a new block in a page
|
|
69
|
-
- **Update Block**: Update an existing block
|
|
70
|
-
- **Remove Block**: Remove a block by UUID
|
|
71
|
-
- **Get/Set Block Properties**: Manage block properties
|
|
72
|
-
- **Create Nested Blocks**: Create hierarchical block structures
|
|
73
|
-
- **Edit/Select Blocks**: Manipulate blocks in the UI
|
|
69
|
+
4. Replace `your_logseq_token` with your actual token
|
|
70
|
+
5. Save and restart Claude
|
|
74
71
|
|
|
75
|
-
###
|
|
72
|
+
### Using Claude with Logseq
|
|
73
|
+
Try asking:
|
|
74
|
+
- "Find all my TODO tasks in Logseq"
|
|
75
|
+
- "Create a daily note with sections for Tasks, Notes, and Journal"
|
|
76
|
+
- "Summarize my 'Research' page"
|
|
77
|
+
- "Search my notes for information about machine learning"
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
- **Move Block**: Reposition blocks within your graph
|
|
79
|
-
- **Collapse/Expand**: Control block visibility
|
|
80
|
-
- **Scroll to Block**: Navigate to specific blocks
|
|
81
|
-
- **Right Sidebar**: Open blocks in the sidebar
|
|
79
|
+
## Alternative Installation
|
|
82
80
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
|
|
87
|
-
- **Get Current Page**: Access the active page
|
|
88
|
-
- **Get All Pages**: List all pages in your graph
|
|
89
|
-
- **Get Page Blocks**: Access all blocks in a page
|
|
90
|
-
- **Get Linked References**: See all references to a page
|
|
91
|
-
|
|
92
|
-
### Search & Query
|
|
93
|
-
|
|
94
|
-
- **Query Logseq**: Run powerful Datalog queries
|
|
95
|
-
- **Search Blocks**: Find blocks matching criteria
|
|
96
|
-
- **Get Tasks**: Retrieve and filter task blocks
|
|
97
|
-
|
|
98
|
-
## Built-in Prompts
|
|
99
|
-
|
|
100
|
-
The agent includes several pre-configured prompt templates:
|
|
101
|
-
|
|
102
|
-
### Task Management
|
|
103
|
-
- **query-tasks**: Find tasks with specific status (TODO, DOING, etc.)
|
|
104
|
-
- **extract-tasks**: Extract and organize tasks from notes
|
|
105
|
-
|
|
106
|
-
### Content Creation & Organization
|
|
107
|
-
- **create-daily-note**: Generate a daily note with customizable sections
|
|
108
|
-
- **create-nested-content**: Create structured hierarchical content
|
|
109
|
-
- **summarize-page**: Generate concise summaries of pages
|
|
110
|
-
|
|
111
|
-
### Knowledge Management
|
|
112
|
-
- **search-knowledge**: Search your knowledge base
|
|
113
|
-
- **organize-blocks**: Organize blocks by specified criteria
|
|
114
|
-
- **organize-blocks-as-nested**: Restructure content hierarchically
|
|
115
|
-
- **convert-flat-to-nested**: Transform flat pages into nested structures
|
|
116
|
-
|
|
117
|
-
## Usage Examples
|
|
118
|
-
|
|
119
|
-
Here are some examples of how to use the Logseq Agent with Claude:
|
|
81
|
+
Install via npm:
|
|
82
|
+
```bash
|
|
83
|
+
npx logseq-mcp
|
|
84
|
+
```
|
|
120
85
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
86
|
+
Or install globally:
|
|
87
|
+
```bash
|
|
88
|
+
npm install -g logseq-mcp
|
|
89
|
+
```
|
|
125
90
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
91
|
+
Configure with a `.env` file:
|
|
92
|
+
```
|
|
93
|
+
LOGSEQ_PORT=12315
|
|
94
|
+
LOGSEQ_HOST=127.0.0.1
|
|
95
|
+
LOGSEQ_TOKEN=your_logseq_token
|
|
96
|
+
```
|
|
130
97
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
98
|
+
Run with:
|
|
99
|
+
```bash
|
|
100
|
+
logseq-mcp
|
|
101
|
+
```
|
|
135
102
|
|
|
136
|
-
|
|
137
|
-
```
|
|
138
|
-
Can you summarize my "Project Ideas" page?
|
|
139
|
-
```
|
|
103
|
+
## Troubleshooting
|
|
140
104
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
105
|
+
- Ensure Logseq is running before starting the agent
|
|
106
|
+
- Verify your API token is correct
|
|
107
|
+
- Check that the Logseq HTTP API is enabled
|
|
108
|
+
- Try debug mode: `DEBUG=true logseq-mcp`
|
|
145
109
|
|
|
146
|
-
|
|
110
|
+
### Debugging
|
|
111
|
+
Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we recommend using the MCP Inspector.
|
|
147
112
|
|
|
148
|
-
|
|
113
|
+
You can launch the MCP Inspector via npm with:
|
|
149
114
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
- Navigate to 'Advanced'
|
|
154
|
-
- Enable 'Developer mode'
|
|
155
|
-
- Restart Logseq
|
|
156
|
-
- Go to Settings again
|
|
157
|
-
- Find and enable 'HTTP API server'
|
|
115
|
+
```bash
|
|
116
|
+
npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-logseq run mcp-logseq
|
|
117
|
+
```
|
|
158
118
|
|
|
159
|
-
|
|
160
|
-
- Ensure Logseq is running before starting the agent
|
|
161
|
-
- Verify your LOGSEQ_TOKEN in the .env file
|
|
162
|
-
- Make sure the port isn't blocked by your firewall
|
|
119
|
+
## Technical Details
|
|
163
120
|
|
|
164
|
-
|
|
165
|
-
Add `DEBUG=true` to your .env file for more detailed logs:
|
|
166
|
-
```
|
|
167
|
-
DEBUG=true
|
|
168
|
-
LOGSEQ_PORT=12315
|
|
169
|
-
LOGSEQ_HOST=127.0.0.1
|
|
170
|
-
LOGSEQ_TOKEN=your_logseq_token
|
|
171
|
-
```
|
|
121
|
+
Built using the Model Context Protocol (MCP), an open standard for connecting AI models with external tools and data sources. The agent acts as an MCP server that provides structured access to your Logseq graph via the Logseq HTTP API.
|
|
172
122
|
|
|
173
123
|
## Development
|
|
174
124
|
|
|
175
|
-
###
|
|
125
|
+
### Setup Development Environment
|
|
176
126
|
|
|
177
127
|
1. Clone the repository:
|
|
178
128
|
```bash
|
|
179
|
-
git clone https://github.com/
|
|
129
|
+
git clone https://github.com/briansunter/logseq-mcp.git
|
|
180
130
|
cd logseq-mcp
|
|
181
131
|
```
|
|
182
132
|
|
|
183
133
|
2. Install dependencies:
|
|
184
134
|
```bash
|
|
135
|
+
# Using npm
|
|
185
136
|
npm install
|
|
137
|
+
|
|
138
|
+
# Using Bun (recommended)
|
|
139
|
+
bun install
|
|
186
140
|
```
|
|
187
141
|
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
npm start
|
|
191
|
-
```
|
|
142
|
+
### Running Tests
|
|
192
143
|
|
|
193
|
-
|
|
144
|
+
The project includes unit and end-to-end tests:
|
|
194
145
|
|
|
195
|
-
Run the integration tests with:
|
|
196
146
|
```bash
|
|
197
|
-
|
|
147
|
+
# Run all tests
|
|
148
|
+
bun test tests/
|
|
149
|
+
|
|
150
|
+
# Run unit tests only
|
|
151
|
+
bun test:unit
|
|
152
|
+
|
|
153
|
+
# Run e2e tests only
|
|
154
|
+
bun test:e2e
|
|
155
|
+
|
|
156
|
+
# Run tests in watch mode
|
|
157
|
+
bun test:watch
|
|
198
158
|
```
|
|
199
159
|
|
|
200
|
-
|
|
160
|
+
### Building
|
|
201
161
|
|
|
202
|
-
|
|
162
|
+
```bash
|
|
163
|
+
# Standard build
|
|
164
|
+
bun run build
|
|
165
|
+
|
|
166
|
+
# Build for Node.js
|
|
167
|
+
bun run build:node
|
|
168
|
+
|
|
169
|
+
# Build for Bun
|
|
170
|
+
bun run build:bun
|
|
171
|
+
|
|
172
|
+
# Build binaries for various platforms
|
|
173
|
+
bun run build:binary # Current platform
|
|
174
|
+
bun run build:macos-arm # macOS ARM
|
|
175
|
+
bun run build:macos-intel # macOS Intel
|
|
176
|
+
bun run build:linux-x64 # Linux x64
|
|
177
|
+
bun run build:linux-arm64 # Linux ARM64
|
|
178
|
+
bun run build:windows # Windows
|
|
179
|
+
bun run build:all-binaries # All platforms
|
|
180
|
+
```
|
|
203
181
|
|
|
204
|
-
|
|
182
|
+
### Contributing Guidelines
|
|
205
183
|
|
|
206
|
-
1.
|
|
207
|
-
2. Create a
|
|
208
|
-
3.
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
- Publish to npm
|
|
184
|
+
1. Fork the repository
|
|
185
|
+
2. Create a feature branch: `git checkout -b feature/your-feature-name`
|
|
186
|
+
3. Commit your changes: `git commit -m 'Add some feature'`
|
|
187
|
+
4. Push to the branch: `git push origin feature/your-feature-name`
|
|
188
|
+
5. Submit a pull request
|
|
212
189
|
|
|
213
|
-
|
|
190
|
+
Please make sure your code passes all tests and follows the existing code style. Add tests for new features.
|
|
214
191
|
|
|
215
|
-
## License
|
|
192
|
+
## Contributing & License
|
|
216
193
|
|
|
217
|
-
MIT
|
|
194
|
+
Contributions welcome! MIT License.
|
|
218
195
|
|
|
219
196
|
## Contributing
|
|
220
197
|
|
|
221
|
-
|
|
198
|
+
### Semantic Versioning
|
|
199
|
+
|
|
200
|
+
This project uses semantic-release to automatically manage version numbers and create GitHub releases. Version numbers are determined by PR titles using the following conventions:
|
|
201
|
+
|
|
202
|
+
| PR Title Format | Example | Result |
|
|
203
|
+
|-----------------|---------|--------|
|
|
204
|
+
| `feat: ...` | `feat: add new search feature` | Minor version increase (0.X.0) |
|
|
205
|
+
| `fix: ...` | `fix: resolve search bug` | Patch version increase (0.0.X) |
|
|
206
|
+
| `feat(breaking): ...` | `feat(breaking): change API format` | Major version increase (X.0.0) |
|
|
207
|
+
|
|
208
|
+
Other valid prefixes: `docs:`, `style:`, `refactor:`, `perf:`, `test:`, `chore:`, `ci:`, `build:` (all result in patch versions).
|
|
209
|
+
|
|
210
|
+
When merging PRs to master, please follow these conventions in your PR titles to ensure proper versioning.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "logseq-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Logseq Model Context Protocol Agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"test:watch": "bun test --watch tests/",
|
|
20
20
|
"test:unit:watch": "TEST_TYPE=unit bun test --watch tests/unit/",
|
|
21
21
|
"test:e2e:watch": "TEST_TYPE=e2e bun test --watch tests/e2e/",
|
|
22
|
+
"typecheck": "bun --bun tsc --noEmit",
|
|
23
|
+
"lint": "bun eslint",
|
|
24
|
+
"check": "bun --bun tsc --noEmit && bun eslint",
|
|
25
|
+
"lint:fix": "bun eslint --fix",
|
|
22
26
|
"build": "bun run build.ts",
|
|
23
27
|
"build:node": "bun run build.ts node",
|
|
24
28
|
"build:bun": "bun run build.ts bun",
|
|
@@ -40,6 +44,19 @@
|
|
|
40
44
|
"dotenv": "^16.3.1",
|
|
41
45
|
"zod": "^3.22.4"
|
|
42
46
|
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@semantic-release/commit-analyzer": "^11.1.0",
|
|
49
|
+
"@semantic-release/github": "^9.2.0",
|
|
50
|
+
"@semantic-release/release-notes-generator": "^12.1.0",
|
|
51
|
+
"@types/node": "^22.13.11",
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
|
53
|
+
"@typescript-eslint/parser": "^6.10.0",
|
|
54
|
+
"bun-types": "^1.2.5",
|
|
55
|
+
"eslint": "^9.23.0",
|
|
56
|
+
"globals": "^13.24.0",
|
|
57
|
+
"semantic-release": "^23.0.0",
|
|
58
|
+
"typescript": "^5.2.2"
|
|
59
|
+
},
|
|
43
60
|
"files": [
|
|
44
61
|
"dist",
|
|
45
62
|
"README.md"
|