splunk-mcp
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Integrations
Allows for interacting with Splunk Enterprise/Cloud through natural language queries. Supports executing Splunk searches, managing indexes, viewing users, and performing KV store operations.
Splunk MCP (Model Context Protocol) Tool
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.
Features
- Splunk Search: Execute Splunk searches with natural language queries
- Index Management: List and inspect Splunk indexes
- User Management: View and manage Splunk users
- KV Store Operations: Create, list, and manage KV store collections
- Async Support: Built with async/await patterns for better performance
- Detailed Logging: Comprehensive logging with emoji indicators for better visibility
- SSL Configuration: Flexible SSL verification options for different security requirements
- Enhanced Debugging: Detailed connection and error logging for troubleshooting
- Comprehensive Testing: Unit tests covering all major functionality
Prerequisites
- Python 3.10 or higher
- Poetry for dependency management
- Splunk Enterprise/Cloud instance
- Appropriate Splunk credentials with necessary permissions
Installation
Option 1: Local Installation
- Clone the repository:
- Install dependencies using Poetry:
- Copy the example environment file and configure your settings:
- Update the
.env
file with your Splunk credentials:
Option 2: Docker Installation
- Pull the latest image:
- Create your
.env
file as above or use environment variables directly. - Run using Docker Compose:
Or using Docker directly:
Usage
Local Usage
The tool can run in two modes:
- STDIO mode (default) - for command-line integration:
- SSE mode - for web server integration:
Docker Usage
If using Docker Compose:
If using Docker directly:
Environment Variables
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_SCHEME
: Connection scheme (default: https)VERIFY_SSL
: Enable/disable SSL verification (default: true)FASTMCP_LOG_LEVEL
: Logging level (default: INFO)
SSL Configuration
The tool provides flexible SSL verification options:
- Default (Secure) Mode:
- Full SSL certificate verification
- Hostname verification enabled
- Recommended for production environments
- Relaxed Mode:
- SSL certificate verification disabled
- Hostname verification disabled
- Useful for testing or self-signed certificates
Troubleshooting
Connection Issues
- Basic Connectivity:
- The tool now performs a basic TCP connectivity test
- Check if port 8089 is accessible
- Verify network routing and firewalls
- SSL Issues:
- If seeing SSL errors, try setting
VERIFY_SSL=false
- Check certificate validity and trust chain
- Verify hostname matches certificate
- Authentication Issues:
- Verify Splunk credentials
- Check user permissions
- Ensure account is not locked
- Debugging:
- Set
FASTMCP_LOG_LEVEL=DEBUG
for detailed logs - Check connection logs for specific error messages
- Review SSL configuration messages
Available Tools
- search_splunk
- Execute Splunk searches with customizable time ranges
- Example: Search for events in the last hour
Copy - list_indexes
- List all available Splunk indexes with metadata
- Shows event counts, sizes, and time ranges
- list_users
- Display all Splunk users and their roles
- Includes user metadata and permissions
- KV Store Operations
- list_kvstore_collections: View all KV store collections
- create_kvstore_collection: Create new collections
- delete_kvstore_collection: Remove existing collections
Development
Running Tests
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Claude Desktop Integration
You can integrate Splunk MCP directly with Claude Desktop by adding configuration to your claude_desktop_config.json
file (typically located at ~/Library/Application Support/Claude/claude_desktop_config.json
on macOS).
Configuration Example
Add the following to your claude_desktop_config.json
:
Configuration Parameters
- Docker Configuration:
- Uses the official
livehybrid/splunk-mcp
image - Runs in interactive mode (
-i
) - Automatically removes container after execution (
--rm
) - Uses STDIO mode for Claude integration
- Uses the official
- Environment Variables:
SPLUNK_HOST
: Your Splunk instance URLSPLUNK_USERNAME
: Your Splunk usernameSPLUNK_PORT
: Splunk management port (typically 8089)SPLUNK_PASSWORD
: Your Splunk password
Security Note
When configuring the tool with Claude Desktop:
- Store your
claude_desktop_config.json
in a secure location - Use appropriate file permissions
- Consider using environment variables or a credential manager for sensitive values
- Never share your configuration file containing credentials
License
[Your License Here]
Acknowledgments
- FastMCP framework
- Splunk SDK for Python
- Python-decouple for configuration management
This server cannot be installed
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