AI Research Agent
Enables autonomous web research, file management, and dynamic UI dashboard generation through Gemini LLM and FastMCP.
README
🤖 Autonomous AI Research Agent (MCP)
This project implements an autonomous AI Research Agent using the Model Context Protocol (MCP). The agent is built with Python, leverages Google's Gemini LLM, and uses FastMCP to dynamically expose robust tools for web searching, local file management, and UI rendering via Prefab UI.
✨ Features
- Autonomous Tool Execution: The Gemini LLM automatically discovers and iteratively calls tools until its objective is met.
- MCP Server Architecture: Provides isolated context and tools out-of-the-box over the
stdiotransport. - Web Research: Integrates
duckduckgo-searchfor real-time web scraping and topic summarization. - File Management: A fully functional local CRUD system that creates markdown reports.
- Dynamic UI Generation: Automatically spins up a Prefab UI dashboard in the background to visualize the research results.
- Rate Limit Resilience: The client features an intelligent backoff system that intercepts
429quota limits and seamlessly resumes operations without crashing.
🏗️ Architecture
The project consists of two core layers seamlessly interacting over the Model Context Protocol:
graph TD
Client["client.py<br/>Agent / LLM"]
Server["server.py<br/>FastMCP Server"]
T1["research_topic()"]
T2["manage_report()"]
T3["render_dashboard()"]
Web["Internet (DuckDuckGo / API)"]
File["reports/ Directory"]
UI["Prefab Dashboard"]
Client <-->|stdio / JSON-RPC| Server
Server --> T1
Server --> T2
Server --> T3
T1 --> Web
T2 --> File
T3 --> UI
Research Tool (research_topic) Report Tool (manage_report) UI Tool (render_dashboard)
client.py: Initializes the Gemini LLM client, connects to theserver.pyusingstdio_client, and translates MCP tool schemas into Gemini Function Declarations.server.py: The FastMCP Server instance. Provides the LLM with the context and the capabilities it needs to interact with the environment.dashboard.py: Auto-generated by the server during execution. Contains the Prefab Python UI component tree.
🚀 Getting Started
1. Prerequisites
- Python 3.10+
uv(The blazing fast Python package manager)- A free Gemini API Key from Google AI Studio.
2. Installation
Install dependencies using uv:
uv init
uv add mcp duckduckgo-search prefab-ui google-genai python-dotenv
3. Environment Variables
Copy the .env.example file to .env and paste your API key:
GEMINI_API_KEY=your_actual_api_key_here
Security Note: The
.envfile is excluded in.gitignoreto prevent leaking your API keys.
4. Running the Agent
Simply run the client script. The server will start automatically in the background.
.venv\Scripts\python.exe client.py
Watch the console as the agent thinks, searches the web, writes reports, and ultimately starts the dashboard!
5. Viewing the Dashboard
Once the agent completes its run, it will host your research report at: 👉 http://127.0.0.1:5175
(To manually run the dashboard at any time, execute: .venv\Scripts\prefab.exe serve dashboard.py)
🔒 Security Practices
- API Keys: Handled securely via
python-dotenv. - Git Ignore:
.env,reports/, and dynamic.pygenerations are strictly ignored. - Server Communication:
server.pycommunicates exclusively viastdio, meaning it does not expose any network ports to the public by default.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。