cob-rag-mcp 0.0.0-stage → 0.2.0
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/CHANGELOG.md +169 -0
- package/LICENSE +21 -0
- package/README.md +568 -2
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.js +3383 -0
- package/dist/index.d.ts +18377 -0
- package/dist/index.js +2790 -0
- package/package.json +78 -5
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.2.0] - 2026-11-12
|
|
10
|
+
|
|
11
|
+
The first public release, for cob-rag-engine 0.2.0.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- **Licence: MIT.** cob-rag-mcp is now under the MIT licence, like the client libraries of cob-rag-engine.
|
|
16
|
+
The engine itself stays AGPL-3.0. Earlier releases were AGPL-3.0-only.
|
|
17
|
+
|
|
18
|
+
Catches up with the engine's current API (`docs/openapi.json` regenerated). Needs an engine with
|
|
19
|
+
paged corpus and job lists, `/info`, `/tenants/me`, `/documents/{id}`, `/feedback` (GET) and
|
|
20
|
+
`/migrations`, and, for the team, plan and settings tools, the engine's accounts layer (plans,
|
|
21
|
+
teams, engine settings).
|
|
22
|
+
|
|
23
|
+
Engine types: handoffs (C5).
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- **Lead tools** (engine conversation layer C4): `list_leads` (filters by status, knowledge base, dates and an exact phone or e-mail) and `export_leads` (CSV; the engine allows owners only and audits every export). Tenant and admin keys only; the engine gives lead data to a `write` key, so both tools are `write`: a read key does not see them and read-only mode hides them. CLI: `leads list`, `leads export`. Needs an engine with `phase12_003`.
|
|
27
|
+
- **Assistant tools** (engine conversation layer): `get_assistant`, `update_assistant_draft` (a JSON
|
|
28
|
+
merge patch over the draft, sent with the draft revision it read so a stale edit is refused) and
|
|
29
|
+
`publish_assistant`. All three are offered to every key kind; reading is `read`, the other two are
|
|
30
|
+
`write` (publishing is reversible in the engine, so it is not destructive). CLI: `assistant get`,
|
|
31
|
+
`assistant draft`, `assistant publish`. Needs an engine with `phase12_001`.
|
|
32
|
+
- **Key permissions** (engine named keys): the server reads the key's `permission` (`read`, `write`
|
|
33
|
+
or `full`, new in `whoami`) and offers only the tools it allows, so a read key never sees a write
|
|
34
|
+
or destructive tool. A refused call says what permission it needs (`key_permission_denied`).
|
|
35
|
+
- **Delete guardrails**: `delete_corpus`, `delete_document` and `delete_tenant` require
|
|
36
|
+
`confirm_name`, the item's exact name, and new read-only tools `preview_delete_corpus`,
|
|
37
|
+
`preview_delete_document` and `preview_delete_tenant` (CLI: `... delete-preview`) show what a
|
|
38
|
+
delete would remove and the name to confirm with. The engine's `confirmation_required` error is
|
|
39
|
+
explained in words.
|
|
40
|
+
- README: "Install before npm publish" (`git clone`, `pnpm install && pnpm build && npm link`) and a
|
|
41
|
+
"Key permissions" section.
|
|
42
|
+
- **Website** at https://callobuzz.github.io/cob-rag-mcp (GitHub Pages from `docs/`, not shipped in the npm package); `homepage` points to it, and the README links to the engine, its site and npm.
|
|
43
|
+
- **Skipped uploads**: the engine can now drop a near-duplicate upload (`skipped` job status); `get_ingest_job` and `--wait` treat it as settled. Types regenerated.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
- **Team tools** (engine accounts A5): `list_team` (`team list`; a tenant key its own team, the
|
|
47
|
+
admin key any tenant's with `tenant_id`: owners and members with their last sign-in, and open
|
|
48
|
+
invitations), `invite_member` (`team invite`, tenant key: the engine e-mails the link, never
|
|
49
|
+
returned) and `admin_invite` (`team admin-invite`, admin key: returns `accept_url`, the link to
|
|
50
|
+
send the person yourself, for example a customer's first owner on an engine without SMTP).
|
|
51
|
+
- **Plan tools** (engine accounts A6): `list_plans` (`plans list`, admin: the four limits and how
|
|
52
|
+
many tenants use each), `set_tenant_plan` (`plans set`, admin) and `get_my_plan`
|
|
53
|
+
(`plans usage`; a tenant key its own, the admin key any tenant's: questions this month and when
|
|
54
|
+
they reset, knowledge bases, documents and widget keys against the limits). `activate_tenant`
|
|
55
|
+
takes `plan_id`; `create_tenant` takes `plan_id`, and `max_corpora` up to 10,000 (a per-tenant
|
|
56
|
+
override of the plan's knowledge-base limit).
|
|
57
|
+
- **Engine settings tools** (engine accounts A7): `get_settings` (`engine settings`) and
|
|
58
|
+
`update_settings` (`engine update-settings`), admin key: the sign-up mode (`open`, `approval`,
|
|
59
|
+
`closed`) and white-label branding; null resets a field.
|
|
60
|
+
- **Errors by the engine's code**: `question_cap_reached` reads "This workspace has used all the
|
|
61
|
+
questions its plan allows this month; they reset at …" with the engine's `resets_at`;
|
|
62
|
+
`kb_limit_reached`, `document_limit_reached` and `widget_key_limit_reached` name the plan limit
|
|
63
|
+
(with the engine's `limit`); these carry the new error code `LIMIT`. `owner_required` reads "Only
|
|
64
|
+
a workspace owner can do this". Any other error keeps the engine's `detail`.
|
|
65
|
+
- The live integration test covers the tenant-required corpus create, suspend and reactivate with
|
|
66
|
+
the typed name, plans, plan usage, an admin invitation, the team list and the settings; it
|
|
67
|
+
deletes its tenant with the typed name (the engine's hard delete refuses it otherwise).
|
|
68
|
+
- **Tenant lifecycle** (engine accounts A4). `deactivate_tenant` is gone: the engine's
|
|
69
|
+
`DELETE /api/v1/admin/tenants/{id}` is now a hard delete that needs the tenant's name typed, and
|
|
70
|
+
answers the old call with 422. New tools: `suspend_tenant` (destructive; `confirm_name`, the
|
|
71
|
+
tenant's exact name, required; every key, widget and sign-in of the tenant stops),
|
|
72
|
+
`reactivate_tenant`, `activate_tenant` (a pending sign-up, optional `note`), `decline_tenant`
|
|
73
|
+
(destructive; removes a pending sign-up) and `delete_tenant` (destructive; `confirm_name`
|
|
74
|
+
required; the tenant and everything it owns). `list_tenants` shows status and owners and takes
|
|
75
|
+
`status`, `search`, `offset` and `limit` (the engine's list is paged now). A 403 with the
|
|
76
|
+
engine's code `workspace_not_active` reads "This workspace is not active (pending or
|
|
77
|
+
suspended); ask the operator." Generated engine types regenerated.
|
|
78
|
+
- **Every corpus belongs to a tenant** (engine accounts A1). `create_corpus` with the admin key
|
|
79
|
+
needs `tenant_id` (the engine answers 422 `tenant_required` without it; a tenant key still
|
|
80
|
+
creates for itself), and `update_corpus` no longer accepts `tenant_id: null`: a corpus can be
|
|
81
|
+
moved to another tenant but not detached. Generated engine types regenerated.
|
|
82
|
+
- **`list_corpora` is paged**, as the engine's `GET /api/v1/corpora` now is (100 per page unless
|
|
83
|
+
`limit` says otherwise, at most 500). It takes `offset`, `limit` and `tenant_id`, and `all: true`
|
|
84
|
+
fetches every page. Results carry `count` (this page) and `total`; each corpus carries its tenant,
|
|
85
|
+
document and chunk counts and last activity. The CLI shows those columns and says when more pages
|
|
86
|
+
exist (`corpora 1-100 of 240. More: --offset 100, or --all for every page`).
|
|
87
|
+
- **Documents and settings tools work with admin and tenant keys**: `list_documents`,
|
|
88
|
+
`list_document_versions`, `delete_document`, `get_corpus_settings` and `update_corpus_settings`
|
|
89
|
+
take `corpus_id` (or the `COB_RAG_CORPUS_ID` default) and are offered to every key kind. A corpus
|
|
90
|
+
key still never sees the field.
|
|
91
|
+
- `list_documents` takes `search` (part of the file name or record id) and shows record ids and
|
|
92
|
+
metadata; the CLI says which page it is.
|
|
93
|
+
- `list_ingest_jobs` takes `status`, `corpus_id`, `offset` and `limit` (at most 100 now, as the
|
|
94
|
+
engine enforces) and shows each job's corpus, file and mode with the page and total.
|
|
95
|
+
`get_ingest_job` shows the new job fields and, for an upload held in `pending_review`, the
|
|
96
|
+
existing documents it resembles.
|
|
97
|
+
- `create_corpus` takes `embedding_config`; `update_corpus` takes `tenant_id` (admin key: move a
|
|
98
|
+
corpus to another tenant).
|
|
99
|
+
- A `corpus_id` that only filters a list (jobs, feedback, migrations) never takes the configured
|
|
100
|
+
default corpus.
|
|
101
|
+
|
|
102
|
+
### Added
|
|
103
|
+
- `get_engine_info` (`info`, any key): engine version, features, embedding and LLM models, public
|
|
104
|
+
URL and limits.
|
|
105
|
+
- `get_document` (`documents get`, any key, *corpus_id*): a document with its versions and the
|
|
106
|
+
chunks the engine indexed, paged with `chunk_offset` / `chunk_limit`, or another version's with
|
|
107
|
+
`version_id`.
|
|
108
|
+
- `list_feedback` (`feedback list`, any key): ratings with their questions, filtered by corpus,
|
|
109
|
+
rating range and time, paged.
|
|
110
|
+
- `list_migrations` (`migrations list`, admin and tenant keys, read-only): embedding migrations
|
|
111
|
+
across corpora, filtered by corpus and status, paged.
|
|
112
|
+
- `get_my_tenant` (`tenants me`) and `rotate_my_tenant_key` (`tenants rotate-my-key`), tenant keys
|
|
113
|
+
only. Rotation is destructive: hidden over MCP unless destructive tools are allowed, and the CLI
|
|
114
|
+
warns that the key in use (and where it came from) stops working at once, asks or needs `--yes`,
|
|
115
|
+
then offers to save the new key to the config file (`--save-key` saves without asking) and
|
|
116
|
+
reminds you when `COB_RAG_API_KEY` or `--key` still holds the old one.
|
|
117
|
+
|
|
118
|
+
### Fixed
|
|
119
|
+
- CLI command summaries in `--help` were the whole description instead of its first sentence.
|
|
120
|
+
|
|
121
|
+
## [0.1.0] - 2026-09-29
|
|
122
|
+
|
|
123
|
+
First release. An MCP server and a CLI for a self-hosted
|
|
124
|
+
[cob-rag-engine](https://github.com/callobuzz/cob-rag-engine), from one set of tool definitions.
|
|
125
|
+
|
|
126
|
+
### Added
|
|
127
|
+
- **26 tools**, each an MCP tool and a CLI command: `whoami`; `search` (passages with sources from
|
|
128
|
+
`/query/retrieve`) and `ask` (a cited answer from `/query`); documents
|
|
129
|
+
(list, versions, delete); ingest (text records, file upload, job status, job list); usage;
|
|
130
|
+
corpus self-service settings; corpora (list, get, create, update, rotate key, delete); widget
|
|
131
|
+
keys (list, create, revoke); tenants (list, create, rotate key, deactivate).
|
|
132
|
+
- **Streaming answers in the CLI.** `ask --stream` reads the engine's named `/query/stream` events
|
|
133
|
+
(`sources`, `token`, `done`, `error`): it prints the answer as it is generated, then its
|
|
134
|
+
sources and the model and latency; `--stream --json` prints one JSON event per line. An `error`
|
|
135
|
+
event, a stream cut off before `done`, and HTTP 422/502 before the stream starts are reported as
|
|
136
|
+
errors; an engine still sending the older unnamed `data:` format is named as such. MCP `ask`
|
|
137
|
+
stays a single complete answer from `/query`. Needs an engine with the named-event stream.
|
|
138
|
+
- **Clearing settings.** `update_corpus` and `update_corpus_settings` accept null: a field set to
|
|
139
|
+
null inside `llm_config` / `prompt_config` / `retrieval_config` is removed (the engine default
|
|
140
|
+
applies again), `llm_config.api_key: null` deletes the stored key, a whole section set to null
|
|
141
|
+
resets it, and `description: null` clears the description. On the command line, pass `null`
|
|
142
|
+
(`--description null`, `--llm-config '{"api_key": null}'`).
|
|
143
|
+
- `get_usage` lists the engine's `conversation` usage source.
|
|
144
|
+
- **Key-aware tool lists.** The MCP server calls `/api/v1/whoami` at start and registers only what
|
|
145
|
+
that key kind can use: a corpus key never sees tenant or admin tools, and never sees a
|
|
146
|
+
`corpus_id` field it cannot use.
|
|
147
|
+
- **Safety gates.** Destructive tools are hidden from MCP clients unless
|
|
148
|
+
`COB_RAG_ALLOW_DESTRUCTIVE=true` / `--allow-destructive`; the CLI asks before each one, or takes
|
|
149
|
+
`--yes`, and refuses when it cannot ask. `--read-only` / `COB_RAG_READ_ONLY` hides or refuses
|
|
150
|
+
every write. Tool annotations (`readOnlyHint`, `destructiveHint`) match.
|
|
151
|
+
- **Transports.** stdio (default) and stateless streamable HTTP (`start --transport http`), where
|
|
152
|
+
every request carries its own engine key (`Authorization: Bearer` or `X-API-Key`) and is
|
|
153
|
+
forwarded as-is. No fallback to a server-side key unless `COB_RAG_HTTP_USE_SERVER_KEY=true`.
|
|
154
|
+
Binds `127.0.0.1` by default, with a Host/Origin check against DNS rebinding.
|
|
155
|
+
- **Bring your own model key.** `COB_RAG_LLM_PROVIDER` / `_MODEL` / `_API_KEY` / `_BASE_URL` are
|
|
156
|
+
sent as the engine's `X-LLM-*` headers on the routes that read them.
|
|
157
|
+
- **Upload fence.** Over MCP, `upload_file` is stdio-only and reads only inside
|
|
158
|
+
`COB_RAG_UPLOAD_DIR`, checked before touching the filesystem and again after resolving symlinks.
|
|
159
|
+
- **Config.** Flags, then environment, then a per-user config file written owner-only;
|
|
160
|
+
`login` (validates with `/whoami` before saving), `config show/get/set/unset/path`, secrets
|
|
161
|
+
masked everywhere.
|
|
162
|
+
- **CLI output.** Readable tables by default, `--json` for machines; JSON options accept
|
|
163
|
+
`@file.json` and JSON lines.
|
|
164
|
+
- **`answer-with-citations` MCP prompt.**
|
|
165
|
+
- **Types generated from the engine's OpenAPI spec** (`pnpm gen:api`), so every request and
|
|
166
|
+
response is checked against the API at compile time.
|
|
167
|
+
- Unit tests for every tool, visibility, gating, config precedence and masking, both transports
|
|
168
|
+
and the upload guard; live integration tests gated on `COB_RAG_URL` + `COB_RAG_API_KEY`.
|
|
169
|
+
- Dockerfile for HTTP mode, CI workflow (lint, typecheck, test, build).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Callobuzz
|
|
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.
|