MCP-联网查询
这是一个为小智AI提供联网搜索功能的服务端系统,支持多用户管理和服务控制。功能特点包括网页界面登录和注册、用户可以注册自己的小智WSS地址、管理员可以管理所有用户的服务以及使用智谱AI的Web Search API提供联网查询功能。系统通过自动重连机制确保服务稳定性。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"xiaozhi_web_search": {
"args": [],
"command": "python main_server.py",
"env": {
"ADMIN_PASSWORD": "admin123",
"ADMIN_USERNAME": "admin",
"PORT": "8001",
"ZHIPUAI_API_KEY": "b978335c687c48cf8e3408dbb41e9259.5yvyBF8bnIZxf7QX"
}
}
}
}
服务介绍
XiaoZhi Internet Query Service
This is a server-side system providing internet search functionality for XiaoZhi AI, supporting multi-user management and service control.
Features
- Web interface for login and registration
- Users can register their own XiaoZhi WSS address
- Administrators can manage all user services
- Uses ZhipuAI's Web Search API to provide internet query capabilities
- Automatic reconnection mechanism ensures service stability
System Requirements
- Python 3.7+
- Required Python packages are listed in
requirements.txt
Installation
- Clone or download this repository
- Install the dependencies:
bash
pip install -r requirements.txt
Usage
Starting the Server
bash
python main_server.py
The server will start on port 8001 and can be accessed via a web browser at http://localhost:8001
User Registration and Usage
- Visit the homepage and click the "Register" link
- Fill in the username, password, and XiaoZhi WSS address
- After logging in, enter the user dashboard
- Click the "Start Service" button to initiate the internet query service
- Once the service is started, your XiaoZhi AI will have internet search capabilities
Administrator Login
- Default administrator account: admin
- Default password: admin123
- The administrator can view all user information and control their services
Deployment to a Server
In a production environment, it is recommended to deploy using Gunicorn and Nginx:
bash
pip install gunicorn
gunicorn -w 4 -b 127.0.0.1:8001 main_server:app
Then configure Nginx to reverse proxy to port 8001.
Security Notes
- In a production environment, please change the default administrator password
- It is recommended to configure HTTPS to protect user information
- The default API key is for testing purposes only; use your own API key in a production environment
Technical Architecture
- Flask: Web framework
- Flask-Login: User authentication
- WebSockets: Communication with XiaoZhi AI
- ZhipuAI: Provides the Web Search API