观看演示视频 📽️ https://youtube.com/shorts/jxjmGyXXz7A
通过MCP服务器可以使用以下工具:
data_type('traces'或'logs')、时间范围、服务名称和限制。返回跟踪或日志的表格结果。uv venv .venv
source .venv/bin/activate
uv sync
uv run -m src.signoz_mcp_server.mcp_server
uv来运行其他入口脚本。config.yaml与mcp_server.py在同一目录下,或者设置所需的环境变量(参见配置部分)。src/signoz_mcp_server/config.yaml,添加您的Signoz详情(主机、API密钥如需)。docker-compose up -d
服务器按以下优先级加载配置:
SIGNOZ_HOST: Signoz实例URL(例如:https://your-signoz-instance.com)SIGNOZ_API_KEY: Signoz API密钥(可选)SIGNOZ_SSL_VERIFY: true 或 false(默认:true)MCP_SERVER_PORT: 运行服务器的端口(默认:8000)MCP_SERVER_DEBUG: true 或 _false(默认:true)config.yaml):
signoz:
host: "https://your-signoz-instance.com"
api_key: "your-signoz-api-key-here" # 可选
ssl_verify: "true"
server:
port: 8000
debug: true
您可以将此MCP服务器与支持MCP协议的任何工具集成。以下是主要选项:
{
"mcpServers": {
"signoz": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"SIGNOZ_HOST",
"-e",
"SIGNOZ_API_KEY",
"-e",
"SIGNOZ_SSL_VERIFY",
"drdroidlab/signoz-mcp-server",
"-t",
"stdio"
],
"env": {
"SIGNOZ_HOST": "https://your-signoz-instance.com",
"SIGNOZ_API_KEY": "your-signoz-api-key-here",
"SIGNOZ_SSL_VERIFY": "true"
}
}
}
}
-t stdio是为了兼容Docker MCP客户端(强制使用stdio握手模式)。如果您已经在运行一个MCP服务器(例如,在远程主机、云VM或Kubernetes上),可以直接将您的AI助手或工具连接到其HTTP端点。
{
"mcpServers": {
"signoz": {
"url": "http://your-server-host:8000/mcp"
}
}
}
your-server-host替换为您实际运行MCP服务器的主机。localhost作为服务器主机(即http://localhost:8000/mcp)。http进行本地或未加密部署,使用https进行生产或加密部署。mcp:
endpoint: "http://your-server-host:8000/mcp"
protocolVersion: "2025-06-18"
your-server-host替换为您实际运行MCP服务器的主机。localhost作为服务器主机(即http://localhost:8000/mcp)。http或https。command或args——只需指向HTTP端点。curl http://localhost:8000/health
服务器默认运行在8000端口。