home / mcp / data query mcp server
Provides user, product, and order data querying with WebSocket support for XiaoZhi AI platform.
Configuration
View docs{
"mcpServers": {
"cfy114514-mcp-data-processor": {
"command": "python",
"args": [
"mcp_pipe.py"
],
"env": {
"MCP_CONFIG": "./mcp_config.json",
"MCP_ENDPOINT": "wss://api.xiaozhi.me/mcp/?token=YOUR_TOKEN_HERE"
}
}
}
}You run a Data Query MCP Server to access user, product, and order data through a flexible protocol. It supports real-time querying, WebSocket connections for integration with XiaoZhi AI, and multiple transport options to fit your environment.
Connect your MCP client to the server using the local stdio setup to run the process that hosts the MCP server, or use the WebSocket URL for remote access. You can query users, products, and orders, perform filtering, and explore relationships between users and their orders. Start by launching the server with the recommended command, then point your client at the configured endpoint or run the local stdio instance to engage the MCP pipeline.
Prerequisites you need before starting are Python 3.7 or higher and the following Python packages.
pip install -r requirements.txtSet the environment variables that configure the MCP endpoint and the configuration file you will use.
# Windows PowerShell
$env:MCP_ENDPOINT = "wss://api.xiaozhi.me/mcp/?token=YOUR_TOKEN_HERE"
$env:MCP_CONFIG = "./mcp_config.json"
# Linux/macOS Bash
export MCP_ENDPOINT="wss://api.xiaozhi.me/mcp/?token=YOUR_TOKEN_HERE"
export MCP_CONFIG="./mcp_config.json"Start the server using the standard entry point that runs the configured MCP services. You can run all configured servers or target the data query server specifically.
# Run all configured servers
python mcp_pipe.py
# Or run the data query server individually
python mcp_pipe.py data_query_server.pyThe server configuration is driven by a configuration file referenced via MCP_CONFIG. You can edit mcp_config.json to control which servers are active, their transport type, and any per-server options. If a server entry is disabled, it will be skipped automatically.
Environment variables shown in use include MCP_ENDPOINT for the remote MCP URL and MCP_CONFIG for the path to the configuration file. These should be set in the environment before starting the server and can also be loaded from a .env file if you prefer.
Security: ensure the WebSocket connection uses secure transport (wss) and keep tokens confidential. When deploying publicly, enable automatic reconnection with backoff and validate server certificates.
Examples of supported operations include querying user data with filters, querying product catalogs, analyzing orders, and exploring user-order associations. You can also extend functionality by adding MCP tools such as calculators or data processors, which can run through the same MCP pipeline.
If the server fails to start, check that Python dependencies installed correctly and that MCP_ENDPOINT points to a reachable WebSocket endpoint. Verify that MCP_CONFIG exists and is readable. Review log output for any syntax errors in the configuration file.
If you need to restart after updating configuration, stop the running process and start it again using the same command sequence. For persistent deployments, consider running the server as a system service so it restarts automatically after reboots.
You can extend the MCP server by adding tools that perform custom calculations or data processing. For example, a tool named calculator can be implemented to perform mathematical operations within the MCP framework.
This server focuses on data querying capabilities for users, products, and orders, plus user-order relationships and data statistics. It is designed to work in environments that require WebSocket connectivity to XiaoZhi AI and flexible transport options such as stdio, WebSocket, SSE, or HTTP proxies.
Example MCP tool implementation for mathematical calculations