MCP RAG Agent Server

MCP RAG Agent Server

This MCP server enables intelligent API testing automation by combining RAG knowledge retrieval with tool execution capabilities. It allows QA engineers to perform natural language-driven API testing with contextual knowledge support.

Category
访问服务器

README

🚀 MCP RAG Agent – AI-Powered API Testing Framework

Python Flask RAG API Testing Status


📌 Overview

The MCP RAG Agent is an AI-driven modular testing framework that combines:

  • 🔎 RAG (Retrieval Augmented Generation) – Knowledge-based context retrieval
  • ⚙️ MCP Layer (Tool Execution Engine) – Executes tools dynamically
  • 🧪 API Testing Agent – Automates API validation like Postman

It enables natural language → API execution → validation → intelligent response generation.


🧠 System Architecture

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]

🧩 Architecture Explanation

1️⃣ API Agent Layer

  • Accepts natural language input
  • Converts request into structured API test case

2️⃣ MCP Server Layer

  • Central orchestration layer
  • Routes requests to appropriate tools

3️⃣ RAG Layer

  • Fetches contextual knowledge from documents
  • Enhances API validation logic

4️⃣ Execution Layer

  • Executes API calls (GET/POST/PUT/DELETE)
  • Captures response payloads

5️⃣ Validation Layer

  • Compares expected vs actual response
  • Returns structured test result

🔁 End-to-End Flow

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

⚙️ Installation Guide

1️⃣ Clone Repository

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

2️⃣ Create Virtual Environment

python -m venv venv

Activate:

# Windows
venv\Scripts\activate

# Mac/Linux
source venv/bin/activate

3️⃣ Install Dependencies

pip install -r requirements.txt

4️⃣ Start MCP Server

python server/mcp_server.py

Expected:

MCP Server running on http://localhost:5000

5️⃣ Run API Agent

python -m qa_agent.api_agent_runner

🧪 Postman Integration (Manual Testing Support)

Even though this system is AI-driven, it supports Postman-style API testing.

📌 Example Request

🔹 Endpoint

POST http://localhost:5000/execute

🔹 Headers

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

🔹 Sample Payload

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

📌 Sample Response

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

🔄 CI/CD Pipeline (QA Maturity Model)

This system can be integrated into CI/CD pipelines for automated API validation.

🚀 Pipeline Flow

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 Benefits

✔ Automated API regression testing ✔ AI-driven validation (reduces manual QA effort) ✔ Early defect detection ✔ Domain knowledge injection via RAG ✔ Scalable test execution


📌 Sample GitHub Actions Workflow

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

🧰 Available Tools

Tool Purpose
knowledge_search RAG-based document retrieval
calculator Arithmetic operations
api_executor Executes HTTP requests

📊 Real-World Use Cases

  • Banking API automation (AML / KYC)
  • Collateral management system testing
  • Microservices regression testing
  • AI-driven QA automation frameworks

⚠️ Troubleshooting

❌ Port conflict

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

❌ Module error

pip install -r requirements.txt

🚀 Future Enhancements

  • OpenAI / LLM integration
  • UI dashboard for test execution
  • Kubernetes deployment
  • Advanced embedding-based RAG
  • Postman collection auto-import

👨‍💻 Summary

This project demonstrates:

✔ AI-powered API testing ✔ MCP-based tool orchestration ✔ RAG-enhanced validation ✔ Enterprise-grade QA automation architecture

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选