Skip to main content
Glama
catalog-mcp

catalog-mcp

by stevyf93II

catalog-mcp

CI

あらゆるJSONカタログをAIエージェント向けのクエリツールに変えるMCPサーバー。

カタログのURLまたはファイルを指定するだけで(在庫フィード、商品リスト、feedmergeが公開するcatalog.jsonなど)、あらゆるMCPクライアント(Claude Desktop、Claude Code、プロトコルに対応したもの)が、レコードに対して構造化フィルタリング、グループ化、ランキング、スキーマ発見を行えるようになります。

Node 18以上。実行時の依存関係は2つ:MCP SDKとzod。

なぜ必要か

エージェントは大きなJSONファイルを扱うのが苦手で、ツールを使うのが得意です。エージェントに2MBのカタログを渡すと、レコードを切り詰めたり、スキミングしたり、幻覚を起こしたりします。しかし、フィルター文法を備えたcatalog_queryを渡せば、「$30,000未満でこれら2つの特徴を持つ最も安いレコード」という質問に、毎回正しく、条件に合うレコードだけを読んで答えます。

このリポジトリは、私が本番環境で稼働させているMCPサーバーの一般化版です。ある販売フロアのAIアシスタントが、まさにこれらのツール(同じフィルターセマンティクス、同じnull価格ルール、同じTTLキャッシュ)を使って、1日に何百回もライブの在庫カタログをクエリしています。そのパイプラインは以下の通りです:

vendor feed  ->  feedmerge  ->  catalog.json  ->  catalog-mcp  ->  any agent
             (guarded sync)   (versioned)      (query tools)

私はこれを自分の公開在庫フィードに対して実行しています。以下の例では、リポジトリが単独で動作するように中立なカタログを使用しています。

Related MCP server: mcp-db-server

クイックスタート

git clone https://github.com/stevyf93II/catalog-mcp.git
cd catalog-mcp
npm install
npm test                                          # engine, loader, and stdio end-to-end tests

# serve the example catalog
node src/server.js --file examples/telescopes.json --key sku

Claude Desktopに組み込む(claude_desktop_config.json):

{
  "mcpServers": {
    "my-catalog": {
      "command": "node",
      "args": ["/path/to/catalog-mcp/src/server.js"],
      "env": {
        "CATALOG_URL": "https://example.com/catalog.json",
        "CATALOG_KEY": "sku"
      }
    }
  }
}

その後、エージェントに「カタログにはどのようなタイプがあり、それぞれの下限価格はいくらですか?」などと質問すると、エージェントがcatalog_schema、catalog_count_by、catalog_topを自ら組み合わせて答えます。

ツール

ツール

説明

catalog_query

レコードのフィルタリング、並べ替え、ページネーション、射影を行う

catalog_get

キーフィールドで1件のレコードを取得する

catalog_count_by

フィールドでグループ化してカウント(配列フィールドは各要素をカウント)

catalog_top

数値フィールドで上位N件のレコードを取得(オプションでフィルター付き)

catalog_values

フィールドの個別値とそのカウントを取得 — フィルターをかける前にそのフィールドの語彙を学ぶ

catalog_schema

レコードから推論されたスキーマ:型、カバレッジ、数値範囲、サンプル値

catalog_stats

レコード数、ソース、キャッシュ経過時間、オプションで数値の要約

すべてのツールは読み取り専用で冪等であり、その旨がMCPアノテーションに記載されています。

フィルター文法

query、count_by、topで使われる、1つの小さな仕様:

{
  "eq":       { "type": "reflector", "goto": true },
  "min":      { "aperture_mm": 150 },
  "max":      { "price": 1000 },
  "has":      { "features": ["Parabolic Mirror", "Cooling Fan"] },
  "contains": { "name": "dobsonian" }
}
  • eq — 任意の値(真偽値やnullも含む)との厳密な等価比較。

  • min / max — 数値の範囲。対象フィールドに実数がないレコードは除外されます。このルールは重要です。本番カタログでは、価格がないことは「価格はお問い合わせください」を意味し、「$30,000未満のユニットを表示」というクエリは、価格が不明なユニットを決して表面化してはいけません。

  • has — 配列のメンバーシップ。リストされた値がすべて存在しなければなりません。

  • contains — 文字列フィールドに対する大文字小文字を区別しない部分文字列検索。フィールド"*"はレコード内のすべての文字列フィールドを検索します。

条件はANDで結合されます。未知のトップレベルキーは、有効なキーを列挙するエラーになります。なぜなら、フィルターが黙って無視されると、エージェントが自信満々に間違った答えを報告するからです。

並べ替えは、ソートフィールドがないレコードを両方向で末尾に追いやります。「価格順に並べる」と、価格のあるレコードが最初に表示され、nullの壁が表示されることはありません。

設定

環境変数

フラグ

意味

CATALOG_URL

--url

HTTP(S)経由のカタログ(url/fileのいずれか一方のみ)

CATALOG_FILE

--file

ディスク上のカタログ

CATALOG_RECORDS_PATH

--records-path

レコード配列へのドットパス(例:data.items)

CATALOG_KEY

--key

catalog_get用のレコードキーフィールド(デフォルトid)

CATALOG_TTL_SEC

--ttl

フェッチキャッシュのTTL(秒)(デフォルト300)

CATALOG_RECORDS_PATHが設定されていない場合、ローダーはドキュメントルートが配列であればそれを使用し、そうでなければオブジェクトのトップレベル配列が1つだけあればそれを使用します({ "meta": ..., "items": [...] }はそのまま動作します)。ドキュメントが曖昧な場合は拒否し、候補となるキーを列挙します。

リフレッシュに失敗した場合、サーバーはエラーにする代わりに最後に正常に読み込んだデータを提供します。タスク中のエージェントは、例外よりも5分前のレコードの方が良いからです。また、catalog_statsはキャッシュの経過時間を報告するため、古さが隠されることはありません。

非目標

  • データベースではありません。カタログは読み取り専用でメモリ上に存在します。データがJSONファイルに快適に収まらない場合は、本物のストアが必要です。

  • 書き込みはありません。ここでカタログを変更することはありません。それは同期パイプラインの役割です(feedmergeを参照)。

  • クエリ言語はありません。5つのフィルターキーでエージェントが実際に尋ねる質問はカバーできます。それ以上凝ったものは、ツールスキーマではなくコードに属します。

ライセンス

MIT

Available Tools

7 tools
catalog_count_byCount records by fieldA
Read-onlyIdempotent

Group records by a field and count each value, most common first. Array fields count each element. Optional filter applies first.

Inputs: field (required), filter.

catalog_getGet one record by keyA
Read-onlyIdempotent

Fetch a single record by its key field ("id"). Returns { found, record }.

Inputs: key (required), fields.

catalog_queryQuery the catalogA
Read-onlyIdempotent

Filter, sort, and page through catalog records. Returns { count, total_matching, total_records, records }. Use catalog_schema first if you are unsure which fields exist. Example: filter {"eq":{"condition":"used"},"max":{"price":30000},"has":{"features":["Solar"]}}, sort_by "price".

Inputs: limit, fields, filter, offset, +2 more.

catalog_schemaInferred catalog schemaA
Read-onlyIdempotent

Field inventory inferred from the records themselves: type, coverage, numeric min/max, and sample values for categorical fields. Call this first when exploring an unfamiliar catalog.

Inputs: no named parameters.

catalog_statsCatalog totals and freshnessA
Read-onlyIdempotent

Record count, source, cache age, and optional numeric summaries (count/min/max/mean/median) for the fields you name.

Inputs: refresh, numeric_fields.

catalog_topTop N records by a numeric fieldA
Read-onlyIdempotent

Rank records by a numeric field with an optional filter. Example: sort_by "price", sort_dir "asc", filter {"has":{"features":["Bunkhouse"]}} = cheapest records with that feature.

Inputs: sort_by (required), limit, fields, filter, +1 more.

catalog_valuesDistinct values of a fieldA
Read-onlyIdempotent

All distinct values of a field with occurrence counts, most common first. The reliable way to learn a categorical field's vocabulary before filtering on it.

Inputs: field (required), limit.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 7 tools

    Disambiguation3/5

    catalog_values and catalog_count_by both return per-value occurrence counts, catalog_top is essentially a sorted special case of catalog_query, and catalog_stats overlaps with catalog_schema's min/max summaries. Each tool has a slightly different focus, but the boundaries are fuzzy enough that an agent could easily misselect.

    Naming Consistency4/5

    All tool names share the catalog_ prefix and snake_case, so the namespace is predictable. The suffixes are not uniformly verb_noun—schema/stats/values are nouns while get/query/count_by/top are verb-like—so it is mostly consistent rather than perfectly patterned.

    Tool Count5/5

    Seven tools is a well-scoped size for a catalog exploration server: enough for schema discovery, statistics, filtering, record retrieval, grouping, and value enumeration without bloat.

    Completeness5/5

    For a read-only catalog/exploration domain, the set covers the full workflow: understand the schema, inspect summary statistics, learn field vocabulary, filter/sort/page records, fetch by id, and aggregate/rank. No obvious dead-end operation is missing.

    Maintenance

    ActivityNo data
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      An integration layer for AI agents that provides a catalog of tools from various sources (OpenAPI, GraphQL, MCP, etc.) and can be used as an MCP server for compatible agents.
      4,778
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      An MCP server that exposes relational databases (PostgreSQL/MySQL) to AI agents with natural language to SQL query support.
      19
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      An MCP server that enables AI agents to generate, search, and reason over knowledge graphs from code, databases, docs, and open-data portals without requiring an LLM or API key.
      2
      Apache 2.0