3.1 KiB
3.1 KiB
1. Remove collections from MCP server
- 1.1 Remove collection constants and helper functions from
mcp/server.py(COLLECTION_TAG_PREFIX,DEFAULT_COLLECTION,_collection_tag,_strip_collection_tags,_process_document,_process_search_results,_ensure_exclusive_collection) - 1.2 Remove
collectionparameter fromkb_search,kb_addnote,kb_upload_starttools - 1.3 Remove
kb_set_collectiontool entirely - 1.4 Remove
_process_document/_process_search_resultscalls fromkb_get,kb_update_note,kb_search - 1.5 Update MCP server instructions text to reflect tags-only approach
2. Engine bulk infrastructure
- 2.1 Add
bulk_safety_percenttoConfigclass inengine/kb/config.py(env varKB_BULK_SAFETY_PERCENT, default 70) - 2.2 Add
job_typecolumn migration todatabase.pyinit_schema(TEXT, default "ingest") - 2.3 Add
resolve_bulk_selection(conn, document_ids, tags, doc_type, from_id, to_id)helper todatabase.py— returns list of matching document IDs - 2.4 Add
create_bulk_job(conn, job_type, filters_json, matched, succeeded, failed, errors_json)helper todatabase.py
3. Engine bulk endpoints
- 3.1 Create
engine/kb/routes/bulk.pywith shared Pydantic request model (BulkSelectionRequestwith selection fields +forcebool) - 3.2 Add
_check_safety_thresholdhelper that returns 409 if threshold exceeded - 3.3 Implement
POST /api/v1/bulk/delete— resolve selection, check threshold, delete documents in transaction, clean up files, log job, return summary - 3.4 Implement
POST /api/v1/bulk/tags— resolve selection, check threshold, add/remove tags on matched docs, log job, return summary - 3.5 Implement
POST /api/v1/bulk/set-tags— resolve selection, check threshold, clear and replace tags on matched docs, log job, return summary - 3.6 Import bulk routes in engine app startup (add to
engine/kb/routes/__init__.pyormain.py)
4. MCP bulk tools
- 4.1 Add
bulk_delete,bulk_tags,bulk_set_tagsmethods tomcp/engine.py - 4.2 Add
kb_bulk_deletetool tomcp/server.py - 4.3 Add
kb_bulk_tagstool tomcp/server.py - 4.4 Add
kb_bulk_set_tagstool tomcp/server.py
5. CLI bulk commands
- 5.1 Create
client/cmd/bulk_remove.go—kb bulk-removewith filter flags, confirmation prompt, JSON output support - 5.2 Create
client/cmd/bulk_tag.go—kb bulk-tagwith filter flags +--add/--remove, confirmation prompt - 5.3 Create
client/cmd/bulk_set_tags.go—kb bulk-set-tagswith filter flags +--set, confirmation prompt
6. Verification
- 6.1 Test collection removal: verify
kb_search,kb_addnote,kb_get,kb_update_note,kb_upload_startwork without collection params - 6.2 Test bulk delete via engine API: filter by tags, by IDs, by range, safety threshold trigger and force override
- 6.3 Test bulk tags and bulk set-tags via engine API
- 6.4 Test MCP bulk tools against running engine
- 6.5 Test CLI bulk commands against running engine
- 6.6 Test audit trail: verify bulk jobs appear in
kb jobsoutput