The Splunk MCP Tool enables natural language interaction with Splunk Enterprise/Cloud, providing capabilities for searching data, managing KV stores, and accessing Splunk resources through an intuitive interface.
UV is a fast Python package installer and resolver that offers better performance than pip.
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
# 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 Splunk MCP tool can operate in three different modes:
Server-Sent Events based communication for real-time bidirectional interaction.
# Start in SSE mode (default)
python splunk_mcp.py
# or explicitly:
python splunk_mcp.py sse
# Using uvicorn directly:
SERVER_MODE=sse uvicorn splunk_mcp:app --host 0.0.0.0 --port 8000 --reload
RESTful API endpoints available via the /api/v1
prefix.
# Start in API mode
python splunk_mcp.py api
# Using uvicorn directly:
SERVER_MODE=api uvicorn splunk_mcp:app --host 0.0.0.0 --port 8000 --reload
Standard input/output based communication, compatible with Claude Desktop and other MCP clients.
# Start in STDIO mode
python splunk_mcp.py stdio
The project supports both Docker Compose V2 and legacy V1 commands.
# SSE Mode (Default)
docker compose up -d mcp
# API Mode
docker compose run --rm mcp python splunk_mcp.py api
# STDIO Mode
docker compose run -i --rm mcp python splunk_mcp.py stdio
# Build images
docker compose build
# View logs
docker compose logs
docker compose logs -f mcp
# Debug mode
DEBUG=true docker compose up mcp
# Access container shell
docker compose exec mcp /bin/bash
Configure 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 tokenSPLUNK_SCHEME
: Connection scheme (default: https)VERIFY_SSL
: Enable/disable SSL verification (default: true)FASTMCP_LOG_LEVEL
: Logging level (default: INFO)SERVER_MODE
: Server mode when using uvicorn# Secure Mode (recommended for production)
VERIFY_SSL=true
# Relaxed Mode (for testing or self-signed certificates)
VERIFY_SSL=false
When running in SSE mode, the following endpoints are available:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "splunk" '{"command":"poetry","env":{"SPLUNK_HOST":"your_splunk_host","SPLUNK_PORT":"8089","SPLUNK_USERNAME":"your_username","SPLUNK_PASSWORD":"your_password","SPLUNK_SCHEME":"https","VERIFY_SSL":"false"},"args":["--directory","/path/to/splunk-mcp","run","python","splunk_mcp.py","stdio"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"splunk": {
"command": "poetry",
"env": {
"SPLUNK_HOST": "your_splunk_host",
"SPLUNK_PORT": "8089",
"SPLUNK_USERNAME": "your_username",
"SPLUNK_PASSWORD": "your_password",
"SPLUNK_SCHEME": "https",
"VERIFY_SSL": "false"
},
"args": [
"--directory",
"/path/to/splunk-mcp",
"run",
"python",
"splunk_mcp.py",
"stdio"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"splunk": {
"command": "poetry",
"env": {
"SPLUNK_HOST": "your_splunk_host",
"SPLUNK_PORT": "8089",
"SPLUNK_USERNAME": "your_username",
"SPLUNK_PASSWORD": "your_password",
"SPLUNK_SCHEME": "https",
"VERIFY_SSL": "false"
},
"args": [
"--directory",
"/path/to/splunk-mcp",
"run",
"python",
"splunk_mcp.py",
"stdio"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect