mcp-server-logseq 0.0.1__tar.gz
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.
- mcp_server_logseq-0.0.1/.env.example +2 -0
- mcp_server_logseq-0.0.1/.gitignore +4 -0
- mcp_server_logseq-0.0.1/LICENSE +21 -0
- mcp_server_logseq-0.0.1/PKG-INFO +124 -0
- mcp_server_logseq-0.0.1/README.md +100 -0
- mcp_server_logseq-0.0.1/pyproject.toml +35 -0
- mcp_server_logseq-0.0.1/src/mcp_server_logseq/__init__.py +43 -0
- mcp_server_logseq-0.0.1/src/mcp_server_logseq/__main__.py +5 -0
- mcp_server_logseq-0.0.1/src/mcp_server_logseq/server.py +833 -0
- mcp_server_logseq-0.0.1/uv.lock +411 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Daniel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mcp-server-logseq
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: An MCP server for LogSeq API
|
|
5
|
+
Project-URL: homepage, https://github.com/dailydaniel/logseq-mcp
|
|
6
|
+
Project-URL: repository, https://github.com/dailydaniel/logseq-mcp
|
|
7
|
+
Project-URL: issues, https://github.com/dailydaniel/logseq-mcp/issues
|
|
8
|
+
Author-email: Daniel Zholkovsky <daniel@zholkovsky.com>
|
|
9
|
+
Maintainer-email: Daniel Zholkovsky <daniel@zholkovsky.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: automation,http,llm,mcp
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Requires-Dist: mcp>=1.0.0
|
|
20
|
+
Requires-Dist: pydantic>=2.10.2
|
|
21
|
+
Requires-Dist: python-dotenv>=1.0.1
|
|
22
|
+
Requires-Dist: requests>=2.32.3
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# Logseq MCP Server
|
|
26
|
+
A Model Context Protocol server that provides direct integration with Logseq's knowledge base. This server enables LLMs to interact with Logseq graphs, create pages, manage blocks, and organize information programmatically.
|
|
27
|
+
|
|
28
|
+
## Available Tools
|
|
29
|
+
|
|
30
|
+
### logseq_insert_block - Creates new blocks in Logseq
|
|
31
|
+
**Parameters:**
|
|
32
|
+
- `parent_block` (string, optional): UUID or content of parent block/page
|
|
33
|
+
- `content` (string, required): Block content in Markdown/Org format
|
|
34
|
+
- `is_page_block` (boolean, optional): Create as page-level block (default: false)
|
|
35
|
+
- `before` (boolean, optional): Insert before parent block (default: false)
|
|
36
|
+
- `custom_uuid` (string, optional): Custom UUIDv4 for the block
|
|
37
|
+
|
|
38
|
+
### logseq_create_page - Creates new pages with properties
|
|
39
|
+
**Parameters:**
|
|
40
|
+
- `page_name` (string, required): Name of the page to create
|
|
41
|
+
- `properties` (object, optional): Page properties as key-value pairs
|
|
42
|
+
- `journal` (boolean, optional): Create as journal page (default: false)
|
|
43
|
+
- `format` (string, optional): Page format - "markdown" or "org" (default: "markdown")
|
|
44
|
+
- `create_first_block` (boolean, optional): Create initial empty block (default: true)
|
|
45
|
+
|
|
46
|
+
## Prompts
|
|
47
|
+
|
|
48
|
+
### logseq_insert_block
|
|
49
|
+
Create a new block in Logseq
|
|
50
|
+
**Arguments:**
|
|
51
|
+
- `parent_block`: Parent block reference (page name or UUID)
|
|
52
|
+
- `content`: Block content
|
|
53
|
+
- `is_page_block`: Set true for page-level blocks
|
|
54
|
+
|
|
55
|
+
### logseq_create_page
|
|
56
|
+
Create a new Logseq page
|
|
57
|
+
**Arguments:**
|
|
58
|
+
- `page_name`: Name of the page
|
|
59
|
+
- `properties`: Page properties as JSON
|
|
60
|
+
- `journal`: Set true for journal pages
|
|
61
|
+
|
|
62
|
+
## Installation
|
|
63
|
+
|
|
64
|
+
### Using pip
|
|
65
|
+
todo: add to pypi
|
|
66
|
+
### From source
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/dailydaniel/logseq-mcp.git
|
|
69
|
+
cd logseq-mcp
|
|
70
|
+
cp .env.example .env
|
|
71
|
+
uv sync
|
|
72
|
+
```
|
|
73
|
+
Run the server:
|
|
74
|
+
```bash
|
|
75
|
+
python -m mcp_server_logseq
|
|
76
|
+
```
|
|
77
|
+
## Configuration
|
|
78
|
+
### API Key
|
|
79
|
+
1. Generate API token in Logseq: API → Authorization tokens
|
|
80
|
+
2. Set environment variable:
|
|
81
|
+
```bash
|
|
82
|
+
export LOGSEQ_API_TOKEN=your_token_here
|
|
83
|
+
```
|
|
84
|
+
Or pass via command line:
|
|
85
|
+
```bash
|
|
86
|
+
python -m mcp_server_logseq --api-key=your_token_here
|
|
87
|
+
```
|
|
88
|
+
### Graph Configuration
|
|
89
|
+
Default URL: http://localhost:12315
|
|
90
|
+
To customize:
|
|
91
|
+
```bash
|
|
92
|
+
python -m mcp_server_logseq --url=http://your-logseq-instance:port
|
|
93
|
+
```
|
|
94
|
+
## Examples
|
|
95
|
+
## Create meeting notes page
|
|
96
|
+
```plaintext
|
|
97
|
+
Create new page "Team Meeting 2024-03-15" with properties:
|
|
98
|
+
- Tags: #meeting #engineering
|
|
99
|
+
- Participants: Alice, Bob, Charlie
|
|
100
|
+
- Status: pending
|
|
101
|
+
```
|
|
102
|
+
### Add task block to existing page
|
|
103
|
+
```plaintext
|
|
104
|
+
Add task to [[Project Roadmap]]:
|
|
105
|
+
- [ ] Finalize API documentation
|
|
106
|
+
- Due: 2024-03-20
|
|
107
|
+
- Priority: high
|
|
108
|
+
```
|
|
109
|
+
### Create journal entry with first block
|
|
110
|
+
```plaintext
|
|
111
|
+
Create journal entry for today with initial content:
|
|
112
|
+
- Morning standup completed
|
|
113
|
+
- Started work on new authentication system
|
|
114
|
+
```
|
|
115
|
+
## Debugging
|
|
116
|
+
```bash
|
|
117
|
+
npx @modelcontextprotocol/inspector uv --directory . run mcp-server-logseq
|
|
118
|
+
```
|
|
119
|
+
## Contributing
|
|
120
|
+
We welcome contributions to enhance Logseq integration:
|
|
121
|
+
- Add new API endpoints (page linking, query support)
|
|
122
|
+
- Improve block manipulation capabilities
|
|
123
|
+
- Add template support
|
|
124
|
+
- Enhance error handling
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Logseq MCP Server
|
|
2
|
+
A Model Context Protocol server that provides direct integration with Logseq's knowledge base. This server enables LLMs to interact with Logseq graphs, create pages, manage blocks, and organize information programmatically.
|
|
3
|
+
|
|
4
|
+
## Available Tools
|
|
5
|
+
|
|
6
|
+
### logseq_insert_block - Creates new blocks in Logseq
|
|
7
|
+
**Parameters:**
|
|
8
|
+
- `parent_block` (string, optional): UUID or content of parent block/page
|
|
9
|
+
- `content` (string, required): Block content in Markdown/Org format
|
|
10
|
+
- `is_page_block` (boolean, optional): Create as page-level block (default: false)
|
|
11
|
+
- `before` (boolean, optional): Insert before parent block (default: false)
|
|
12
|
+
- `custom_uuid` (string, optional): Custom UUIDv4 for the block
|
|
13
|
+
|
|
14
|
+
### logseq_create_page - Creates new pages with properties
|
|
15
|
+
**Parameters:**
|
|
16
|
+
- `page_name` (string, required): Name of the page to create
|
|
17
|
+
- `properties` (object, optional): Page properties as key-value pairs
|
|
18
|
+
- `journal` (boolean, optional): Create as journal page (default: false)
|
|
19
|
+
- `format` (string, optional): Page format - "markdown" or "org" (default: "markdown")
|
|
20
|
+
- `create_first_block` (boolean, optional): Create initial empty block (default: true)
|
|
21
|
+
|
|
22
|
+
## Prompts
|
|
23
|
+
|
|
24
|
+
### logseq_insert_block
|
|
25
|
+
Create a new block in Logseq
|
|
26
|
+
**Arguments:**
|
|
27
|
+
- `parent_block`: Parent block reference (page name or UUID)
|
|
28
|
+
- `content`: Block content
|
|
29
|
+
- `is_page_block`: Set true for page-level blocks
|
|
30
|
+
|
|
31
|
+
### logseq_create_page
|
|
32
|
+
Create a new Logseq page
|
|
33
|
+
**Arguments:**
|
|
34
|
+
- `page_name`: Name of the page
|
|
35
|
+
- `properties`: Page properties as JSON
|
|
36
|
+
- `journal`: Set true for journal pages
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
### Using pip
|
|
41
|
+
todo: add to pypi
|
|
42
|
+
### From source
|
|
43
|
+
```bash
|
|
44
|
+
git clone https://github.com/dailydaniel/logseq-mcp.git
|
|
45
|
+
cd logseq-mcp
|
|
46
|
+
cp .env.example .env
|
|
47
|
+
uv sync
|
|
48
|
+
```
|
|
49
|
+
Run the server:
|
|
50
|
+
```bash
|
|
51
|
+
python -m mcp_server_logseq
|
|
52
|
+
```
|
|
53
|
+
## Configuration
|
|
54
|
+
### API Key
|
|
55
|
+
1. Generate API token in Logseq: API → Authorization tokens
|
|
56
|
+
2. Set environment variable:
|
|
57
|
+
```bash
|
|
58
|
+
export LOGSEQ_API_TOKEN=your_token_here
|
|
59
|
+
```
|
|
60
|
+
Or pass via command line:
|
|
61
|
+
```bash
|
|
62
|
+
python -m mcp_server_logseq --api-key=your_token_here
|
|
63
|
+
```
|
|
64
|
+
### Graph Configuration
|
|
65
|
+
Default URL: http://localhost:12315
|
|
66
|
+
To customize:
|
|
67
|
+
```bash
|
|
68
|
+
python -m mcp_server_logseq --url=http://your-logseq-instance:port
|
|
69
|
+
```
|
|
70
|
+
## Examples
|
|
71
|
+
## Create meeting notes page
|
|
72
|
+
```plaintext
|
|
73
|
+
Create new page "Team Meeting 2024-03-15" with properties:
|
|
74
|
+
- Tags: #meeting #engineering
|
|
75
|
+
- Participants: Alice, Bob, Charlie
|
|
76
|
+
- Status: pending
|
|
77
|
+
```
|
|
78
|
+
### Add task block to existing page
|
|
79
|
+
```plaintext
|
|
80
|
+
Add task to [[Project Roadmap]]:
|
|
81
|
+
- [ ] Finalize API documentation
|
|
82
|
+
- Due: 2024-03-20
|
|
83
|
+
- Priority: high
|
|
84
|
+
```
|
|
85
|
+
### Create journal entry with first block
|
|
86
|
+
```plaintext
|
|
87
|
+
Create journal entry for today with initial content:
|
|
88
|
+
- Morning standup completed
|
|
89
|
+
- Started work on new authentication system
|
|
90
|
+
```
|
|
91
|
+
## Debugging
|
|
92
|
+
```bash
|
|
93
|
+
npx @modelcontextprotocol/inspector uv --directory . run mcp-server-logseq
|
|
94
|
+
```
|
|
95
|
+
## Contributing
|
|
96
|
+
We welcome contributions to enhance Logseq integration:
|
|
97
|
+
- Add new API endpoints (page linking, query support)
|
|
98
|
+
- Improve block manipulation capabilities
|
|
99
|
+
- Add template support
|
|
100
|
+
- Enhance error handling
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "mcp-server-logseq"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
description = "An MCP server for LogSeq API"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
authors = [{ name = "Daniel Zholkovsky", email = "daniel@zholkovsky.com" }]
|
|
8
|
+
maintainers = [{ name = "Daniel Zholkovsky", email = "daniel@zholkovsky.com" }]
|
|
9
|
+
keywords = ["http", "mcp", "llm", "automation"]
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 4 - Beta",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"License :: OSI Approved :: MIT License",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.10",
|
|
17
|
+
]
|
|
18
|
+
dependencies = [
|
|
19
|
+
"mcp>=1.0.0",
|
|
20
|
+
"pydantic>=2.10.2",
|
|
21
|
+
"python-dotenv>=1.0.1",
|
|
22
|
+
"requests>=2.32.3",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
homepage = "https://github.com/dailydaniel/logseq-mcp"
|
|
27
|
+
repository = "https://github.com/dailydaniel/logseq-mcp"
|
|
28
|
+
issues = "https://github.com/dailydaniel/logseq-mcp/issues"
|
|
29
|
+
|
|
30
|
+
[build-system]
|
|
31
|
+
requires = ["hatchling"]
|
|
32
|
+
build-backend = "hatchling.build"
|
|
33
|
+
|
|
34
|
+
[project.scripts]
|
|
35
|
+
mcp-server-logseq = "mcp_server_logseq.__main__:main"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from .server import serve
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def main():
|
|
5
|
+
"""MCP LogSeq Server - AI-powered note taking for MCP"""
|
|
6
|
+
import argparse
|
|
7
|
+
import asyncio
|
|
8
|
+
import os
|
|
9
|
+
from dotenv import load_dotenv
|
|
10
|
+
|
|
11
|
+
load_dotenv()
|
|
12
|
+
|
|
13
|
+
parser = argparse.ArgumentParser(
|
|
14
|
+
description="Share your LogSeq notes with LLM (https://docs.logseq.com/#/page/local%20http%20server)"
|
|
15
|
+
)
|
|
16
|
+
parser.add_argument(
|
|
17
|
+
"--api-key",
|
|
18
|
+
type=str,
|
|
19
|
+
help="LogSeq API key",
|
|
20
|
+
)
|
|
21
|
+
parser.add_argument(
|
|
22
|
+
"--url",
|
|
23
|
+
type=str,
|
|
24
|
+
help="LogSeq API host",
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
args = parser.parse_args()
|
|
28
|
+
|
|
29
|
+
# Check for API key in args first, then environment
|
|
30
|
+
api_key = args.api_key or os.getenv("LOGSEQ_API_TOKEN")
|
|
31
|
+
if not api_key:
|
|
32
|
+
parser.error("LogSeq API key must be provided either via --api-key or LOGSEQ_API_TOKEN environment variable")
|
|
33
|
+
|
|
34
|
+
# Check for URL in args first, then environment
|
|
35
|
+
url = args.url or os.getenv("LOGSEQ_API_URL")
|
|
36
|
+
if not url:
|
|
37
|
+
parser.error("LogSeq API URL must be provided either via --url or LOGSEQ_API_URL environment variable")
|
|
38
|
+
|
|
39
|
+
asyncio.run(serve(api_key, url))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
if __name__ == "__main__":
|
|
43
|
+
main()
|