MCP-сервер Splunk (анализ логов и SIEM).
⚠️ This project is archived — use the official Splunk MCP Server
Thank you to everyone who used, starred, and forked this project! 🙏 It started as a community effort to bring Model Context Protocol (MCP) support to Splunk, well before an official option existed.
Splunk now ships a first-party, fully supported MCP server that has grown beyond what this community project provides. Please migrate to the official server:
- 📦 Splunk MCP Server on Splunkbase (App 7931, by Splunk LLC): https://splunkbase.splunk.com/app/7931
- 📖 Docs — MCP Server for Splunk Platform: https://help.splunk.com/en/splunk-cloud-platform/mcp-server-for-splunk-platform/
This repository is now read-only / archived and will no longer receive updates. The code below is preserved for historical reference. Thanks again! 🚀
A FastMCP-based tool for interacting with Splunk Enterprise/Cloud through natural language. This tool provides a set of capabilities for searching Splunk data, managing KV stores, and accessing Splunk resources through an intuitive interface.
The tool operates in three modes:
SSE Mode (Default)
/sse endpointAPI Mode
/api/v1 endpoint prefixpython splunk_mcp.py apiSTDIO Mode
python splunk_mcp.py stdioThe following tools are available via the MCP interface:
When running in SSE mode, the following endpoints are available:
/sse: Returns SSE connection information in text/event-stream format
/sse/messages: The main SSE stream endpoint
/sse/health: Health check endpoint for SSE mode
The MCP implementation includes consistent error handling:
All error responses include a detailed message explaining the error.
UV is a fast Python package installer and resolver, written in Rust. It's significantly faster than pip and provides better dependency resolution.
Clone the repository:
git clone <repository-url>
cd splunk-mcp
Install dependencies with UV:
# Install main dependencies
uv sync
# Or install with development dependencies
uv sync --extra dev
Run the application:
# SSE mode (default)
uv run python splunk_mcp.py
# STDIO mode
uv run python splunk_mcp.py stdio
# API mode
uv run python splunk_mcp.py api
# Install dependencies
uv sync
# Install with development dependencies
uv sync --extra dev
# Run the application
uv run python splunk_mcp.py
# Run tests
uv run pytest
# Run with specific Python version
uv run --python 3.11 python splunk_mcp.py
# Add a new dependency
uv add fastapi
# Add a development dependency
uv add --dev pytest
# Update dependencies
uv sync --upgrade
# Generate requirements.txt
uv pip compile pyproject.toml -o requirements.txt
If you prefer Poetry, you can still use it:
# Install dependencies
poetry install
# Run the application
poetry run python splunk_mcp.py
# Install dependencies
pip install -r requirements.txt
# Run the application
python splunk_mcp.py
The tool operates in three modes:
SSE Mode (Default)
/sse endpointAPI Mode
/api/v1 endpoint prefixpython splunk_mcp.py apiSTDIO Mode
python splunk_mcp.py stdioThe tool can run in three modes:
# Start in SSE mode (default)
poetry run python splunk_mcp.py
# or explicitly:
poetry run python splunk_mcp.py sse
# Use uvicorn directly:
SERVER_MODE=api poetry run uvicorn splunk_mcp:app --host 0.0.0.0 --port 8000 --reload
poetry run python splunk_mcp.py stdio
The project supports both the new docker compose (V2) and legacy docker-compose (V1) commands. The examples below use V2 syntax, but both are supported.
docker compose up -d mcp
docker compose run --rm mcp python splunk_mcp.py api
docker compose run -i --rm mcp python splunk_mcp.py stdio
The project includes a dedicated test environment in Docker:
./run_tests.sh --docker
# Run only the MCP server
docker compose up -d mcp
# Run only the test container
docker compose up test
# Run both with test results
docker compose up --abort-on-container-exit
Test results will be available in the ./test-results directory.
# Build both images
docker compose build
# Build specific service
docker compose build mcp
docker compose build test
# View all logs
docker compose logs
# Follow specific service logs
docker compose logs -f mcp
# Run with debug mode
DEBUG=true docker compose up mcp
# Access container shell
docker compose exec mcp /bin/bash
Note: If you're using Docker Compose V1, replace docker compose with docker-compose in the above commands.
.env files.env.example as a templateVERIFY_SSL=true recommended for productionConfigure the following environment variables:
SPLUNK_HOST: Your Splunk host addressSPLUNK_PORT: Splunk management port (default: 8089)SPLUNK_USERNAME: Your Splunk usernameSPLUNK_PASSWORD: Your Splunk passwordSPLUNK_TOKEN: (Optional) Splunk authentication token. If set, this will be used instead of username/password.SPLUNK_SCHEME: Connection scheme (default: https)VERIFY_SSL: Enable/disable SSL verification (default: true)FASTMCP_LOG_LEVEL: Logging level (default: INFO)SERVER_MODE: Server mode (sse, api, stdio) when using uvicornThe tool provides flexible SSL verification options:
VERIFY_SSL=true
VERIFY_SSL=false
The project includes comprehensive test coverage using pytest and end-to-end testing with a custom MCP client:
Basic test execution:
poetry run pytest
With coverage reporting:
poetry run pytest --cov=splunk_mcp