kb-mcp-lite 0.2.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.
- kb_mcp_lite-0.2.1/LICENSE +21 -0
- kb_mcp_lite-0.2.1/PKG-INFO +203 -0
- kb_mcp_lite-0.2.1/README.md +166 -0
- kb_mcp_lite-0.2.1/pyproject.toml +82 -0
- kb_mcp_lite-0.2.1/setup.cfg +4 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite/__init__.py +60 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite/cli.py +896 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite/embedder.py +347 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite/mcp_server.py +590 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite/md_io.py +434 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite/migrations/0001_init.sql +92 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite/migrations/0002_trgm.sql +49 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite/migrations/0003_vec.sql +16 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite/migrations.py +100 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite/schema.py +461 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite/store/__init__.py +10 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite/store/sqlite.py +969 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite/store.py +232 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite/stub_store.py +434 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite.egg-info/PKG-INFO +203 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite.egg-info/SOURCES.txt +32 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite.egg-info/dependency_links.txt +1 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite.egg-info/entry_points.txt +2 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite.egg-info/requires.txt +15 -0
- kb_mcp_lite-0.2.1/src/kb_mcp_lite.egg-info/top_level.txt +1 -0
- kb_mcp_lite-0.2.1/tests/test_cli_sqlite.py +563 -0
- kb_mcp_lite-0.2.1/tests/test_cli_stub.py +812 -0
- kb_mcp_lite-0.2.1/tests/test_embedder.py +208 -0
- kb_mcp_lite-0.2.1/tests/test_mcp_e2e.py +415 -0
- kb_mcp_lite-0.2.1/tests/test_md_io.py +657 -0
- kb_mcp_lite-0.2.1/tests/test_placeholder.py +4 -0
- kb_mcp_lite-0.2.1/tests/test_search_fuzzy.py +219 -0
- kb_mcp_lite-0.2.1/tests/test_search_semantic.py +209 -0
- kb_mcp_lite-0.2.1/tests/test_store_sqlite.py +452 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kb-mcp contributors
|
|
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,203 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kb-mcp-lite
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Lightweight agent-native knowledge base. SQLite + FTS5 + vec0 + MCP server.
|
|
5
|
+
Author: HelloTomBruce (Zhang Bei)
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/HelloTomBruce/kb-mcp-lite
|
|
8
|
+
Project-URL: Source, https://github.com/HelloTomBruce/kb-mcp-lite
|
|
9
|
+
Project-URL: Issues, https://github.com/HelloTomBruce/kb-mcp-lite/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/HelloTomBruce/kb-mcp-lite/releases
|
|
11
|
+
Keywords: knowledge-base,mcp,agent,sqlite,fts5,vector-search,semantic-search,lightweight
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: click>=8.1
|
|
24
|
+
Requires-Dist: pydantic>=2.5
|
|
25
|
+
Requires-Dist: mcp>=1.0
|
|
26
|
+
Requires-Dist: python-frontmatter>=1.0
|
|
27
|
+
Requires-Dist: httpx>=0.27
|
|
28
|
+
Provides-Extra: vec
|
|
29
|
+
Requires-Dist: sqlite-vec>=0.1.0; extra == "vec"
|
|
30
|
+
Requires-Dist: pysqlite3>=0.5; extra == "vec"
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
34
|
+
Requires-Dist: ruff; extra == "dev"
|
|
35
|
+
Requires-Dist: mypy; extra == "dev"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
<div align="center">
|
|
39
|
+
|
|
40
|
+
# kb-mcp
|
|
41
|
+
|
|
42
|
+
**An agent-native knowledge base.**
|
|
43
|
+
|
|
44
|
+
`pip install kb-mcp` — give any LLM agent a structured, queryable, local-first second brain.
|
|
45
|
+
|
|
46
|
+
[](https://pypi.org/project/kb-mcp/)
|
|
47
|
+
[](https://www.python.org/)
|
|
48
|
+
[](./LICENSE)
|
|
49
|
+
[](https://modelcontextprotocol.io/)
|
|
50
|
+
[](#status)
|
|
51
|
+
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## The problem
|
|
57
|
+
|
|
58
|
+
Knowledge bases for humans (Notion, Obsidian) and for search engines
|
|
59
|
+
(Elasticsearch, vector DBs) leave a gap: **LLM agents need a knowledge layer
|
|
60
|
+
that speaks their protocol and assumes the reader is a model, not a person.**
|
|
61
|
+
|
|
62
|
+
`kb-mcp` fills it.
|
|
63
|
+
|
|
64
|
+
| | Obsidian / Notion | Vector DBs (Chroma / LanceDB) | **`kb-mcp`** |
|
|
65
|
+
|---|---|---|---|
|
|
66
|
+
| Reader-optimised for | Humans | Embeddings | **LLM agents** |
|
|
67
|
+
| Protocol | Web UI | SDK | **MCP (stdio)** |
|
|
68
|
+
| Schema | Free-form | Free-form | **Typed (project / decision / lesson / ...)** |
|
|
69
|
+
| Default storage | Cloud / proprietary | Local files | **SQLite + FTS5** |
|
|
70
|
+
| Setup | Sign up | `pip install` + configure | **`pip install` and go** |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Features
|
|
75
|
+
|
|
76
|
+
- **🧠 Agent-native.** Every document is reachable from any MCP client
|
|
77
|
+
(`Claude Desktop`, `Cursor`, `OpenCode`, `Codex`, …) via
|
|
78
|
+
`kb_search` / `kb_get` / `kb_add` / `kb_link`.
|
|
79
|
+
- **📐 Schema-first.** Six built-in document types
|
|
80
|
+
(`project`, `decision`, `lesson`, `glossary`, `person`, `faq`) —
|
|
81
|
+
extensible via Python subclassing.
|
|
82
|
+
- **🔍 Full-text search.** SQLite FTS5 with BM25 ranking. Snippet-aware
|
|
83
|
+
results returned to the agent.
|
|
84
|
+
- **🔗 Typed links.** Documents reference other documents; backlinks are
|
|
85
|
+
automatic.
|
|
86
|
+
- **📝 Markdown friendly.** Round-trip import/export with frontmatter.
|
|
87
|
+
Humans can edit, agents can read.
|
|
88
|
+
- **🪶 Zero deps by default.** SQLite ships with Python. `pip install kb-mcp`
|
|
89
|
+
and you're done.
|
|
90
|
+
- **🔒 Local-first.** Your data lives in `~/.local/share/kb-mcp/`. No
|
|
91
|
+
cloud, no telemetry, no phone-home.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Quickstart
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
pip install kb-mcp
|
|
99
|
+
kb init
|
|
100
|
+
kb add --type project --title "kb-mcp" --tags kb,mcp,open-source --body "Agent-native knowledge base."
|
|
101
|
+
kb search "mcp server"
|
|
102
|
+
|
|
103
|
+
# Expose to any MCP client
|
|
104
|
+
kb serve
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
That's it. Five commands, zero config files.
|
|
108
|
+
|
|
109
|
+
👉 Full walkthrough: [docs/quickstart.md](./docs/quickstart.md)
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Document types
|
|
114
|
+
|
|
115
|
+
| Type | Purpose | Example |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| `project` | Repo / initiative background | `kb-mcp`, `micro-app-fork` |
|
|
118
|
+
| `decision` | Architecture Decision Record (ADR) | "Use SQLite FTS5 over Elasticsearch" |
|
|
119
|
+
| `lesson` | Post-mortem / lessons learned | "Don't `last_insert_rowid()` across multi-INSERT batches" |
|
|
120
|
+
| `glossary` | Term definitions | `FTS5`, `MCP`, `ADR` |
|
|
121
|
+
| `person` | People the agent should recognise | "Zhang Bei, owner, uses Hermes" |
|
|
122
|
+
| `faq` | Frequently asked questions | "Why SQLite?" |
|
|
123
|
+
|
|
124
|
+
Subclass `kb_mcp.schema.Document` to add your own.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## MCP integration
|
|
129
|
+
|
|
130
|
+
Add to `~/.config/claude_desktop_config.json` (or any MCP client):
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"mcpServers": {
|
|
135
|
+
"kb": {
|
|
136
|
+
"command": "kb",
|
|
137
|
+
"args": ["serve"]
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The agent then sees four tools:
|
|
144
|
+
|
|
145
|
+
- `kb_search(query, type?, tags?, limit?)` — BM25-ranked results with snippets
|
|
146
|
+
- `kb_get(id)` — full document by id (or slug)
|
|
147
|
+
- `kb_add(type, title, body, tags?, source?)` — create document
|
|
148
|
+
- `kb_link(from_id, to_id, rel?)` — typed edge between documents
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Development
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
git clone https://github.com/your-org/kb-mcp
|
|
156
|
+
cd kb-mcp
|
|
157
|
+
pip install -e ".[dev]"
|
|
158
|
+
pytest # unit + E2E (real SQLite temp file, no mocks)
|
|
159
|
+
ruff check .
|
|
160
|
+
mypy src/
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
👉 Spec: [docs/requirements.md](./docs/requirements.md) ·
|
|
164
|
+
Architecture: [docs/architecture.md](./docs/architecture.md) ·
|
|
165
|
+
CLI reference: [docs/cli-reference.md](./docs/cli-reference.md)
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Roadmap
|
|
170
|
+
|
|
171
|
+
| Version | Scope | Status |
|
|
172
|
+
|---|---|---|
|
|
173
|
+
| **v0.1.0** | CLI + MCP server + SQLite/FTS5 + 6 doc types + Markdown I/O | 🚧 in progress |
|
|
174
|
+
| v0.2.0 | Vector search (sqlite-vss) as opt-in, hybrid BM25 + embedding ranking | planned |
|
|
175
|
+
| v0.3.0 | Multi-vault (per-project isolated KBs) + shared-vault mode | planned |
|
|
176
|
+
| v0.4.0 | Web UI (read-only) + collaborative editing hints | exploring |
|
|
177
|
+
| v1.0.0 | Postgres backend, multi-user auth, hosted mode | exploring |
|
|
178
|
+
|
|
179
|
+
See [docs/requirements.md](./docs/requirements.md) § 4 for v0.1 scope decisions
|
|
180
|
+
and out-of-scope list.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Status
|
|
185
|
+
|
|
186
|
+
**alpha.** API and storage format may change before v0.2.0. Pin minor versions
|
|
187
|
+
(`kb-mcp>=0.1,<0.2`) in production.
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Contributing
|
|
192
|
+
|
|
193
|
+
Issues and PRs welcome. See
|
|
194
|
+
[CONTRIBUTING.md](./CONTRIBUTING.md) (TODO before v0.1.0 release).
|
|
195
|
+
|
|
196
|
+
By participating, you agree to abide by the
|
|
197
|
+
[Code of Conduct](./CODE_OF_CONDUCT.md) (TODO before v0.1.0 release).
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## License
|
|
202
|
+
|
|
203
|
+
[MIT](./LICENSE) — do what you want, just keep the copyright notice.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# kb-mcp
|
|
4
|
+
|
|
5
|
+
**An agent-native knowledge base.**
|
|
6
|
+
|
|
7
|
+
`pip install kb-mcp` — give any LLM agent a structured, queryable, local-first second brain.
|
|
8
|
+
|
|
9
|
+
[](https://pypi.org/project/kb-mcp/)
|
|
10
|
+
[](https://www.python.org/)
|
|
11
|
+
[](./LICENSE)
|
|
12
|
+
[](https://modelcontextprotocol.io/)
|
|
13
|
+
[](#status)
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## The problem
|
|
20
|
+
|
|
21
|
+
Knowledge bases for humans (Notion, Obsidian) and for search engines
|
|
22
|
+
(Elasticsearch, vector DBs) leave a gap: **LLM agents need a knowledge layer
|
|
23
|
+
that speaks their protocol and assumes the reader is a model, not a person.**
|
|
24
|
+
|
|
25
|
+
`kb-mcp` fills it.
|
|
26
|
+
|
|
27
|
+
| | Obsidian / Notion | Vector DBs (Chroma / LanceDB) | **`kb-mcp`** |
|
|
28
|
+
|---|---|---|---|
|
|
29
|
+
| Reader-optimised for | Humans | Embeddings | **LLM agents** |
|
|
30
|
+
| Protocol | Web UI | SDK | **MCP (stdio)** |
|
|
31
|
+
| Schema | Free-form | Free-form | **Typed (project / decision / lesson / ...)** |
|
|
32
|
+
| Default storage | Cloud / proprietary | Local files | **SQLite + FTS5** |
|
|
33
|
+
| Setup | Sign up | `pip install` + configure | **`pip install` and go** |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Features
|
|
38
|
+
|
|
39
|
+
- **🧠 Agent-native.** Every document is reachable from any MCP client
|
|
40
|
+
(`Claude Desktop`, `Cursor`, `OpenCode`, `Codex`, …) via
|
|
41
|
+
`kb_search` / `kb_get` / `kb_add` / `kb_link`.
|
|
42
|
+
- **📐 Schema-first.** Six built-in document types
|
|
43
|
+
(`project`, `decision`, `lesson`, `glossary`, `person`, `faq`) —
|
|
44
|
+
extensible via Python subclassing.
|
|
45
|
+
- **🔍 Full-text search.** SQLite FTS5 with BM25 ranking. Snippet-aware
|
|
46
|
+
results returned to the agent.
|
|
47
|
+
- **🔗 Typed links.** Documents reference other documents; backlinks are
|
|
48
|
+
automatic.
|
|
49
|
+
- **📝 Markdown friendly.** Round-trip import/export with frontmatter.
|
|
50
|
+
Humans can edit, agents can read.
|
|
51
|
+
- **🪶 Zero deps by default.** SQLite ships with Python. `pip install kb-mcp`
|
|
52
|
+
and you're done.
|
|
53
|
+
- **🔒 Local-first.** Your data lives in `~/.local/share/kb-mcp/`. No
|
|
54
|
+
cloud, no telemetry, no phone-home.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Quickstart
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install kb-mcp
|
|
62
|
+
kb init
|
|
63
|
+
kb add --type project --title "kb-mcp" --tags kb,mcp,open-source --body "Agent-native knowledge base."
|
|
64
|
+
kb search "mcp server"
|
|
65
|
+
|
|
66
|
+
# Expose to any MCP client
|
|
67
|
+
kb serve
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
That's it. Five commands, zero config files.
|
|
71
|
+
|
|
72
|
+
👉 Full walkthrough: [docs/quickstart.md](./docs/quickstart.md)
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Document types
|
|
77
|
+
|
|
78
|
+
| Type | Purpose | Example |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| `project` | Repo / initiative background | `kb-mcp`, `micro-app-fork` |
|
|
81
|
+
| `decision` | Architecture Decision Record (ADR) | "Use SQLite FTS5 over Elasticsearch" |
|
|
82
|
+
| `lesson` | Post-mortem / lessons learned | "Don't `last_insert_rowid()` across multi-INSERT batches" |
|
|
83
|
+
| `glossary` | Term definitions | `FTS5`, `MCP`, `ADR` |
|
|
84
|
+
| `person` | People the agent should recognise | "Zhang Bei, owner, uses Hermes" |
|
|
85
|
+
| `faq` | Frequently asked questions | "Why SQLite?" |
|
|
86
|
+
|
|
87
|
+
Subclass `kb_mcp.schema.Document` to add your own.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## MCP integration
|
|
92
|
+
|
|
93
|
+
Add to `~/.config/claude_desktop_config.json` (or any MCP client):
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"mcpServers": {
|
|
98
|
+
"kb": {
|
|
99
|
+
"command": "kb",
|
|
100
|
+
"args": ["serve"]
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The agent then sees four tools:
|
|
107
|
+
|
|
108
|
+
- `kb_search(query, type?, tags?, limit?)` — BM25-ranked results with snippets
|
|
109
|
+
- `kb_get(id)` — full document by id (or slug)
|
|
110
|
+
- `kb_add(type, title, body, tags?, source?)` — create document
|
|
111
|
+
- `kb_link(from_id, to_id, rel?)` — typed edge between documents
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Development
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
git clone https://github.com/your-org/kb-mcp
|
|
119
|
+
cd kb-mcp
|
|
120
|
+
pip install -e ".[dev]"
|
|
121
|
+
pytest # unit + E2E (real SQLite temp file, no mocks)
|
|
122
|
+
ruff check .
|
|
123
|
+
mypy src/
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
👉 Spec: [docs/requirements.md](./docs/requirements.md) ·
|
|
127
|
+
Architecture: [docs/architecture.md](./docs/architecture.md) ·
|
|
128
|
+
CLI reference: [docs/cli-reference.md](./docs/cli-reference.md)
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Roadmap
|
|
133
|
+
|
|
134
|
+
| Version | Scope | Status |
|
|
135
|
+
|---|---|---|
|
|
136
|
+
| **v0.1.0** | CLI + MCP server + SQLite/FTS5 + 6 doc types + Markdown I/O | 🚧 in progress |
|
|
137
|
+
| v0.2.0 | Vector search (sqlite-vss) as opt-in, hybrid BM25 + embedding ranking | planned |
|
|
138
|
+
| v0.3.0 | Multi-vault (per-project isolated KBs) + shared-vault mode | planned |
|
|
139
|
+
| v0.4.0 | Web UI (read-only) + collaborative editing hints | exploring |
|
|
140
|
+
| v1.0.0 | Postgres backend, multi-user auth, hosted mode | exploring |
|
|
141
|
+
|
|
142
|
+
See [docs/requirements.md](./docs/requirements.md) § 4 for v0.1 scope decisions
|
|
143
|
+
and out-of-scope list.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Status
|
|
148
|
+
|
|
149
|
+
**alpha.** API and storage format may change before v0.2.0. Pin minor versions
|
|
150
|
+
(`kb-mcp>=0.1,<0.2`) in production.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Contributing
|
|
155
|
+
|
|
156
|
+
Issues and PRs welcome. See
|
|
157
|
+
[CONTRIBUTING.md](./CONTRIBUTING.md) (TODO before v0.1.0 release).
|
|
158
|
+
|
|
159
|
+
By participating, you agree to abide by the
|
|
160
|
+
[Code of Conduct](./CODE_OF_CONDUCT.md) (TODO before v0.1.0 release).
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
[MIT](./LICENSE) — do what you want, just keep the copyright notice.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "kb-mcp-lite"
|
|
7
|
+
version = "0.2.1"
|
|
8
|
+
description = "Lightweight agent-native knowledge base. SQLite + FTS5 + vec0 + MCP server."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "HelloTomBruce (Zhang Bei)" }]
|
|
13
|
+
keywords = [
|
|
14
|
+
"knowledge-base",
|
|
15
|
+
"mcp",
|
|
16
|
+
"agent",
|
|
17
|
+
"sqlite",
|
|
18
|
+
"fts5",
|
|
19
|
+
"vector-search",
|
|
20
|
+
"semantic-search",
|
|
21
|
+
"lightweight",
|
|
22
|
+
]
|
|
23
|
+
classifiers = [
|
|
24
|
+
"Development Status :: 3 - Alpha",
|
|
25
|
+
"Intended Audience :: Developers",
|
|
26
|
+
"License :: OSI Approved :: MIT License",
|
|
27
|
+
"Programming Language :: Python :: 3",
|
|
28
|
+
"Programming Language :: Python :: 3.10",
|
|
29
|
+
"Programming Language :: Python :: 3.11",
|
|
30
|
+
"Programming Language :: Python :: 3.12",
|
|
31
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
32
|
+
]
|
|
33
|
+
dependencies = [
|
|
34
|
+
"click>=8.1",
|
|
35
|
+
"pydantic>=2.5",
|
|
36
|
+
"mcp>=1.0",
|
|
37
|
+
"python-frontmatter>=1.0",
|
|
38
|
+
"httpx>=0.27",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.optional-dependencies]
|
|
42
|
+
# vec: install for semantic search (vec0 + pysqlite3). pysqlite3
|
|
43
|
+
# ships precompiled wheels for Linux x86_64/arm64 and macOS x86_64
|
|
44
|
+
# /arm64; it provides a SQLite build with extension support (which
|
|
45
|
+
# the stdlib ``sqlite3`` lacks on Python 3.12+). Without this extra
|
|
46
|
+
# the package still works — semantic search is silently disabled.
|
|
47
|
+
vec = [
|
|
48
|
+
"sqlite-vec>=0.1.0",
|
|
49
|
+
"pysqlite3>=0.5",
|
|
50
|
+
]
|
|
51
|
+
dev = [
|
|
52
|
+
"pytest>=8",
|
|
53
|
+
"pytest-cov",
|
|
54
|
+
"ruff",
|
|
55
|
+
"mypy",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
[project.scripts]
|
|
59
|
+
kb = "kb_mcp_lite.cli:main"
|
|
60
|
+
|
|
61
|
+
[project.urls]
|
|
62
|
+
Homepage = "https://github.com/HelloTomBruce/kb-mcp-lite"
|
|
63
|
+
Source = "https://github.com/HelloTomBruce/kb-mcp-lite"
|
|
64
|
+
Issues = "https://github.com/HelloTomBruce/kb-mcp-lite/issues"
|
|
65
|
+
Changelog = "https://github.com/HelloTomBruce/kb-mcp-lite/releases"
|
|
66
|
+
|
|
67
|
+
[tool.ruff]
|
|
68
|
+
line-length = 100
|
|
69
|
+
target-version = "py310"
|
|
70
|
+
|
|
71
|
+
[tool.pytest.ini_options]
|
|
72
|
+
testpaths = ["tests"]
|
|
73
|
+
addopts = "-q"
|
|
74
|
+
|
|
75
|
+
[tool.mypy]
|
|
76
|
+
python_version = "3.10"
|
|
77
|
+
strict_optional = true
|
|
78
|
+
warn_redundant_casts = true
|
|
79
|
+
warn_unused_ignores = true
|
|
80
|
+
|
|
81
|
+
[tool.setuptools.package-data]
|
|
82
|
+
"kb_mcp_lite" = ["migrations/*.sql"] # SQLite DDL files loaded at runtime
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""kb-mcp-lite: lightweight agent-native knowledge base.
|
|
2
|
+
|
|
3
|
+
A local-first, schema-first, MCP-native knowledge base for LLM agents.
|
|
4
|
+
See https://github.com/HelloTomBruce/kb-mcp-lite for the full spec.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from kb_mcp_lite.schema import (
|
|
8
|
+
Decision,
|
|
9
|
+
Document,
|
|
10
|
+
DocumentType,
|
|
11
|
+
DoctorCheck,
|
|
12
|
+
DoctorReport,
|
|
13
|
+
DuplicateError,
|
|
14
|
+
Faq,
|
|
15
|
+
Glossary,
|
|
16
|
+
ImportReport,
|
|
17
|
+
IntegrityError,
|
|
18
|
+
KbMcpError,
|
|
19
|
+
Lesson,
|
|
20
|
+
Link,
|
|
21
|
+
NotFoundError,
|
|
22
|
+
Person,
|
|
23
|
+
Project,
|
|
24
|
+
SearchHit,
|
|
25
|
+
TypeRegistry,
|
|
26
|
+
ValidationError,
|
|
27
|
+
default_registry,
|
|
28
|
+
make_id,
|
|
29
|
+
slugify,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
__version__ = "0.2.1"
|
|
33
|
+
|
|
34
|
+
__all__ = [
|
|
35
|
+
"__version__",
|
|
36
|
+
# schema
|
|
37
|
+
"Document",
|
|
38
|
+
"DocumentType",
|
|
39
|
+
"Project",
|
|
40
|
+
"Decision",
|
|
41
|
+
"Lesson",
|
|
42
|
+
"Glossary",
|
|
43
|
+
"Person",
|
|
44
|
+
"Faq",
|
|
45
|
+
"Link",
|
|
46
|
+
"SearchHit",
|
|
47
|
+
"ImportReport",
|
|
48
|
+
"DoctorCheck",
|
|
49
|
+
"DoctorReport",
|
|
50
|
+
"TypeRegistry",
|
|
51
|
+
"default_registry",
|
|
52
|
+
"make_id",
|
|
53
|
+
"slugify",
|
|
54
|
+
# exceptions
|
|
55
|
+
"KbMcpError",
|
|
56
|
+
"NotFoundError",
|
|
57
|
+
"DuplicateError",
|
|
58
|
+
"ValidationError",
|
|
59
|
+
"IntegrityError",
|
|
60
|
+
]
|