Skip to main content
Glama
karthikeyanramu

MCP RAG Agent Server

🚀 MCP RAG 代理 – AI 驱动的 API 测试框架

Python Flask RAG API Testing Status


📌 概述

MCP RAG 代理是一个 AI 驱动的模块化测试框架,结合了:

  • 🔎 RAG(检索增强生成) – 基于知识的上下文检索

  • ⚙️ MCP 层(工具执行引擎) – 动态执行工具

  • 🧪 API 测试代理 – 像 Postman 一样自动化 API 验证

它实现了 自然语言 → API 执行 → 验证 → 智能响应生成 的全流程。


🧠 系统架构

graph TD
A[User Query] --> B[API Agent - NLP Parser]
B --> C[MCP Server - Tool Router]
C --> D[RAG Engine - Knowledge Retrieval]
C --> E[API Execution Tool]
D --> C
E --> F[External API / System]
F --> G[Response Validation Layer]
G --> H[Final AI Response]

Related MCP server: sentinel-mcp

🧩 架构说明

1️⃣ API 代理层

  • 接收自然语言输入

  • 将请求转换为结构化的 API 测试用例

2️⃣ MCP 服务器层

  • 核心编排层

  • 将请求路由到适当的工具

3️⃣ RAG 层

  • 从文档中获取上下文知识

  • 增强 API 验证逻辑

4️⃣ 执行层

  • 执行 API 调用 (GET/POST/PUT/DELETE)

  • 捕获响应负载

5️⃣ 验证层

  • 比较预期响应与实际响应

  • 返回结构化的测试结果


🔁 端到端流程

User Input
   ↓
API Agent (Intent Detection)
   ↓
MCP Server (Tool Selection)
   ↓
RAG (Context Injection)
   ↓
API Execution Engine
   ↓
Response Validation
   ↓
Final Result Output

⚙️ 安装指南

1️⃣ 克隆仓库

git clone https://github.com/karthikeyanramu/MCP_RAG_AGENT.git
cd MCP_RAG_AGENT

2️⃣ 创建虚拟环境

python -m venv venv

激活:

# Windows
venv\Scripts\activate

# Mac/Linux
source venv/bin/activate

3️⃣ 安装依赖

pip install -r requirements.txt

4️⃣ 启动 MCP 服务器

python server/mcp_server.py

预期:

MCP Server running on http://localhost:5000

5️⃣ 运行 API 代理

python -m qa_agent.api_agent_runner

🧪 Postman 集成(手动测试支持)

尽管此系统是 AI 驱动的,但它也支持 Postman 风格的 API 测试。

📌 请求示例

🔹 端点

POST http://localhost:5000/execute

🔹 请求头

{
  "Content-Type": "application/json",
  "Authorization": "Bearer <token-if-needed>"
}

🔹 示例负载

{
  "tool": "api_executor",
  "method": "POST",
  "url": "https://api.example.com/login",
  "headers": {
    "Content-Type": "application/json"
  },
  "body": {
    "username": "test_user",
    "password": "Test@123"
  }
}

📌 响应示例

{
  "status": 200,
  "message": "Login Successful",
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "validation": "PASSED"
}

🔄 CI/CD 流水线(QA 成熟度模型)

该系统可以集成到 CI/CD 流水线中,用于自动化 API 验证

🚀 流水线流程

graph LR
A[Code Push] --> B[CI Trigger - GitHub Actions]
B --> C[Install Dependencies]
C --> D[Run API Tests via MCP Agent]
D --> E[RAG Validation Layer]
E --> F[Test Report Generation]
F --> G[Deploy / Fail Pipeline]

🧪 CI/CD 优势

✔ 自动化 API 回归测试 ✔ AI 驱动的验证(减少手动 QA 工作量) ✔ 早期缺陷检测 ✔ 通过 RAG 注入领域知识 ✔ 可扩展的测试执行


📌 GitHub Actions 工作流示例

name: MCP API Tests

on: [push]

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: 3.10

      - name: Install dependencies
        run: pip install -r requirements.txt

      - name: Run MCP API Agent
        run: python -m qa_agent.api_agent_runner

🧰 可用工具

工具

用途

knowledge_search

基于 RAG 的文档检索

calculator

算术运算

api_executor

执行 HTTP 请求


📊 实际应用场景

  • 银行 API 自动化 (AML / KYC)

  • 抵押品管理系统测试

  • 微服务回归测试

  • AI 驱动的 QA 自动化框架


⚠️ 故障排除

❌ 端口冲突

netstat -ano | findstr :5000
taskkill /PID <pid> /F

❌ 模块错误

pip install -r requirements.txt

🚀 未来增强功能

  • OpenAI / LLM 集成

  • 用于测试执行的 UI 仪表板

  • Kubernetes 部署

  • 基于高级嵌入的 RAG

  • Postman 集合自动导入


👨💻 总结

本项目展示了:

✔ AI 驱动的 API 测试 ✔ 基于 MCP 的工具编排 ✔ RAG 增强的验证 ✔ 企业级 QA 自动化架构

F
license - not found
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    QA Sphere MCP server that enables Large Language Models to interact directly with test management system test cases, supporting AI-powered development workflows and test case discovery.
    15
    101
    23
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    An MCP server for AI-powered API testing that enables automated positive, negative, and security testing directly from AI chat interfaces. It supports multiple AI providers and generates detailed security reports.
    54
    Inno Setup
  • A
    license
    -
    quality
    D
    maintenance
    A standalone MCP server for API testing and management, allowing AI assistants to interact with RESTful APIs through natural language.
    13
    28
    MIT

View all related MCP servers

Related MCP Connectors

  • MCP server for AI access to SmartBear tools, including BugSnag, Reflect, Swagger, PactFlow, QTM4J.

  • MCP server for AI access to Swagger by SmartBear.

  • Official MCP server for Qase — manage test cases, runs, suites, defects via AI tools.

View all MCP Connectors

Latest Blog Posts

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/karthikeyanramu/MCP_RAG_AGENT'

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