支持 A2A 的 SearchAPI MCP 代理 标志

支持 A2A 的 SearchAPI MCP 代理

社区
RmMargt

SearchAPI MCP Agent with A2A Support

发布者RmMargt
代码仓库searchapi-mcp-agent
语言Python
复刻数
4
星标数
14
可用工具
0
传输类型stdio
分类
许可协议MIT
链接
  • 将工具接入 AI 工作流

    支持 A2A 的 SearchAPI MCP 代理 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 14 个星标和 4 个复刻。

SearchAPI MCP Agent with A2A 支持 | SearchAPI MCP Agent with A2A Support

一个基于 Agent-to-Agent (A2A) 协议的 SearchAPI 代理,通过 Model Context Protocol (MCP) 系统集成了多种搜索 API 工具。

An Agent-to-Agent (A2A) protocol based SearchAPI agent that integrates various search API tools through the Model Context Protocol (MCP) system.

更新说明 | Update Notes

2024 更新:

  • 修复了导入路径问题:从 samples.python.agents 导入修改为直接从当前目录导入
  • 修复了 a2a_common 导入问题:修改为从 common 模块导入
  • 移除了 a2a_common 依赖安装需求

2024 Updates:

  • Fixed import path issues: Changed from samples.python.agents imports to direct imports from the current directory
  • Fixed a2a_common import issues: Changed to import from the common module
  • Removed a2a_common dependency installation requirements

概述 | Overview

SearchAPI-MCP-Agent 实现了 A2A 协议和 Model Context Protocol,将各种搜索操作封装为工具和资源。它作为 AI 助手和搜索服务之间的桥梁,支持地图搜索、航班查询、酒店预订等多种功能。

SearchAPI-MCP-Agent implements the A2A protocol and Model Context Protocol, encapsulating various search operations as tools and resources. It serves as a bridge between AI assistants and search services, supporting map search, flight queries, hotel bookings, and more.

SearchAPI Agent 核心特性 | Core Features

  • 多MCP配置支持 - 作为MCP客户端,可以同时连接和配置多个MCP服务器,扩展可用的工具集 Multiple MCP Configuration - As an MCP client, can connect to and configure multiple MCP servers simultaneously, expanding the available toolset
  • 动态工具发现 - 自动发现和加载MCP服务器提供的工具列表,无需手动配置 Dynamic Tool Discovery - Automatically discovers and loads tool lists provided by MCP servers without manual configuration
  • 智能LLM路由 - 使用Gemini模型自动将自然语言查询路由到合适的工具并提取参数,确保调用成功 Intelligent LLM Routing - Uses Gemini model to automatically route natural language queries to appropriate tools and extract parameters, ensuring successful invocation
  • 实时状态反馈 - 通过A2A协议向Host Agent提供实时的工具执行状态更新和流式响应 Real-time Status Feedback - Provides real-time tool execution status updates and streaming responses to the Host Agent via A2A protocol
  • 错误处理和恢复 - 自动处理API调用错误,提供友好的错误信息和回退机制 Error Handling and Recovery - Automatically handles API call errors, providing friendly error messages and fallback mechanisms

Google 搜索 | Google Search

  • 网页搜索结果 | Web search results
  • 知识图谱集成 | Knowledge graph integration
  • 相关问题推荐 | Related questions
  • 搜索建议 | Search suggestions
  • 多语言支持 | Multi-language support
  • 地区特定结果 | Region-specific results
  • 时间范围过滤 | Time range filtering
  • 安全搜索选项 | Safe search options

Google Video 搜索 | Google Video Search

  • 视频内容搜索 | Video content search
  • 视频列表获取 | Video list retrieval
  • 视频轮播支持 | Video carousel support
  • 短视频内容 | Short video content
  • 按时长筛选 | Duration filtering
  • 按来源过滤 | Source filtering
  • 按上传时间排序 | Upload time sorting
  • 高清预览支持 | HD preview support

Google Maps 搜索 | Google Maps Search

  • 搜索地点和服务 | Search places and services
  • 获取地点详细信息 | Get place details
  • 查看用户评论 | View user reviews
  • 获取位置坐标 | Get location coordinates

Google Flights 航班搜索 | Google Flights Search

  • 单程/往返航班搜索 | One-way/round-trip flight search
  • 多城市行程规划 | Multi-city itinerary planning
  • 航班价格日历 | Flight price calendar
  • 航班筛选和排序 | Flight filtering and sorting
  • 行李额度查询 | Baggage allowance query
  • 航空公司选择 | Airline selection

Google Hotels 酒店搜索 | Google Hotels Search

  • 酒店位置搜索 | Hotel location search
  • 价格和可用性查询 | Price and availability query
  • 设施和服务筛选 | Facilities and services filtering
  • 用户评分和评论 | User ratings and reviews
  • 特殊优惠查询 | Special offers query
  • 房型选择 | Room type selection

安装说明 | Installation

环境要求 | Requirements

  • Python 3.9 或更高版本 | Python 3.9 or higher
  • pip 包管理器 | pip package manager
  • UV 包管理器(推荐)| UV package manager (recommended)

基础安装 | Basic Installation

bash
# 克隆仓库 | Clone repository
git clone https://github.com/RmMargt/searchapi-mcp-agent.git
cd searchapi-mcp-agent

# 创建并激活虚拟环境 | Create and activate virtual environment
python -m venv venv
source venv/bin/activate  # Linux/Mac
# 或 | or
.\venv\Scripts\activate  # Windows

# 安装依赖 | Install dependencies
pip install -r requirements.txt

配置环境变量 | Configure Environment Variables

创建 .env 文件并设置以下环境变量: Create a .env file and set the following environment variables:

SEARCHAPI_API_KEY=your_searchapi_key_here
GOOGLE_API_KEY=your_google_api_key_here

使用方法 | Usage

启动 Google A2A 项目的 Host Agent 和 SearchAPI Agent

按照以下步骤启动完整的 A2A 环境,包括 Host Agent 和 SearchAPI Agent:

1. 启动 SearchAPI Agent

bash
# 在searchapi-mcp-agent目录下
python -m searchapi_mcp_agent --host localhost --port 10001

2. 启动 Host Agent (基于 Google A2A 项目)

bash
# 切换到 Google A2A 样例目录
cd path/to/A2A/samples/python

# 运行 Host Agent (选择一种)
uv run hosts/cli        # 命令行界面
# 或
uv run hosts/multiagent # 多代理环境

3. 在本地浏览器中访问 Demo UI

如果你运行的是多代理环境,可以在浏览器中访问以下地址:

http://localhost:12000

在 UI 中,点击机器人图标添加 SearchAPI Agent,使用以下地址:

http://localhost:10001/agent-card

直接发送请求 | Send Requests

可以通过以下方式发送请求: You can send requests in the following ways:

  1. 自然语言查询 | Natural Language Query:

    json
    {
      "query": "查找从纽约到洛杉矶的航班"
    }

    Agent会使用LLM自动将查询路由到合适的工具。 The agent will use LLM to automatically route the query to the appropriate tool.

  2. 直接指定工具 | Direct Tool Specification:

    json
    {
      "tool_name": "search_google_flights",
      "parameters": {
        "departure_id": "NYC",
        "arrival_id": "LAX",
        "outbound_date": "2024-12-01"
      }
    }

A2A 集成 | A2A Integration

本项目已完全实现 A2A 协议,可以作为 AI 助手的服务端点。API 符合 A2A 规范,支持任务创建、状态查询和流式响应。

This project fully implements the A2A protocol and can serve as a service endpoint for AI assistants. The API complies with the A2A specification, supporting task creation, status queries, and streaming responses.

A2A 协议特性实现 | A2A Protocol Implementation

  • 动态工具路由 - 通过自然语言处理自动识别用户意图并选择合适的搜索工具 Dynamic Tool Routing - Automatically identifies user intent through natural language processing and selects the appropriate search tool
  • 流式响应 - 支持大型搜索结果的分块流式传输,提供实时反馈 Streaming Responses - Supports chunked streaming of large search results, providing real-time feedback
  • 任务状态更新 - 实时报告搜索任务的进度和状态变化 Task Status Updates - Reports progress and status changes of search tasks in real-time
  • 错误处理 - 优雅处理搜索API错误,提供有用的错误消息 Error Handling - Gracefully handles search API errors, providing useful error messages

MCP 配置 | MCP Configuration

Claude for Desktop 配置示例 | Claude for Desktop Configuration Example

在 Claude for Desktop 的配置文件中添加以下内容: Add the following to your Claude for Desktop configuration file:

json
{
  "mcpServers": {
    "searchapi": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "/path/to/searchapi-mcp-agent/mcp_server.py"
      ],
      "env": {
        "SEARCHAPI_API_KEY": "your_api_key_here",
        "GOOGLE_API_KEY": "your_google_api_key_here"
      }
    }
  }
}

配置文件位置 | Configuration file location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

许可证 | License

本项目采用 MIT 许可证 - 详见 LICENSE 文件 This project is licensed under the MIT License - see the LICENSE file for details

致谢 | Acknowledgments

  • Model Context Protocol - 协议规范 | Protocol specification
  • A2A Protocol - Agent-to-Agent 协议规范 | Agent-to-Agent protocol specification
  • FastMCP - Python MCP 实现 | Python MCP implementation
  • SearchAPI.io - 搜索服务提供商 | Search service provider
  • Google A2A - Agent-to-Agent 协议参考实现 | A2A protocol reference implementation

注意:本服务器会与外部 API 进行交互。在使用 MCP 客户端确认操作之前,请始终验证请求的操作是否合适。 Note: This server interacts with external APIs. Always verify that requested operations are appropriate before confirming them in MCP clients.

安装

TypingMind
前提条件:

Node.js 18+

{
  "mcpServers": {
    "rmmargt-searchapi-mcp-agent": {
      "command": "",
      "args": []
    }
  }
}

将 支持 A2A 的 SearchAPI MCP 代理 MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 支持 A2A 的 SearchAPI MCP 代理 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过您设备上的 TypingMind MCP 连接器在本地运行。

本地连接器设置指南

如果 MCP 服务器需要访问您电脑上的本地文件、应用或私有资源,请选择此方式。

1

打开 MCP 设置

在 TypingMind 中,依次前往“设置”、“高级设置”和“模型上下文协议”,然后选择“设置连接器”。

  1. 在您的浏览器中打开 TypingMind。
  2. 点击“设置”图标。
  3. 进入“高级设置”。
  4. 打开“模型上下文协议”部分。
  5. 点击“设置连接器”,然后选择“此设备”。
TypingMind MCP 连接器设置界面,已选择“此设备”
2

运行连接器命令

选择“此设备”,从 TypingMind 复制命令并在终端中运行。使用 MCP 时,请保持该进程运行。

  1. 复制 TypingMind 显示的设置命令。
  2. 在 macOS 上打开“终端”,或在 Windows 上打开 Windows Terminal。
  3. 粘贴并运行命令。
  4. 如果终端询问您是否继续,请确认安装软件包。
  5. 使用 MCP 工具时,请勿关闭终端窗口或停止其中的连接器进程。
3

将 支持 A2A 的 SearchAPI MCP 代理 添加为服务器

当连接器状态为“就绪”时,点击“编辑服务器”,然后粘贴 MCP 服务器配置。

  1. 等待连接器状态显示为“就绪”。
  2. 点击“编辑服务器”。
  3. 粘贴 支持 A2A 的 SearchAPI MCP 代理 MCP 服务器配置。
  4. 保存服务器列表。
  5. 如需确认连接器是否仍处于就绪状态,请刷新。
TypingMind MCP 设置界面,显示正在运行的服务器和“编辑服务器”按钮
{
  "mcpServers": {
    "rmmargt-searchapi-mcp-agent": {
      "command": "npx",
      "args": [
        "-y",
        "searchapi-mcp-agent"
      ]
    }
  }
}
4

在不同模型中使用同一连接

保存服务器列表,打开“插件”,启用 支持 A2A 的 SearchAPI MCP 代理 MCP 工具,然后在 TypingMind 中选择任意受支持的 AI 模型,即可在聊天中使用这些工具,或将其分配给智能体。

  1. 在 TypingMind 中打开“插件”页面。
  2. 启用 支持 A2A 的 SearchAPI MCP 代理 MCP 工具。
  3. 开始聊天并选择您想使用的 AI 模型。
  4. 在聊天中使用 MCP 工具,或将其分配给 AI 智能体。
  5. 根据需要随时切换到其他 AI 模型,无需重新连接 MCP。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 支持 A2A 的 SearchAPI MCP 代理 帮我完成这项任务吗?
支持 A2A 的 SearchAPI MCP 代理
当然,我看过了。
以下是我使用 支持 A2A 的 SearchAPI MCP 代理 得到的结果。

常见问题

支持 A2A 的 SearchAPI MCP 代理 MCP 服务器有什么用途?

支持 A2A 的 SearchAPI MCP 代理 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 支持 A2A 的 SearchAPI MCP 代理 MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您无需为每个模型单独配置 MCP 服务器,就能在 Claude、ChatGPT、Gemini 或您在 TypingMind 中配置的其他 AI 模型中使用 支持 A2A 的 SearchAPI MCP 代理。

为什么在 TypingMind 中使用 支持 A2A 的 SearchAPI MCP 代理 MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是最出色的大语言模型聊天前端之一。连接 支持 A2A 的 SearchAPI MCP 代理 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 支持 A2A 的 SearchAPI MCP 代理 MCP 连接到 TypingMind?

支持 A2A 的 SearchAPI MCP 代理 通过 TypingMind 本地 MCP 连接器运行。当 MCP 服务器需要访问您计算机上的本地文件、桌面应用、命令行工具或私有资源时,这种方式最合适。

支持 A2A 的 SearchAPI MCP 代理 MCP 在 TypingMind 中提供哪些工具?

支持 A2A 的 SearchAPI MCP 代理 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 支持 A2A 的 SearchAPI MCP 代理 MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行选择模型提供商,并自行管理 API 密钥、提示词和 MCP 配置。如果 支持 A2A 的 SearchAPI MCP 代理 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇