Skip to main content
Glama
dev484p

Agentic AI with MCP

by dev484p

具有模型上下文协议(MCP)的代理人工智能

该项目实现了一个 Agentic AI 系统,该系统通过自定义模型上下文协议 (MCP) 服务器将 Groq 托管的 LLM(qwen-qwq-32b 模型)与各种工具连接起来。该系统通过提供来自维基百科、互联网搜索(通过 Tavily API)和金融数据(通过 Yahoo Finance API)的上下文信息来增强 LLM 的功能。

关于 MCP

模型上下文协议 (MCP) 是由 Anthropic 开发的一项开放标准,旨在规范应用程序向大型语言模型 (LLM) 提供上下文的方式。它促进了 LLM 应用程序与外部数据源和工具之间的无缝集成,使 AI 系统能够通过标准化接口与各种服务动态交互。

MCP 的主要特点:

  • 标准化:为人工智能助手与结构化工具和数据层之间的连接提供通用协议。

  • 模块化架构:遵循持久流上的客户端-服务器模式,通常由主机 AI 系统介导。

  • 动态自省:支持通过 tools/list 和 resources/list 等方法动态发现工具和资源。

安全性:集成主机介导身份验证并支持安全传输协议。通过采用 MCP,开发人员可以构建更具互操作性、安全性更高且能够处理复杂工作流程的 AI 应用程序。

要向 MCP 服务器添加新工具:​

  • 定义工具:创建一个处理特定任务或数据检索的新功能。​

  • 注册工具:更新服务器的工具注册表以包含新功能,指定工具的名称和描述。​

  • 处理请求:确保服务器可以根据查询将传入的请求路由到适当的工具。这种模块化方法可以轻松扩展服务器的功能,使语言模型能够访问更广泛的上下文信息。

Related MCP server: Wikipedia MCP Server

特征

  • MCP 服务器:提供各种工具访问的中央枢纽

  • 三个集成工具:

    1. 维基百科搜索——用于事实信息检索

    2. 互联网搜索 - 由 Tavily API 提供支持,可提供全面的网络结果

    3. Yahoo Finance API - 用于实时股票和财务数据

  • Groq API 集成:使用 qwen-qwq-32b 模型进行超快速 LLM 处理

  • 客户端-服务器架构:工具管理和 LLM 交互之间的明确分离

先决条件

开始之前,请确保您已具备以下条件:

安装

  1. 克隆存储库:

    git clone https://github.com/dev484p/AgenticAI_MCP
    cd AgenticAI_MCP
  2. 安装依赖项:

    uv add "mcp[cli]"
  3. 设置环境变量:在 keys.json 中更新 Groq 和 Tavily api 密钥

  4. 可选(使用 MCP Inspector 运行服务器进行开发):

uv run mcp dev server.py
  1. 运行以下命令来启动聊天机器人:

    uv run client.py

可用工具

系统通过MCP服务器提供三种工具:

  1. 维基搜索:

  • 访问维基百科信息

  • 示例查询:“告诉我人工智能的历史”

  1. 互联网搜索(塔维利):

  • 获得全面的网络搜索结果

  • 示例查询:“量子计算的最新发展是什么?”

  1. 雅虎财经:

  • 获取股票价格和财务数据

  • 示例查询:“AAPL 股票的当前价格是多少?”

参考

Available Tools

3 tools

Tool Schema Changelog

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

  1. 3 tool updates
    • First observedinternet_search
    • First observedwiki_search
    • First observedyahoo_finance_search

TDQS

B3.1/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: internet_search uses Tavily API for general web searches, wiki_search targets Wikipedia articles specifically, and yahoo_finance_search focuses on stock information from Yahoo Finance. There is no overlap in functionality or ambiguity between these three tools.

Naming Consistency5/5

All tool names follow a consistent snake_case pattern with a clear verb_noun structure: internet_search, wiki_search, and yahoo_finance_search. The naming is uniform and predictable across the entire set.

Tool Count3/5

With only 3 tools, the server feels thin for the broad domain implied by 'Agentic AI with MCP', which suggests a more comprehensive set of capabilities. While each tool is distinct, the count is borderline low for typical agentic AI tasks that might require more varied operations.

Completeness2/5

The tool surface is severely incomplete for an 'Agentic AI' server, as it only provides search functionalities without any CRUD operations, data processing, or other AI-related actions. There are significant gaps that will limit agent effectiveness, such as missing tools for data manipulation, analysis, or interaction with AI models.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    B
    maintenance
    A Model Context Protocol server providing real-time stock data and options analysis through Yahoo Finance, enabling LLMs to access market data, analyze stocks, and evaluate options strategies.
    3
    27
    MIT
  • A
    license
    B
    quality
    C
    maintenance
    A Model Context Protocol server that retrieves information from Wikipedia to provide context to LLMs, allowing users to search articles, get summaries, full content, sections, and links from Wikipedia.
    22
    2,859 PyPI
    299
    MIT
  • A
    license
    B
    quality
    A
    maintenance
    A Model Context Protocol server that enables interaction with Yahoo Finance to retrieve stock pricing, company information, and historical financial data through natural language queries.
    21
    1,290 PyPI
    28
    MIT
  • A
    license
    C
    quality
    Not graded
    maintenance
    A Model Context Protocol server that provides tools for interacting with Yahoo Finance, allowing users to retrieve stock prices, company information, and perform financial data comparisons.
    11
    MIT