MCP Hub

MCP Hub

A sophisticated research assistant that orchestrates a 5-step workflow of connected AI agents to provide deep research capabilities including question enhancement, web search, summarization, citation formatting, and result combination.

Category
访问服务器

README

MCP Hub Project - Deep Research & Code Assistant

Overview

The MCP (Model Context Protocol) Hub is a sophisticated research and code assistant built using Gradio's MCP server functionality. This project demonstrates how to build a workflow of connected AI agents that work together to provide deep research capabilities and generate executable Python code.

The system orchestrates an 8-step deep research and code generation workflow:

  1. Question Enhancement: Breaks down a user's original query into three distinct sub-questions
  2. Web Search: Conducts web searches for each sub-question using Tavily API
  3. LLM Summarization: Summarizes search results for each sub-question using Nebius LLMs
  4. Citation Formatting: Extracts and formats citations from web search results
  5. Result Combination: Merges all summaries into a comprehensive grounded context
  6. Code Generation: Creates Python code based on the research findings using Qwen2.5-Coder-32B-Instruct-fast
  7. Code Execution: Runs the generated code in a Modal sandbox environment
  8. Final Summary: Provides a natural language summary of the entire process

Features

  • MCP Server Implementation: Built on Gradio's MCP server capabilities for seamless agent communication
  • Multi-Agent Architecture: Demonstrates how to build interconnected agent services
  • Real-time Web Search: Integration with Tavily API for up-to-date information
  • LLM Processing: Uses Nebius (OpenAI-compatible) models for text processing
  • Structured Workflow: Showcases a sophisticated multi-step AI research process
  • Citation Generation: Automatically formats APA-style citations from web sources
  • Code Generation: Creates executable Python code based on research findings
  • Code Execution: Runs generated code in a Modal sandbox environment
  • Final Summary: Provides a natural language summary of the entire process

Prerequisites

  • Python 3.12+
  • API keys for:
    • Nebius API
    • Tavily API
  • Modal account (for code execution in sandbox)

Installation

  1. Clone this repository
  2. Create a virtual environment (recommended)
python -m venv venv
# Activate the virtual environment:
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
  1. Install dependencies:
pip install gradio[mcp] openai tavily-python python-dotenv modal
# or use the pyproject.toml with your preferred Python package manager:
# pip install -e .
  1. Create a .env file with the following content:
NEBIUS_API_KEY=nb-...
TAVILY_API_KEY=tvly-...
CURRENT_YEAR=2025  # Optional, used for citation formatting

Usage

Run the main application:

python main.py

This will launch the Gradio interface at http://127.0.0.1:7860/

The MCP schema will be available at http://127.0.0.1:7860/gradio_api/mcp/schema

Available Agents

The project includes several agent services:

  1. Question Enhancer: Splits a request into three sub-questions using Qwen3-4B-fast
  2. Web Search Agent: Performs web searches via Tavily API (top-3 results)
  3. LLM Processor: Processes text with Nebius LLMs (Meta-Llama-3.1-8B-Instruct) for summarization, reasoning, or keyword extraction
  4. Citation Formatter: Extracts URLs and formats them as APA-style citations
  5. Code Generator: Creates Python code snippets based on research context using Qwen2.5-Coder-32B-Instruct-fast
  6. Code Runner: Executes Python code in a Modal sandbox environment
  7. Orchestrator: Coordinates all agents in a cohesive workflow

Tutorial Scripts

The tutorial_scripts/ directory contains example Gradio applications and code samples for learning:

  • simple_app.py: A basic Gradio interface
  • letter_count.py: A simple letter counting example
  • predict_letter_count.py: Example of letter counting prediction
  • modal_inference.py: Demonstrates using Modal for code execution
  • nebius_inference.py: Shows how to use Nebius API for inference
  • nebius_tool_calling.py: Example of tool calling with Nebius models
  • Gradio Cheat Sheet.md: Quick reference for Gradio features and usage

MCP Implementation Details

This project demonstrates how to:

  • Create MCP-compatible function definitions with proper typing and docstrings
  • Launch a Gradio app as an MCP server (mcp_server=True)
  • Structure a multi-agent workflow
  • Pass data between agents in a structured format
  • Execute code safely in a sandbox environment

Example Workflow

  1. A user submits a high-level request like "Write Python code to analyze sentiment from Twitter data"
  2. The system breaks this into three sub-questions (e.g., about Twitter APIs, sentiment analysis techniques, and Python libraries)
  3. For each sub-question, it:
    • Performs a web search using Tavily
    • Summarizes the search results
    • Extracts citations from URLs
  4. The sub-summaries are combined into a comprehensive grounded context
  5. Based on this context, Python code is generated
  6. The code is executed in a Modal sandbox
  7. The user receives the final summary, generated code, execution output, and citations

License

[Your license information here]

Contributing

[Your contribution guidelines here]

Acknowledgments

  • Gradio for providing the MCP server functionality
  • Nebius for LLM capabilities
  • Tavily for web search capabilities

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选