SolarWinds日志可视化
STDIO访问和可视化SolarWinds日志的服务器
访问和可视化SolarWinds日志的服务器
A Model Context Protocol (MCP) server for accessing and visualizing SolarWinds Observability logs.
This server is currently incomplete as it does not support structured data search (a limitation of the REST API?). I'm uncertain if it also needs to accept a data center to use in the api endpoint calls. Will address both when time allows (needed it for a real work problem, have to fix that first)
Search SolarWinds Observability logs with optional filtering
Generate a histogram json response for of log events
solarwinds://{query}/search
solarwinds://error/search
Optionally install from npm:
npm install -g mcp-solarwinds
Or clone and build from source:
git clone https://github.com/@jakenuts/mcp-solarwinds.git cd mcp-solarwinds npm install npm run build
Or just use npx in your configurations
Add to %APPDATA%/Code - Insiders/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
:
{ "mcpServers": { "solarwinds": { "command": "npx", "args": ["-y", "mcp-solarwinds"], "env": { "SOLARWINDS_API_TOKEN": "your-api-token" }, "autoApprove": ["search_logs", "visualize_logs"] } } }
Add to the appropriate config file:
Windows: %APPDATA%/Claude/claude_desktop_config.json
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{ "mcpServers": { "solarwinds": { "command": "npx", "args": ["-y", "mcp-solarwinds"], "env": { "SOLARWINDS_API_TOKEN": "your-api-token" } } } }
If you encounter the ENOENT spawn npx issue on Windows, use this alternative configuration that specifies the full paths:
{ "mcpServers": { "solarwinds": { "command": "C:\\Users\\[username]\\AppData\\Roaming\\nvm\\[node-version]\\node.exe", "args": [ "C:\\Users\\[username]\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npx-cli.js", "-y", "mcp-solarwinds" ], "env": { "SOLARWINDS_API_TOKEN": "your-api-token" } } } }
The SolarWinds Observability MCP server requires an API token to authenticate with the SolarWinds Observability API.
There are multiple ways to provide the API token:
SOLARWINDS_API_TOKEN
environment variable.env
file in the project root with SOLARWINDS_API_TOKEN=your-token
For local testing, you can:
.env.example
to .env
and add your tokennode examples/local-test.js
Basic search:
{ "filter": "error" }
Advanced search with time range and pagination:
{ "filter": "error", "entityId": "web-server", "startTime": "2025-03-01T00:00:00Z", "endTime": "2025-03-05T23:59:59Z", "pageSize": 100, "direction": "backward" }
Basic histogram (ASCII chart):
{ "filter": "error", "interval": "hour" }
Advanced visualization (ASCII chart):
{ "filter": "error", "entityId": "web-server", "startTime": "2025-03-01T00:00:00Z", "endTime": "2025-03-05T23:59:59Z", "interval": "day", "use_utc": true }
Claude visualization (JSON format):
{ "filter": "error", "interval": "hour", "format": "json" }
The JSON format returns data that Claude can visualize as a chart:
{ "timeRanges": ["12:02", "12:03", "12:04", "12:05", "12:06", "12:07", "12:08", "12:09"], "counts": [261, 47, 48, 48, 31, 262, 270, 33], "total": 1000, "queryParams": { "query": "error", "startTime": "2025-03-05T00:00:00.000Z", "endTime": "2025-03-05T23:59:59.000Z" } }
Install dependencies:
npm install
Build the server:
npm run build
Since MCP servers communicate over stdio, debugging can be challenging. The MCP Inspector provides helpful debugging tools:
npm run debug:inspector
This will provide a URL to access the inspector in your browser, where you can:
For local testing without the MCP framework:
# Create a .env file with your token cp .env.example .env # Edit .env to add your token # Run the example script node examples/local-test.js