trackmcp
Back to directory
AntonioPavoni

mcp_usda_server_quantized

View on GitHub

MCP Server Template for USDA Tools

1 stars JavaScriptDeveloper Kits Updated Jun 13, 2025

Documentation

MCP USDA Server

A modular MCP (Model Control Protocol) server template for fetching and formatting agricultural data from the USDA Foreign Agricultural Service (FAS) Production, Supply and Distribution (PSD) database.

๐ŸŒพ Overview

This project serves as a template for creating Model Control Protocol (MCP) servers that expose agricultural data tools to Large Language Models (LLMs). It demonstrates how to fetch data from the USDA FAS API, process it, and present it in a format that's optimized for LLM consumption.

The server implements a modular architecture that makes it easy to:

  • Add new data sources and tools
  • Format complex data for LLM consumption
  • Create anti-hallucination guardrails
  • Connect to an MCP client that aggregates tools from multiple servers

๐Ÿ“ Architecture

This project implements a client-server architecture using the MCP (Model Control Protocol) approach:

code
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚             โ”‚     โ”‚             โ”‚     โ”‚             โ”‚
โ”‚    LLM      โ”‚โ—„โ”€โ”€โ”€โ–บโ”‚  MCP Client โ”‚โ—„โ”€โ”€โ”€โ–บโ”‚ MCP Servers โ”‚
โ”‚             โ”‚     โ”‚             โ”‚     โ”‚             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Core Components:

1. MCP Client:

    2. MCP USDA Server:

      3. Communication Protocol:

        ๐Ÿงฐ Available Tools

        This server implements five USDA data tools:

        1. usda-psd-regions: Get region data from the USDA FAS PSD database

        2. usda-psd-countries: Get country data with region associations

        3. usda-psd-commodities: Get agricultural commodity definitions

        4. usda-psd-units-of-measure: Get units of measure for agricultural quantities

        5. usda-psd-commodity-attributes: Get commodity attributes (production, supply, distribution)

        Each tool is designed to fetch data from the USDA API, filter it based on user queries, and format it into markdown that's optimized for LLM consumption.

        ๐Ÿ“ Project Structure

        The project follows a modular architecture:

        code
        MCP_USDA_Server/
        โ”œโ”€โ”€ src/
        โ”‚   โ”œโ”€โ”€ tools/           # Core implementation of each tool
        โ”‚   โ”œโ”€โ”€ handlers/        # Request handlers for each tool
        โ”‚   โ”œโ”€โ”€ formatters/      # Format tool results for LLM consumption
        โ”‚   โ”œโ”€โ”€ routers/         # Route requests to the appropriate handler
        โ”‚   โ”œโ”€โ”€ utils/           # Utility functions
        โ”‚   โ””โ”€โ”€ server.js        # Main server entry point
        โ”œโ”€โ”€ Architecture.md      # Detailed architecture documentation
        โ””โ”€โ”€ package.json         # Dependencies and scripts

        Key Files:

        • src/server.js: Main entry point that starts the HTTP server and initializes the request processor
        • src/tools/registry.js: Central registry of all available tools with metadata
        • src/routers/toolRouter.js: Routes tool-related requests to the appropriate handler
        • **src/tools/psd*.js**: Implementation of USDA PSD data fetching for different endpoints
        • **src/formatters/psd*Formatter.js**: Formats API results into markdown for LLM consumption
        • **src/handlers/psd*Handler.js**: Handles incoming requests for each tool

        ๐Ÿ”„ JSON-RPC Communication

        The server communicates with the MCP client using JSON-RPC 2.0:

        Examples:

        1. Tool Listing Request:

        json
        {
          "jsonrpc": "2.0",
          "id": 1,
          "method": "tools/list",
          "params": {}
        }

        2. Tool Execution Request:

        json
        {
          "jsonrpc": "2.0",
          "id": 2,
          "method": "tools/execute",
          "params": {
            "name": "usda-psd-regions",
            "args": {
              "query": "asia"
            }
          }
        }

        โš™๏ธ LLM Integration

        This server is designed to be LLM-agnostic, meaning it can work with any LLM that supports either:

        • Function/Tool Calling: For LLMs that have native function calling capabilities (e.g., OpenAI's GPT-4, Anthropic's Claude 3, Google's Gemini)
        • Instruction Following: For LLMs that can follow structured instructions about available tools

        The system works best with LLMs that have:

        1. Function/tool calling capabilities

        2. Ability to parse and generate structured data

        3. Contextual understanding of agricultural data

        ๐Ÿš€ Getting Started

        Prerequisites:

        • Node.js (v14+)
        • npm or yarn

        Installation:

        1. Clone this repository:

        bash
        git clone https://github.com/yourusername/MCP_USDA_Server.git
        cd MCP_USDA_Server

        2. Install dependencies:

        bash
        npm install

        3. Start the server:

        bash
        npm start

        The server will start on port 3100 by default (configurable in .env).

        Connecting with MCP Client:

        The server is designed to work with an MCP client that aggregates tools from multiple servers. See the companion MCP_WebAgent_Client repository for implementation details.

        ๐Ÿ”ง Extending the Server

        Adding a New Tool:

        1. Create a new tool implementation in `src/tools/`

        2. Create a formatter in `src/formatters/`

        3. Create a handler in `src/handlers/`

        4. Register the tool in `src/tools/registry.js`

        5. Update the router in `src/routers/toolRouter.js`

        See the existing tools for implementation examples.

        ๐Ÿ“ License

        This project is licensed under the MIT License - see the LICENSE file for details.

        ๐Ÿ™ Acknowledgements

        • USDA Foreign Agricultural Service for providing the PSD API
        • The open-source community for inspiration and examples of modular architecture

        Created as a template for building MCP servers that expose domain-specific data to LLMs.

        Frequently asked questions

        What is mcp_usda_server_quantized?

        mcp_usda_server_quantized is MCP Server Template for USDA Tools

        How do I install mcp_usda_server_quantized?

        Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.

        Is mcp_usda_server_quantized open source?

        Yes โ€” it is hosted on GitHub at https://github.com/AntonioPavoni/MCP_USDA_Server_Quantized and has 1 stars.

        Related MCP tools

        Mintplex-Labsanything-llm

        The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, No-code agent builder, MCP compatibility, and more.

        50,686 JavaScript
        ai-agentscustom-ai-agentsdeepseek+16
        eyaltoledanoclaude-task-master

        An AI-powered task-management system you can drop into Cursor, Lovable, Windsurf, Roo, and others. Built for the Model Context Protocol to enhance AI capabiliti

        23,033 JavaScript
        aicursorcursor-ai+9
        xszyoufay

        Fayๆ˜ฏไธ€ไธชๅธฎๅŠฉๆ•ฐๅญ—ไบบ๏ผˆ2.5dใ€3dใ€็งปๅŠจใ€pcใ€็ฝ‘้กต๏ผ‰ๆˆ–ๅคง่ฏญ่จ€ๆจกๅž‹๏ผˆopenaiๅ…ผๅฎนใ€deepseek๏ผ‰่ฟž้€šไธšๅŠก็ณป็ปŸ็š„mcpๆก†ๆžถใ€‚ JavaScript-based implementation. Trusted by 12000+ developers.

        12,003 JavaScript
        aiandroidapi+4
        sonnylazuardicursor-talk-to-figma-mcp

        CTTF: MCP integration between Cursor and Figma, allowing Cursor Agentic AI to communicate with Figma for reading designs and modifying them programmatically.

        5,539 JavaScript
        agentagenticagentic-ai+11
        mendableaifirecrawl-mcp-server

        ๐Ÿ”ฅ Official Firecrawl MCP Server - Adds powerful web scraping and search to Cursor, Claude and any other LLM clients. JavaScript-based implementation.

        4,847 JavaScript
        batch-processingclaudecontent-extraction+11
        wonderwhy-erdesktopcommandermcp

        This is MCP server for Claude that gives it terminal control, file system search and diff file editing capabilities JavaScript-based implementation.

        4,840 JavaScript
        agentaicode-analysis+5

        Run your own MCP server? See who uses it and what to fix.

        Measure it with TrackMCP