feat(25-02): add MCP catalog tools upsert_catalog_item and bulk_upsert_catalog

- New catalog.ts with catalogToolDefinitions and registerCatalogTools
- upsert_catalog_item: single item upsert with full attribution fields (SEED-03)
- bulk_upsert_catalog: batch upsert up to 100 items with created/updated counts
- Registered in createMcpServer after image tools
- 6 new MCP catalog tool tests passing
This commit is contained in:
2026-04-10 11:03:50 +02:00
parent 6491615b1d
commit df6c75f164
3 changed files with 230 additions and 0 deletions

View File

@@ -6,6 +6,10 @@ import { db as prodDb } from "../../db/index.ts";
import { verifyApiKey } from "../services/auth.service.ts";
import { verifyAccessToken } from "../services/oauth.service.ts";
import { getCollectionSummary } from "./resources/collection.ts";
import {
catalogToolDefinitions,
registerCatalogTools,
} from "./tools/catalog.ts";
import {
categoryToolDefinitions,
registerCategoryTools,
@@ -55,6 +59,13 @@ function createMcpServer(db: Db, userId: number): McpServer {
server.tool(def.name, def.description, def.inputSchema, handler);
}
// Register catalog tools (no userId needed — catalog is global)
const catalogHandlers = registerCatalogTools(db);
for (const def of catalogToolDefinitions) {
const handler = catalogHandlers[def.name as keyof typeof catalogHandlers];
server.tool(def.name, def.description, def.inputSchema, handler);
}
// Register collection summary resource
server.resource(
"collection-summary",