Skip to content
Back to search

splunk-mcp

[ARCHIVED] Community Splunk MCP server — use the official Splunk MCP Server on Splunkbase (app 7931)

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/livehybrid--splunk-mcp/badge.svg)](/listings/livehybrid--splunk-mcp)

HTML

<a href="/listings/livehybrid--splunk-mcp"><img src="/api/listings/livehybrid--splunk-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Using UV (Recommended)

UV is a fast Python package installer and resolver, written in Rust. It's significantly faster than pip and provides better dependency resolution.

Prerequisites

- Python 3.10 or higher - UV installed (see [UV installation guide](https://docs.astral.sh/uv/getting-started/installation/))

Quick Start with UV

1. **Clone the repository:**

   git clone <repository-url>
   cd splunk-mcp

2. **Install dependencies with UV:**

   # Install main dependencies
   uv sync

   # Or install with development dependencies
   uv sync --extra dev

3. **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

UV Commands Reference

# 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

Using Poetry (Alternative)

If you prefer Poetry, you can still use it:

# Install dependencies
poetry install

# Run the application
poetry run python splunk_mcp.py

Using pip (Alternative)

# Install dependencies
pip install -r requirements.txt

# Run the application
python splunk_mcp.py

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 412 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. > # ⚠️ This project is archived — use the official Splunk MCP Server
  2. >
  3. > **Thank you to everyone who used, starred, and forked this project!** 🙏
  4. > It started as a community effort to bring Model Context Protocol (MCP)
  5. > support to Splunk, well before an official option existed.
  6. >
  7. > **Splunk now ships a first-party, fully supported MCP server** that has grown
  8. > beyond what this community project provides. Please migrate to the official server:
  9. >
  10. > - 📦 **Splunk MCP Server on Splunkbase (App 7931, by Splunk LLC):** https://splunkbase.splunk.com/app/7931
  11. > - 📖 **Docs — MCP Server for Splunk Platform:** https://help.splunk.com/en/splunk-cloud-platform/mcp-server-for-splunk-platform/
  12. >
  13. > This repository is now **read-only / archived** and will no longer receive
  14. > updates. The code below is preserved for historical reference. Thanks again! 🚀
  15. ---
  16. # Splunk MCP (Model Context Protocol) Tool
  17. 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.
  18. ## Operating Modes
  19. The tool operates in three modes:
  20. 1. **SSE Mode** (Default)
  21. - Server-Sent Events based communication
  22. - Real-time bidirectional interaction
  23. - Suitable for web-based MCP clients
  24. - Default mode when no arguments provided
  25. - Access via `/sse` endpoint
  26. 2. **API Mode**
  27. - RESTful API endpoints
  28. - Access via `/api/v1` endpoint prefix
  29. - Start with `python splunk_mcp.py api`
  30. 3. **STDIO Mode**
  31. - Standard input/output based communication
  32. - Compatible with Claude Desktop and other MCP clients
  33. - Ideal for direct integration with AI assistants
  34. - Start with `python splunk_mcp.py stdio`
  35. ## Features
  36. - **Splunk Search**: Execute Splunk searches with natural language queries
  37. - **Index Management**: List and inspect Splunk indexes
  38. - **User Management**: View and manage Splunk users
  39. - **KV Store Operations**: Create, list, and manage KV store collections
  40. - **Async Support**: Built with async/await patterns for better performance
  41. - **Detailed Logging**: Comprehensive logging with emoji indicators for better visibility
  42. - **SSL Configuration**: Flexible SSL verification options for different security requirements
  43. - **Enhanced Debugging**: Detailed connection and error logging for troubleshooting
  44. - **Comprehensive Testing**: Unit tests covering all major functionality
  45. - **Error Handling**: Robust error handling with appropriate status codes
  46. - **SSE Compliance**: Fully compliant with MCP SSE specification
  47. ## Available MCP Tools
  48. The following tools are available via the MCP interface:
  49. ### Tools Management
  50. - **list_tools**
  51. - Lists all available MCP tools with their descriptions and parameters
  52. ### Health Check
  53. - **health_check**
  54. - Returns a list of available Splunk apps to verify connectivity
  55. - **ping**
  56. - Simple ping endpoint to verify MCP server is alive
  57. ### User Management
  58. - **current_user**
  59. - Returns information about the currently authenticated user
  60. - **list_users**
  61. - Returns a list of all users and their roles
  62. ### Index Management
  63. - **list_indexes**
  64. - Returns a list of all accessible Splunk indexes
  65. - **get_index_info**
  66. - Returns detailed information about a specific index
  67. - Parameters: index_name (string)
  68. - **indexes_and_sourcetypes**
  69. - Returns a comprehensive list of indexes and their sourcetypes
  70. ### Search
  71. - **search_splunk**
  72. - Executes a Splunk search query
  73. - Parameters:
  74. - search_query (string): Splunk search string
  75. - earliest_time (string, optional): Start time for search window
  76. - latest_time (string, optional): End time for search window
  77. - max_results (integer, optional): Maximum number of results to return
  78. - **list_saved_searches**
  79. - Returns a list of saved searches in the Splunk instance
  80. ### KV Store
  81. - **list_kvstore_collections**
  82. - Lists all KV store collections
  83. - **create_kvstore_collection**
  84. - Creates a new KV store collection
  85. - Parameters: collection_name (string)
  86. - **delete_kvstore_collection**
  87. - Deletes an existing KV store collection
  88. - Parameters: collection_name (string)
  89. ## SSE Endpoints
  90. When running in SSE mode, the following endpoints are available:
  91. - **/sse**: Returns SSE connection information in text/event-stream format
  92. - Provides metadata about the SSE connection
  93. - Includes URL for the messages endpoint
  94. - Provides protocol and capability information
  95. - **/sse/messages**: The main SSE stream endpoint
  96. - Streams system events like heartbeats
  97. - Maintains persistent connection
  98. - Sends properly formatted SSE events
  99. - **/sse/health**: Health check endpoint for SSE mode
  100. - Returns status and version information in SSE format
  101. ## Error Handling
  102. The MCP implementation includes consistent error handling:
  103. - Invalid search commands or malformed requests
  104. - Insufficient permissions
  105. - Resource not found
  106. - Invalid input validation
  107. - Unexpected server errors
  108. - Connection issues with Splunk server
  109. All error responses include a detailed message explaining the error.
  110. ## Installation
  111. ### Using UV (Recommended)
  112. UV is a fast Python package installer and resolver, written in Rust. It's significantly faster than pip and provides better dependency resolution.
  113. #### Prerequisites
  114. - Python 3.10 or higher
  115. - UV installed (see [UV installation guide](https://docs.astral.sh/uv/getting-started/installation/))
  116. #### Quick Start with UV
  117. 1. **Clone the repository:**
  118. ```bash
  119. git clone <repository-url>
  120. cd splunk-mcp
  121. ```
  122. 2. **Install dependencies with UV:**
  123. ```bash
  124. # Install main dependencies
  125. uv sync
  126. # Or install with development dependencies
  127. uv sync --extra dev
  128. ```
  129. 3. **Run the application:**
  130. ```bash
  131. # SSE mode (default)
  132. uv run python splunk_mcp.py
  133. # STDIO mode
  134. uv run python splunk_mcp.py stdio
  135. # API mode
  136. uv run python splunk_mcp.py api
  137. ```
  138. #### UV Commands Reference
  139. ```bash
  140. # Install dependencies
  141. uv sync
  142. # Install with development dependencies
  143. uv sync --extra dev
  144. # Run the application
  145. uv run python splunk_mcp.py
  146. # Run tests
  147. uv run pytest
  148. # Run with specific Python version
  149. uv run --python 3.11 python splunk_mcp.py
  150. # Add a new dependency
  151. uv add fastapi
  152. # Add a development dependency
  153. uv add --dev pytest
  154. # Update dependencies
  155. uv sync --upgrade
  156. # Generate requirements.txt
  157. uv pip compile pyproject.toml -o requirements.txt
  158. ```
  159. ### Using Poetry (Alternative)
  160. If you prefer Poetry, you can still use it:
  161. ```bash
  162. # Install dependencies
  163. poetry install
  164. # Run the application
  165. poetry run python splunk_mcp.py
  166. ```
  167. ### Using pip (Alternative)
  168. ```bash
  169. # Install dependencies
  170. pip install -r requirements.txt
  171. # Run the application
  172. python splunk_mcp.py
  173. ```
  174. ## Operating Modes
  175. The tool operates in three modes:
  176. 1. **SSE Mode** (Default)
  177. - Server-Sent Events based communication
  178. - Real-time bidirectional interaction
  179. - Suitable for web-based MCP clients
  180. - Default mode when no arguments provided
  181. - Access via `/sse` endpoint
  182. 2. **API Mode**
  183. - RESTful API endpoints
  184. - Access via `/api/v1` endpoint prefix
  185. - Start with `python splunk_mcp.py api`
  186. 3. **STDIO Mode**
  187. - Standard input/output based communication
  188. - Compatible with Claude Desktop and other MCP clients
  189. - Ideal for direct integration with AI assistants
  190. - Start with `python splunk_mcp.py stdio`
  191. ## Usage
  192. ### Local Usage
  193. The tool can run in three modes:
  194. 1. SSE mode (default for MCP clients):
  195. ```bash
  196. # Start in SSE mode (default)
  197. poetry run python splunk_mcp.py
  198. # or explicitly:
  199. poetry run python splunk_mcp.py sse
  200. # Use uvicorn directly:
  201. SERVER_MODE=api poetry run uvicorn splunk_mcp:app --host 0.0.0.0 --port 8000 --reload
  202. ```
  203. 3. STDIO mode:
  204. ```bash
  205. poetry run python splunk_mcp.py stdio
  206. ```
  207. ### Docker Usage
  208. 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.
  209. 1. SSE Mode (Default):
  210. ```bash
  211. docker compose up -d mcp
  212. ```
  213. 2. API Mode:
  214. ```bash
  215. docker compose run --rm mcp python splunk_mcp.py api
  216. ```
  217. 3. STDIO Mode:
  218. ```bash
  219. docker compose run -i --rm mcp python splunk_mcp.py stdio
  220. ```
  221. ### Testing with Docker
  222. The project includes a dedicated test environment in Docker:
  223. 1. Run all tests:
  224. ```bash
  225. ./run_tests.sh --docker
  226. ```
  227. 2. Run specific test components:
  228. ```bash
  229. # Run only the MCP server
  230. docker compose up -d mcp
  231. # Run only the test container
  232. docker compose up test
  233. # Run both with test results
  234. docker compose up --abort-on-container-exit
  235. ```
  236. Test results will be available in the `./test-results` directory.
  237. ### Docker Development Tips
  238. 1. **Building Images**:
  239. ```bash
  240. # Build both images
  241. docker compose build
  242. # Build specific service
  243. docker compose build mcp
  244. docker compose build test
  245. ```
  246. 2. **Viewing Logs**:
  247. ```bash
  248. # View all logs
  249. docker compose logs
  250. # Follow specific service logs
  251. docker compose logs -f mcp
  252. ```
  253. 3. **Debugging**:
  254. ```bash
  255. # Run with debug mode
  256. DEBUG=true docker compose up mcp
  257. # Access container shell
  258. docker compose exec mcp /bin/bash
  259. ```
  260. Note: If you're using Docker Compose V1, replace `docker compose` with `docker-compose` in the above commands.
  261. ### Security Notes
  262. 1. **Environment Variables**:
  263. - Never commit `.env` files
  264. - Use `.env.example` as a template
  265. - Consider using Docker secrets for production
  266. 2. **SSL Verification**:
  267. - `VERIFY_SSL=true` recommended for production
  268. - Can be disabled for development/testing
  269. - Configure through environment variables
  270. 3. **Port Exposure**:
  271. - Only expose necessary ports
  272. - Use internal Docker network when possible
  273. - Consider network security in production
  274. ## Environment Variables
  275. Configure the following environment variables:
  276. - `SPLUNK_HOST`: Your Splunk host address
  277. - `SPLUNK_PORT`: Splunk management port (default: 8089)
  278. - `SPLUNK_USERNAME`: Your Splunk username
  279. - `SPLUNK_PASSWORD`: Your Splunk password
  280. - `SPLUNK_TOKEN`: (Optional) Splunk authentication token. If set, this will be used instead of username/password.
  281. - `SPLUNK_SCHEME`: Connection scheme (default: https)
  282. - `VERIFY_SSL`: Enable/disable SSL verification (default: true)
  283. - `FASTMCP_LOG_LEVEL`: Logging level (default: INFO)
  284. - `SERVER_MODE`: Server mode (sse, api, stdio) when using uvicorn
  285. ### SSL Configuration
  286. The tool provides flexible SSL verification options:
  287. 1. **Default (Secure) Mode**:
  288. ```env
  289. VERIFY_SSL=true
  290. ```
  291. - Full SSL certificate verification
  292. - Hostname verification enabled
  293. - Recommended for production environments
  294. 2. **Relaxed Mode**:
  295. ```env
  296. VERIFY_SSL=false
  297. ```
  298. - SSL certificate verification disabled
  299. - Hostname verification disabled
  300. - Useful for testing or self-signed certificates
  301. ## Testing
  302. The project includes comprehensive test coverage using pytest and end-to-end testing with a custom MCP client:
  303. ### Running Tests
  304. Basic test execution:
  305. ```bash
  306. poetry run pytest
  307. ```
  308. With coverage reporting:
  309. ```bash
  310. poetry run pytest --cov=splunk_mcp
  311. ```

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.