Skip to main content
Glama

Food Data Central MCP Server

by jlfwong

食品データセントラルMCPサーバー

これは、USDA の FoodData Central APIへの API アクセスを公開するためのモデル コンテキスト プロトコル (MCP) サーバーです。

特徴

  • USDA FoodData Centralデータベースで食品を検索する
  • 食品の栄養情報にアクセスする
  • ページ区切りの結果
  • 複数のデータ タイプ (Foundation、SR Legacy、Survey、Branded) のサポート

設定

  1. リポジトリをクローンする
  2. 依存関係をインストールします:
    npm install
  3. プロジェクトをビルドします。
    npm run build

サーバーの実行

サーバーはstdioトランスポートを使用しているため、MCPクライアントによってサブプロセスとして実行されるように設計されています。直接実行するには、以下のコマンドを実行します。

# Set the USDA API key as an environment variable export USDA_API_KEY=your-api-key-here npm start

ホットリロードを使用した開発の場合:

# Set the USDA API key as an environment variable export USDA_API_KEY=your-api-key-here npm run dev

Claude Desktopでの使用

この MCP サーバーを Claude Desktop で使用するには:

  1. Claude デスクトップの設定を開きます。
    • macOS の場合: Claude メニューをクリックし、「設定...」を選択します
    • Windows の場合: Claude メニューをクリックし、「設定...」を選択します
  2. 設定パネルで、左側のバーにある「開発者」をクリックし、「設定の編集」をクリックします。
  3. これにより、次の場所に構成ファイルが作成されるか開きます。
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  4. Food Data Central MCP サーバーを構成ファイルに追加します。
    { "mcpServers": { "food-data-central": { "command": "npx", "args": ["tsx", "/path/to/food-data-central-mcp-server/src/index.ts"], "env": { "PATH": "/opt/homebrew/bin", "USDA_API_KEY": "<INSERT KEY HERE>" } } } }
    /path/to/food-data-central-mcp-serverこのリポジトリへの絶対パスに置き換え、 <INSERT KEY HERE>実際の USDA API キーに置き換えます。注: Windows を使用している場合は、npm グローバル インストール ディレクトリを含めるように PATH 値を調整する必要がある場合があります。
  5. 設定ファイルを保存し、Claude Desktopを再起動します。
  6. 再起動後、入力ボックスの右下にハンマーアイコンが表示されます。クリックすると、利用可能なツールが表示されます。

これで、クロードはこのMCPサーバーを介してFood Data Central APIにアクセスできるようになります。クロードに食品の検索、栄養情報の取得、詳細な食品データの取得を依頼できます。

MCP リソースとツール

リソース

  • food://details - IDで特定の食品の詳細情報を取得します
    • クエリパラメータ:
      • fdcId : 食品データセントラルID(必須)
      • format : オプション。要素の要約セットの場合は「abridged」、すべての要素の場合は「full」(デフォルト)
      • nutrients : オプション。最大25個の栄養素番号のリスト(カンマ区切り)
  • food://foods - 入力されたFDC IDを使用して複数の食品の詳細を取得します
    • クエリパラメータ:
      • fdcIds : 複数の FDC ID のリスト (必須、カンマ区切り)
      • format : オプション。要素の要約セットの場合は「abridged」、すべての要素の場合は「full」(デフォルト)
      • nutrients : オプション。最大25個の栄養素番号のリスト(カンマ区切り)
  • food://list - ページ分けされた食品リストを取得する
    • クエリパラメータ:
      • dataType : オプション。特定のデータ型でフィルタリングします(カンマ区切りのリスト)
      • pageSize : オプション。返される結果の最大数(デフォルト: 50)
      • pageNumber : オプション。取得するページ番号(デフォルト: 1)
      • sortBy : オプション。並べ替えの基準となるフィールド
      • sortOrder : オプション。並べ替え順序、「asc」または「desc」

ツール

  • search-foods - キーワードを使って食品を検索する
    • パラメータ:
      • query : 食品を見つけるための検索語(必須)
      • dataType : オプション。特定のデータ型(文字列の配列)でフィルタリングします。
      • pageSize : オプション。返される結果の最大数(デフォルト: 50)
      • pageNumber : オプション。取得するページ番号(デフォルト: 1)
      • sortBy : オプション。並べ替えの基準となるフィールド
      • sortOrder : オプション。並べ替え順序、「asc」または「desc」
      • brandOwner : オプション。食品のブランド所有者に基づいて結果をフィルタリングします(ブランド食品のみ)
      • tradeChannel : オプション。指定された取引チャネルのいずれかを含む食品をフィルタリングします。
      • startDate : オプション。この日付以降に公開された食品をフィルタリングします(形式: YYYY-MM-DD)
      • endDate : オプション。この日付以前に公開された食品をフィルタリングします(形式: YYYY-MM-DD)

使用例

MCP リソースを使用して食品の詳細を取得します。

food://details?fdcId=2345678&format=full

MCP リソースを使用して複数の食品を入手します。

food://foods?fdcIds=534358,373052,616350

MCP リソースを使用して食品のリストを取得します。

food://list?dataType=Foundation,SR Legacy&pageSize=10&pageNumber=1

MCP ツールを使用して食品を検索します。

{ "name": "search-foods", "arguments": { "query": "apple", "dataType": ["Foundation", "SR Legacy"], "pageSize": 10, "pageNumber": 1 } }
-
security - not tested
-
license - not tested
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Claude が USDA の FoodData Central データベースから詳細な栄養情報を検索してアクセスできるようにするモデル コンテキスト プロトコル サーバー。

  1. 特徴
    1. 設定
      1. サーバーの実行
        1. Claude Desktopでの使用
          1. MCP リソースとツール
            1. リソース
            2. ツール
          2. 使用例

            Related MCP Servers

            • -
              security
              F
              license
              -
              quality
              A Model Context Protocol server that allows Claude to query the Untappd beer database API for searching beers and retrieving detailed beer information.
              Last updated -
              JavaScript
              • Apple
            • A
              security
              F
              license
              A
              quality
              A Model Context Protocol server that provides tools to search and retrieve economic data series from the Federal Reserve Economic Data (FRED) API.
              Last updated -
              2
              3
              TypeScript
            • A
              security
              A
              license
              A
              quality
              A Model Context Protocol server that interfaces with Biomart databases, allowing models to discover biological datasets, explore attributes/filters, retrieve biological data, and translate between different biological identifiers.
              Last updated -
              8
              5
              Python
              MIT License
              • Apple
              • Linux
            • -
              security
              F
              license
              -
              quality
              A Model Context Protocol server that provides language models with access to personal Whoop fitness data, allowing queries for cycles, recovery, strain, and workout information from the Whoop API.
              Last updated -
              2
              Python
              • Apple

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/jlfwong/food-data-central-mcp-server'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server