### UV Quick Start Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Steps to clone the repository, install dependencies using UV, and run the application in different modes. ```bash git clone cd splunk-mcp # Install main dependencies uv sync # Or install with development dependencies uv sync --extra dev # 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 ``` -------------------------------- ### Splunk MCP Tool - Installation with UV Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Instructions for installing the Splunk MCP tool using UV, a fast Python package installer. Highlights prerequisites including Python version and UV installation. ```bash # Prerequisites: # - Python 3.10 or higher # - UV installed (see https://docs.astral.sh/uv/getting-started/installation/) # Example installation command (assuming splunk-mcp is published on PyPI): # uv pip install splunk-mcp ``` -------------------------------- ### Local Usage - STDIO Mode Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Instructions for starting the application in STDIO mode locally. ```bash poetry run python splunk_mcp.py stdio ``` -------------------------------- ### Poetry Usage Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Commands for installing dependencies and running the application using Poetry. ```bash # Install dependencies poetry install # Run the application poetry run python splunk_mcp.py ``` -------------------------------- ### Pip Usage Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Commands for installing dependencies using pip and running the application. ```bash # Install dependencies pip install -r requirements.txt # Run the application python splunk_mcp.py ``` -------------------------------- ### Local Usage - SSE Mode Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Instructions for starting the application in SSE mode locally. ```bash # 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 ``` -------------------------------- ### Install Dependencies Source: https://github.com/livehybrid/splunk-mcp/blob/main/README_testing.md Installs the required Python packages for the Splunk MCP API testing scripts, primarily the 'requests' library for making HTTP calls. ```bash pip install requests ``` -------------------------------- ### Splunk MCP Tool - Index Management Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Provides functionalities to list all accessible Splunk indexes, retrieve detailed index information, and get a comprehensive list of indexes and their sourcetypes. ```APIDOC Index Management: list_indexes() Returns a list of all accessible Splunk indexes. get_index_info(index_name: str) Returns detailed information about a specific index. Parameters: index_name (string): The name of the index to get information for. indexes_and_sourcetypes() Returns a comprehensive list of indexes and their sourcetypes. ``` -------------------------------- ### API Endpoint Definition Example Source: https://github.com/livehybrid/splunk-mcp/blob/main/README_testing.md Illustrates the structure for defining a new API endpoint within the `ALL_ENDPOINTS` dictionary in `test_endpoints.py`. It includes essential fields like HTTP method, path, description, validation logic, availability, and optional request data. ```python "new_endpoint": { "method": "GET", "path": "/new_endpoint", "description": "Example new endpoint", "validation": lambda data: assert_dict_keys(data, ["required_field1", "required_field2"]), "available_in": ["api", "sse"] } ``` -------------------------------- ### UV Commands Reference Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Common UV commands for managing dependencies and running the application. ```bash # 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 ``` -------------------------------- ### Docker Development - Building Images Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Commands for building Docker images for the project services. ```docker # Build both images docker compose build # Build specific service docker compose build mcp docker compose build test ``` -------------------------------- ### Security Notes - SSL Verification Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Recommendations for SSL verification settings in different environments. ```markdown 2. **SSL Verification**: - `VERIFY_SSL=true` recommended for production - Can be disabled for development/testing - Configure through environment variables ``` -------------------------------- ### Security Notes - Port Exposure Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Guidelines for secure port exposure in Docker and production environments. ```markdown 3. **Port Exposure**: - Only expose necessary ports - Use internal Docker network when possible - Consider network security in production ``` -------------------------------- ### Docker Testing - Specific Components Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Commands to run specific test components or the entire test suite with results. ```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 ``` -------------------------------- ### Splunk MCP Tool - Available Tools Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Lists all available MCP tools with their descriptions and parameters. This is a core function for understanding the tool's capabilities. ```APIDOC Tools Management: list_tools() Lists all available MCP tools with their descriptions and parameters. ``` -------------------------------- ### Docker Development - Viewing Logs Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Commands for viewing Docker container logs. ```docker # View all logs docker compose logs # Follow specific service logs docker compose logs -f mcp ``` -------------------------------- ### Docker Testing - Run All Tests Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Command to execute all tests within the Docker environment. ```bash ./run_tests.sh --docker ``` -------------------------------- ### Environment Variables Configuration Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md List of environment variables used to configure the Splunk MCP application, including Splunk connection details and server modes. ```APIDOC Environment Variables: - SPLUNK_HOST: Your Splunk host address - SPLUNK_PORT: Splunk management port (default: 8089) - SPLUNK_USERNAME: Your Splunk username - SPLUNK_PASSWORD: Your Splunk password - SPLUNK_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 uvicorn ``` -------------------------------- ### Security Notes - Environment Variables Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Security best practices for managing environment variables, including `.env` files and secrets. ```markdown 1. **Environment Variables**: - Never commit `.env` files - Use `.env.example` as a template - Consider using Docker secrets for production ``` -------------------------------- ### Run Pytest Tests Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Executes the project's test suite using pytest. Includes an option to generate a code coverage report. ```bash poetry run pytest ``` ```bash poetry run pytest --cov=splunk_mcp ``` -------------------------------- ### Docker Usage - STDIO Mode Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Command to run the application in STDIO mode using Docker Compose. ```docker docker compose run -i --rm mcp python splunk_mcp.py stdio ``` -------------------------------- ### Splunk MCP Tool - KV Store Operations Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Provides functionalities for managing KV store collections, including listing, creating, and deleting them. ```APIDOC KV Store: list_kvstore_collections() Lists all KV store collections. create_kvstore_collection(collection_name: str) Creates a new KV store collection. Parameters: collection_name (string): The name for the new collection. delete_kvstore_collection(collection_name: str) Deletes an existing KV store collection. Parameters: collection_name (string): The name of the collection to delete. ``` -------------------------------- ### Splunk MCP Tool - Splunk Search Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Allows execution of Splunk search queries using natural language. Supports specifying time ranges and limiting the number of results. ```APIDOC Search: search_splunk(search_query: str, earliest_time: str = None, latest_time: str = None, max_results: int = None) Executes a Splunk search query. Parameters: search_query (string): The Splunk search string. earliest_time (string, optional): The start time for the search window. latest_time (string, optional): The end time for the search window. max_results (integer, optional): The maximum number of results to return. list_saved_searches() Returns a list of saved searches in the Splunk instance. ``` -------------------------------- ### Docker Development - Debugging Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Commands for debugging Dockerized applications, including running in debug mode and accessing container shells. ```docker # Run with debug mode DEBUG=true docker compose up mcp # Access container shell docker compose exec mcp /bin/bash ``` -------------------------------- ### SSL Verification Modes Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Configures SSL verification behavior. 'true' enables full verification (recommended for production), while 'false' disables verification (useful for testing). ```env VERIFY_SSL=true ``` ```env VERIFY_SSL=false ``` -------------------------------- ### Splunk MCP Tool - User Management Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Enables retrieval of information about the current user and listing all users with their roles. Essential for understanding access and permissions within Splunk. ```APIDOC User Management: current_user() Returns information about the currently authenticated user. list_users() Returns a list of all users and their roles. ``` -------------------------------- ### Splunk MCP API Configuration Options Source: https://github.com/livehybrid/splunk-mcp/blob/main/README_testing.md Lists the environment variables used to configure the Splunk MCP API testing scripts, including API URLs, timeouts, and test-specific parameters like search queries and indexes. ```APIDOC Configuration Environment Variables: SPLUNK_MCP_API_URL: Description: Base URL for API mode. Default: http://localhost:8000/api/v1 SPLUNK_MCP_SSE_URL: Description: Base URL for SSE mode. Default: http://localhost:8000/sse/v1 SPLUNK_MCP_AUTO_DETECT: Description: Auto-detect server mode (true/false). Default: true SPLUNK_MCP_CONNECTION_TIMEOUT: Description: Connection timeout in seconds. Default: 5 SPLUNK_MCP_TIMEOUT: Description: Request timeout in seconds. Default: 30 SPLUNK_MCP_VERBOSE: Description: Enable verbose output (true/false). Default: true SPLUNK_MCP_TEST_QUERY: Description: Search query to test. Default: index=_internal | head 5 SPLUNK_MCP_EARLIEST_TIME: Description: Earliest time for search. Default: -1h SPLUNK_MCP_LATEST_TIME: Description: Latest time for search. Default: now SPLUNK_MCP_MAX_RESULTS: Description: Max results for search. Default: 5 SPLUNK_MCP_TEST_INDEX: Description: Default index to use for tests. Default: (empty) ``` -------------------------------- ### Docker Usage - API Mode Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Command to run the application in API mode using Docker Compose. ```docker docker compose run --rm mcp python splunk_mcp.py api ``` -------------------------------- ### Customize Splunk MCP API Tests via Environment Variables Source: https://github.com/livehybrid/splunk-mcp/blob/main/README_testing.md Demonstrates how to customize the Splunk MCP API testing behavior by setting environment variables for API URLs, search queries, and other parameters. ```bash # Example: Test against a different server export SPLUNK_MCP_API_URL="http://my-splunk-server:8000/api/v1" export SPLUNK_MCP_SSE_URL="http://my-splunk-server:8000/sse/v1" # Example: Use a different search query export SPLUNK_MCP_TEST_QUERY="index=main | head 10" # Example: Set a specific index to test export SPLUNK_MCP_TEST_INDEX="main" # Run with customized settings ./test_endpoints.py ``` -------------------------------- ### Docker Usage - SSE Mode Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Command to run the application in SSE mode using Docker Compose. ```docker docker compose up -d mcp ``` -------------------------------- ### Splunk MCP API Test Script Command-line Arguments Source: https://github.com/livehybrid/splunk-mcp/blob/main/README_testing.md Details the command-line arguments accepted by the `test_endpoints.py` script for controlling test execution, including specifying endpoints, listing them, and setting the server mode. ```APIDOC Command-line Arguments for test_endpoints.py: Positional Arguments: endpoint_names Description: Names of specific endpoints to test. If not provided, all suitable endpoints are tested. Optional Arguments: --list, -l Description: List all available endpoints and exit. --mode {api,sse}, -m {api,sse} Description: Force a specific server mode (API or SSE) instead of auto-detecting. ``` -------------------------------- ### Splunk MCP Test Script Behavior Source: https://github.com/livehybrid/splunk-mcp/blob/main/README_testing.md Describes the expected output and behavior of the test script, including success/failure indicators, error reporting, and exit codes for CI/CD integration. Also mentions the generation of a Markdown report file. ```bash # Script execution will output results for each endpoint test. # Successful tests are marked with ✅, failed tests with ❌ and error details. # The script exits with a non-zero status code on failure, suitable for CI/CD. # A Markdown report file is generated with detailed test results when using run_tests.sh. ``` -------------------------------- ### Splunk MCP Tool - SSE Endpoints Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Details the Server-Sent Events (SSE) endpoints available when the tool is running in SSE mode. These endpoints facilitate real-time bidirectional communication. ```APIDOC SSE Endpoints: /sse Returns SSE connection information in text/event-stream format. Provides metadata about the SSE connection, including the URL for the messages endpoint, protocol, and capability information. /sse/messages The main SSE stream endpoint. Streams system events like heartbeats and maintains a persistent connection. Sends properly formatted SSE events. /sse/health Health check endpoint for SSE mode. Returns status and version information in SSE format. ``` -------------------------------- ### Splunk MCP Tool - Health Check and Ping Source: https://github.com/livehybrid/splunk-mcp/blob/main/README.md Provides endpoints for health checks and basic connectivity verification. 'health_check' returns available Splunk apps, while 'ping' confirms the MCP server is alive. ```APIDOC Health Check: health_check() Returns a list of available Splunk apps to verify connectivity. ping() Simple ping endpoint to verify MCP server is alive. ``` -------------------------------- ### Splunk MCP API Endpoint Configuration Source: https://github.com/livehybrid/splunk-mcp/blob/main/README_testing.md Defines the structure and required fields for configuring API endpoints in the `ALL_ENDPOINTS` dictionary. This includes HTTP method, path, description, validation function, availability, and optional request data. ```APIDOC Endpoint Configuration Structure: method: HTTP method (e.g., GET, POST, PUT, DELETE) path: API endpoint path (e.g., "/users", "/items/{id}") description: A brief explanation of the endpoint's purpose. validation: A function or callable that validates the API response. It typically asserts expected data structures or values. available_in: A list specifying the environments or modes where the endpoint is active (e.g., ["api"], ["sse"], ["api", "sse"]) data: (Optional) Request body or payload for methods like POST or PUT. requires_parameters: (Optional) Boolean flag indicating if the endpoint requires specific parameters in the request. ``` -------------------------------- ### Run Splunk MCP API Tests Source: https://github.com/livehybrid/splunk-mcp/blob/main/README_testing.md Executes the Splunk MCP API test suite. Supports automatic mode detection, listing available endpoints, testing specific endpoints, and forcing a server mode (API or SSE). ```bash # Test all endpoints with automatic mode detection ./test_endpoints.py # List available endpoints ./test_endpoints.py --list # Test specific endpoints ./test_endpoints.py health list_indexes # Test in specific server mode ./test_endpoints.py --mode api ./test_endpoints.py --mode sse # Generate a full test report ./run_tests.sh ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.