MCP-Zero Documentation

repository·master·Indexed 19 days ago

https://github.com/xfey/mcp-zero

A framework for active tool discovery in autonomous LLM agents. MCP-Zero enables agents to retrieve and chain tools from Model Context Protocol (MCP) servers using similarity matching and embeddings. It includes a similarity matching engine, tools for formatting tool descriptions, and utilities for building custom MCP server datasets using VLLM and specific extraction prompts.

Tokens
831
Snippets
3
Records
4
Agent score
18%

What's inside MCP-Zero

  1. Overview of MCP-Zero: Active Tool Discovery

    master
    MCP-Zero is a method designed for autonomous LLM agents to proactively discover and construct toolchains. It implements retrieval capabilities to find relevant tools from a collection of Model Context Protocol (MCP) servers. The project includes experimental implementations for APIBank and MCP-tools (needle tests), a similarity matching engine, and tools for formatting tool descriptions and sampling target tools.
  2. Build a custom MCP server dataset

    master

    If you need to create a custom dataset for your own MCP servers, use the scripts located in the MCP-tools/build_data directory. The process involves:

    1. Using get_server_summary.py to extract structural data from an MCP server's README file.
    2. Using the provided server_summary.prompt to guide the extraction.
    3. Deploying a model (e.g., Qwen2.5-72B-Instruct) via VLLM using run_vllm.sh to process the summaries.
    # Directory structure for building custom datasets:
    MCP-tools/
    ├── build_data
    │   ├── get_server_summary.py
    │   ├── run_vllm.sh
    │   └── server_summary.prompt
    └── download_data.md
  3. Use the MCP-tools dataset

    master

    The MCP-tools dataset contains filtered tools from the official MCP repository (308 servers and 2,797 tools). To use the dataset with MCP-Zero, download the file and place it at the following path:

    ./MCP-tools/mcp_tools_with_embedding.json

    # Place the downloaded file here:
    ./MCP-tools/mcp_tools_with_embedding.json
  4. Understand the MCP-tools JSON data structure

    master

    The mcp_tools_with_embedding.json file follows a specific schema where each entry represents an MCP server and its associated tools. Each server includes embeddings (generated via text-embedding-3-large) for both the server summary and the server description to facilitate similarity matching.

    {
      "server_name": "string", // The name of the MCP server
      "server_summary": "string", // A summary of the server's purpose
      "server_description": "string", // Description from metadata
      "description_embedding": [float], // embedding from text-embedding-3-large
      "summary_embedding": [float], // embedding from text-embedding-3-large
      "tools": [
        {
          "name": "string", // The function/tool name
          "description": "string", // A concise description
          "description_embedding": [float], // embedding from text-embedding-3-large
          "parameter": {
            "param1": "(type) description1",
            "param2": "(Optional, type) description2"
          }
        }
      ]
    }