- Explore MCP Servers
- mcpo-Test-items_for-ai_agent
Mcpo Test Items For Ai Agent
What is Mcpo Test Items For Ai Agent
mcpo-Test-items_for-ai_agent is a practical application of the MCPO (MCP-to-OpenAPI) proxy server, designed to convert any MCP-based tools into a standard OpenAPI-compliant HTTP server. This project demonstrates the integration of MCP services, such as time queries and web content retrieval, into web applications.
Use cases
Use cases include building intelligent chat systems, integrating AI-driven content analysis in web applications, providing real-time time queries, and enabling users to access and manage their filesystem through a web interface.
How to use
To use mcpo-Test-items_for-ai_agent, first ensure you have Python 3.11+ and the required dependencies installed. Follow the installation steps to set up the MCPO service and Flask application. After configuration, run the MCPO service and the Flask app, then access the application via your web browser at http://127.0.0.1:5000.
Key features
Key features include AI dialogue integration via OpenRouter API, web content analysis by extracting URLs from user messages, precise time information queries, filesystem access for desktop files, and chat history management.
Where to use
mcpo-Test-items_for-ai_agent can be used in various fields such as web development, AI applications, and any scenario requiring standardized access to MCP services through RESTful APIs.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcpo Test Items For Ai Agent
mcpo-Test-items_for-ai_agent is a practical application of the MCPO (MCP-to-OpenAPI) proxy server, designed to convert any MCP-based tools into a standard OpenAPI-compliant HTTP server. This project demonstrates the integration of MCP services, such as time queries and web content retrieval, into web applications.
Use cases
Use cases include building intelligent chat systems, integrating AI-driven content analysis in web applications, providing real-time time queries, and enabling users to access and manage their filesystem through a web interface.
How to use
To use mcpo-Test-items_for-ai_agent, first ensure you have Python 3.11+ and the required dependencies installed. Follow the installation steps to set up the MCPO service and Flask application. After configuration, run the MCPO service and the Flask app, then access the application via your web browser at http://127.0.0.1:5000.
Key features
Key features include AI dialogue integration via OpenRouter API, web content analysis by extracting URLs from user messages, precise time information queries, filesystem access for desktop files, and chat history management.
Where to use
mcpo-Test-items_for-ai_agent can be used in various fields such as web development, AI applications, and any scenario requiring standardized access to MCP services through RESTful APIs.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
智能在线聊天系统 - MCPO测试项目
这是一个基于Flask的在线聊天系统,专门设计用于测试和展示MCPO(MCP-to-OpenAPI代理服务器)的功能。本项目集成了AI大模型对话、网页内容分析和时间查询功能,通过MCPO实现对MCP服务的标准化访问。
关于MCPO
MCPO(MCP-to-OpenAPI)是一个简单高效的代理服务器,可以将任何基于MCP(Model Context Protocol)的工具即时转换为符合OpenAPI标准的HTTP服务器,实现:
- ✅ 通过标准RESTful API访问MCP服务
- 🛡 增强安全性、稳定性和可扩展性
- 🧠 自动生成每个工具的交互式文档
- 🔌 使用纯HTTP协议,无需套接字、无需胶水代码
本项目正是MCPO的一个实际应用案例,展示了如何将MCP服务(时间查询和网页内容获取)集成到Web应用中。
功能特点
- AI对话:接入OpenRouter API,提供DeepSeek等大模型对话服务
- 网页内容分析:自动识别用户消息中的URL,获取网页内容并进行分析
- 时间信息查询:支持用户查询当前时间,获取精确的时区和时间信息
- 文件系统访问:可直接查询桌面文件,自动列出文件和文件夹
- 聊天历史记录:保存会话历史,支持清空历史记录
系统架构
系统由以下几个主要部分组成:
- Flask前端应用:提供Web界面和API接口
- MCPO服务:将MCP工具转换为标准OpenAPI服务
- Fetch服务:负责获取网页内容
- Time服务:提供精确的时间信息
- Filesystem服务:访问桌面文件系统
- AI大模型:通过OpenRouter API接入DeepSeek等大模型
MCPO的优势
在本项目中,MCPO提供了以下关键优势:
- 用户友好且熟悉的接口:无需自定义客户端,只使用HTTP REST端点
- 即时集成:立即兼容数千种现有的REST/OpenAPI工具、SDK和服务
- 强大的自动文档:内置Swagger UI文档自动生成,始终准确并维护
- 无新协议开销:消除了直接处理MCP特定协议复杂性和套接字通信问题的必要性
- 经过验证的安全性和稳定性:继承了成熟的HTTPS传输、标准认证方法(JWT、API密钥)
安装与运行
必备条件
- Python 3.11+
- Flask
- MCPO服务
安装步骤
- 安装Python依赖:
pip install flask requests
- 安装MCPO服务:
pip install mcpo
- 安装文件系统MCP服务:
npm install -g @modelcontextprotocol/server-filesystem
- 运行MCPO服务:
mcpo --config mcp.json --port 8000
- 运行Flask应用:
python app.py
- 访问应用:
在浏览器中打开 http://127.0.0.1:5000
配置说明
mcp.json配置
{
"mcpServers": {
"fetch": {
"command": "uvx",
"args": [
"mcp-server-fetch"
]
},
"time": {
"command": "uvx",
"args": [
"mcp-server-time",
"--local-timezone=America/New_York"
]
},
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"C:\\Users\\Jason\\Desktop"
]
}
}
}
通过这个配置文件,MCPO会自动创建三个服务端点:
- http://localhost:8000/fetch - 用于获取网页内容
- http://localhost:8000/time - 用于获取时间信息
- http://localhost:8000/filesystem - 用于访问桌面文件系统
每个服务都有自己专用的OpenAPI文档(可通过/fetch/docs、/time/docs和/filesystem/docs访问)。
API配置
在app.py中配置以下参数:
OPENROUTER_API_KEY:OpenRouter API密钥OPENROUTER_API_URL:OpenRouter API URLOPENROUTER_MODEL:使用的模型,如"deepseek/deepseek-chat-v3-0324:free"MCP_FETCH_URL:MCPO Fetch服务地址MCP_TIME_URL:MCPO Time服务地址MCP_FILESYSTEM_URL:MCPO Filesystem服务地址
使用说明
- 启动MCPO服务
- 启动Flask应用
- 在浏览器中访问应用
- 在聊天框中输入消息:
- 询问时间信息,如"现在几点了?"
- 输入URL进行网页内容分析
- 任何其他问题进行普通对话
文件结构
├── app.py # Flask应用主文件 ├── fetch_webpage.py # 网页内容获取功能实现 ├── filesystem_operations.py # 文件系统操作功能实现 ├── mcp.json # MCPO服务配置文件 ├── templates/ # HTML模板目录 │ ├── chat.html # 聊天页面模板 │ ├── filesystem.html # 文件系统管理页面 │ └── index.html # 首页模板 └── static/ # 静态资源目录 ├── css/ # CSS样式文件 │ ├── chat.css # 聊天页面样式 │ └── style.css # 通用样式 └── js/ # JavaScript文件 ├── chat.js # 聊天功能脚本 └── script.js # 通用脚本
测试MCPO的目标
本项目作为MCPO的测试应用,旨在验证:
- MCPO服务的稳定性和可靠性
- MCP工具转换为OpenAPI的效果
- 在实际Web应用中集成MCPO的便捷性
- 多种MCP服务(时间、网页内容获取)的并行运行能力
- 通过标准RESTful API访问MCP服务的用户体验
故障排除
如果遇到问题,请检查:
- MCPO服务是否正常运行(通过访问http://localhost:8000/docs验证)
- API端点配置是否正确(注意路径格式,应为/服务名称/服务名称)
- 网络连接是否正常
- API密钥是否有效
开发和扩展
可以通过以下方式扩展系统功能:
- 添加新的MCP服务到test.json
- 增强AI提示词工程
- 添加更多专业领域的分析能力
- 改进用户界面和体验
了解更多关于MCPO
如需了解更多关于MCPO的信息,请访问:
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










