CatalogMCP
Enables natural-language setup and management of a governed digital product catalog, including schema, products, and rules, with dry-run previews, audit logging, and two-phase confirmations for destructive actions.
README
CatalogMCP
Setting up a digital product catalog today is either slow (click through a UI for every attribute and rule) or expensive (script it against an API, which turns labor cost into engineering cost for every future change). This is a spike proving a third option: an agent talking to a governed MCP tool surface can replace both. A catalog admin describes what they want in plain language — "add a Weight attribute in kg, required for all Industrial-line products" — and an agent executes it through tools that preview, log, and gate every change. Setup becomes a conversation instead of a UI marathon or an engineering ticket.
Demo
🎥 Watch the recorded demo — screen recording of the exact run described below.
The scripted client in demo/client.ts drives this server through
a real Claude tool-use loop (Anthropic Messages API, no mocking) and walks through:
- Browsing the empty catalog.
- A natural-language request to set up the catalog from an attached file of products and their attribute values — including the schema (attributes, a required-for-industrial-line rule) the import depends on.
- A dry-run preview surfacing two rows that fail validation, a back-and-forth to fix them, then a real commit of all five products.
- Reading the audit log the commit produced.
- Browsing the catalog again, now populated — closing the loop the same way it opened, via the agent, not a human refreshing a UI.
- A destructive request — delete the
materialattribute — held for confirmation with a data-aware blast-radius disclosure (5 affected products, by name), then confirmed. - A closing beat: the same request attempted against a read-only instance, cleanly refused.
The full text transcript of that same run is in
demo/transcript.txt — reproducible yourself by running
npm run demo.
What makes this MCP (not just an API)
MCP is a wire protocol — JSON-RPC 2.0 messages
over a transport (stdio here; HTTP/SSE elsewhere) — not a coding convention. A
small, fixed set of method names is standardized by the spec itself, so any
compliant client (Claude Desktop, this repo's own demo/client.ts, any other agent
framework) can talk to this server without knowing anything about catalogs,
attributes, or rules ahead of time.
The protocol methods
| Method | Direction | Purpose |
|---|---|---|
initialize |
client → server | Handshake: exchange protocol versions, negotiate capabilities |
notifications/initialized |
client → server | Client confirms it's ready |
tools/list |
client → server | Discovery — "what can you do?" Returns every tool's name, description, and JSON Schema input shape |
tools/call |
client → server | Invocation — "do this one, with these arguments" |
That's the entire surface an agent needs to know in advance. There's no
POST /create_attribute endpoint — an agent calls tools/call with
{"name": "create_attribute", "arguments": {...}}. A trimmed real exchange with
this server:
// → client
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05", ...}}
// ← server
{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2024-11-05","capabilities":{"tools":{"listChanged":true}},"serverInfo":{"name":"catalog-mcp","version":"0.1.0"}}}
// → client
{"jsonrpc":"2.0","id":2,"method":"tools/list"}
// ← server — every tool below, as name + description + JSON Schema
{"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"list_attributes", ...}, ...]}}
How it works in this codebase
We never wrote a tools/list or tools/call handler. Every call to
server.registerTool(name, config, handler) in src/tools/ appends
to an internal registry inside @modelcontextprotocol/sdk's McpServer. The SDK
answers tools/list by dumping that registry (converting our Zod schemas to JSON
Schema along the way) and answers tools/call by looking the requested name up in
the same registry and invoking its handler — none of that is our code. It's also
why the governance layer (src/governance/governed-registration.ts)
wraps registerTool itself rather than hooking into some HTTP middleware layer:
that single call is the only seam every tool invocation is guaranteed to pass
through.
The tools
12 tools, grouped by what they operate on. Every mutating tool accepts
dryRun: true for a no-persist preview; full argument shapes are in
src/tools/.
Schema (catalog structure — attributes, rules)
| Tool | Args | Mutating? |
|---|---|---|
list_attributes |
— | no |
get_attribute |
name |
no |
create_attribute |
name, type, enumValues?, unit?, dryRun? |
yes |
update_attribute |
name, type?, enumValues?, unit?, dryRun? |
yes |
delete_attribute |
name, confirmToken? |
yes — destructive, two-phase |
list_rules |
— | no |
create_rule |
attributeName, productLines, dryRun? |
yes |
Content (actual products)
| Tool | Args | Mutating? |
|---|---|---|
list_products |
— | no |
get_product |
sku |
no |
import_products |
rows, dryRun? |
yes — bulk, upsert, partial-commit |
set_attribute_value |
sku, attributeName, value, dryRun? |
yes |
Governance
| Tool | Args | Mutating? |
|---|---|---|
list_audit_log |
— | no |
Why the guardrails aren't optional
Nobody hands an ungoverned agent write access to a live product catalog. The preview/audit/approval layer isn't a safety feature bolted on afterward — it's the precondition that makes "just describe what you want" viable for something you can't afford to get wrong. Concretely, this server never lets a mutation happen blind:
- Dry-run preview — every mutating tool accepts
dryRun: trueand returns the exact outcome without persisting anything. - Audit log — every tool call is recorded (timestamp, tool, args, actor, outcome) and readable via its own tool, not just claimed to exist.
- Two-phase confirm on destructive ops — deleting an attribute first returns a blast-radius disclosure (a count and a sample of affected products) and a token; only a second call with that token executes, and if the catalog changed in between, the stale token is refused rather than honored.
- Policy mode — the server can run fully read-only, refusing every mutating tool at the gate, for a locked-down deployment.
See CONTEXT.md for the domain glossary and CLAUDE.md
for the full scope, tool surface, and explicit non-goals.
Setup
npm install
npm test # domain, tool, and governance tests, plus the 6-step demo acceptance test
npm run dev # start the MCP server over stdio (add --read-only to lock it down)
npm run demo # run the scripted Claude-driven demo client (needs ANTHROPIC_API_KEY)
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。