> ## Documentation Index
> Fetch the complete documentation index at: https://agent-observability-docs.splunk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Splunk Agent Observability MCP Server

> Learn how to integrate Splunk Agent Observability's Model Context Protocol (MCP) server with AI-enabled IDEs like Cursor and VS Code

The Splunk Agent Observability Model Context Protocol (MCP) server enables seamless integration between AI-powered IDEs, such as Cursor, or VS Code with GitHub Copilot, and Splunk Agent Observability's evaluation and observability platform.

With MCP, you can access Splunk Agent Observability's capabilities directly from your development environment, including:

* Creating and managing datasets
* Getting guidance on setting up and running experiments
* Setting up prompt templates
* Investigating signals and applying recommended code changes
* Integrating Splunk Agent Observability with your code

## Configure your IDE

Select the instructions for your deployment.

> [tab] On-premises
>
> Before you begin, ensure you have the following:
>
> **1. AI-enabled IDE**
>
> Install an AI-enabled IDE such as [Cursor](https://cursor.sh) or [VS Code](https://code.visualstudio.com) with AI capabilities
>
> **2. API key**
>
> Generate your Splunk Agent Observability API key from the **API keys** page in the UI.
>
> The Splunk Agent Observability MCP server works with both Cursor and VS Code. Follow the steps below for your IDE:
>
> > [tab] VS Code
> >
> > **1. Install GitHub Copilot**
> >
> > Install the [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) extension if you haven't already
> >
> > **2. Open MCP settings**
> >
> > Open the Command Palette (`Ctrl + Shift + P` on Windows/Linux, or `Cmd + Shift + P` on Mac) and search for **"MCP: Open User Configuration"**
> >
> > **3. Add the Splunk Agent Observability MCP server configuration**
> >
> > Copy and paste the configuration below. Replace `YOUR-API-KEY` with your actual Splunk Agent Observability API key and `<your-splunk-ao-api-url>` with your deployment's API URL.
> >
> > ```json VSCode MCP Configuration highlight={3-10} theme={null}
> > {
> >   "servers": {
> >     "splunk_ao_mcp_server": {
> >       "type": "http",
> >       "url": "<your-splunk-ao-api-url>/mcp/http/mcp",
> >       "headers": {
> >         "Splunk-AO-API-Key": "YOUR-API-KEY",
> >         "Accept": "application/json, text/event-stream"
> >       }
> >     }
> >   },
> >   "inputs": []
> > }
> > ```
> >
> > If you're using a self-hosted Splunk Agent Observability deployment, replace the `<your-splunk-ao-api-url>/mcp/http/mcp` url with your deployment URL. The format of this URL is based on your URL, replacing `console` with `api` and appending `/mcp/http/mcp`.
> >
> > **4. Reload VS Code**
> >
> > Reload VS Code by opening the Command Palette and running **"Developer: Reload Window"** for the changes to take effect
>
> > [tab] Cursor
> >
> > **1. Open the MCP server configuration file**
> >
> > Open or create `.cursor/mcp.json` in your project, or `~/.cursor/mcp.json` to make the server available across projects.
> >
> > **2. Add the Splunk Agent Observability MCP server configuration**
> >
> > Copy and paste the configuration below. Replace `YOUR-API-KEY` with your actual Splunk Agent Observability API key and `<your-splunk-ao-api-url>` with your deployment's API URL.
> >
> > ```json Cursor MCP Configuration highlight={3-9} theme={null}
> > {
> >   "mcpServers": {
> >     "splunk_ao_mcp_server": {
> >       "url": "<your-splunk-ao-api-url>/mcp/http/mcp",
> >       "headers": {
> >         "Splunk-AO-API-Key": "YOUR-API-KEY",
> >         "Accept": "application/json, text/event-stream"
> >       }
> >     }
> >   }
> > }
> > ```
> >
> > If you're using a self-hosted Splunk Agent Observability deployment, replace the `<your-splunk-ao-api-url>/mcp/http/mcp` url with your deployment URL. The format of this URL is based on your URL, replacing `console` with `api` and appending `/mcp/http/mcp`.
> >
> > **3. Save and restart**
> >
> > Save the configuration and restart Cursor for the changes to take effect
>
> > [!TIP]
> >
> > Use the configuration for your IDE. Make sure to replace `YOUR-API-KEY` with your actual Splunk Agent Observability API key from the **API keys** page in the UI.

> [tab] SaaS
>
> If you're using Agent Observability in Splunk Observability Cloud, connect through the Splunk MCP Gateway. See [Interact with your observability data using the Splunk MCP server](https://help.splunk.com/en/splunk-observability-cloud/splunk-ai-assistant/interact-with-your-observability-data-using-the-splunk-mcp-server) for more information.
>
> Before you begin, ensure you have the following:
>
> * A coding agent such as [Codex](https://developers.openai.com/codex/mcp), or an AI-enabled IDE such as [Cursor](https://cursor.sh) or [VS Code](https://code.visualstudio.com) with GitHub Copilot.
> * Your Splunk Observability Cloud realm. See [View your realm, API endpoints, and organization](https://help.splunk.com/en/splunk-observability-cloud/administer/org-reference-info/view-your-realm-api-endpoints-and-organization).
> * The MCP Gateway region for your realm. See the **Supported regions** table in [Configure Splunk Observability tools with Splunk MCP Server](https://help.splunk.com/en/splunk-cloud-platform/mcp-server-for-splunk-platform/2.1/connect-splunk-mcp-server-to-other-products-and-clients/configure-splunk-observability-tools-with-splunk-mcp-server).
> * A Splunk Observability Cloud user API access token. See [Retrieve your user API access token](https://help.splunk.com/en/splunk-observability-cloud/administer/authentication-and-security/authentication-tokens/api-access-tokens).
>
> Agent Observability tools are not included in the default tool set. Add the `X-SPLUNK-O11Y-TOOL-SETS` header to select the tools available to your IDE:
>
> | Header value | Tools to include |
> | - | - |
> | `agent_observability` | Agent Observability tools. |
> | `default,agent_observability` | The default Splunk Observability Cloud tools and Agent Observability tools. |
>
> Selecting a tool set doesn't change your permissions or enable features for your organization.
>
> Follow the steps below for your IDE. In each configuration, replace `<SCS-REGION>` with the MCP Gateway region for your realm, `YOUR-REALM` with your Splunk Observability Cloud realm, and `YOUR-USER-ACCESS-TOKEN` with your user API access token.
>
> > [tab] Codex
> >
> > **1. Open the MCP server configuration file**
> >
> > Open or create `~/.codex/config.toml`.
> >
> > **2. Add the Splunk MCP Gateway configuration**
> >
> > ```toml Codex SaaS MCP Configuration theme={null}
> > [mcp_servers.splunk_mcp_gateway]
> > url = "https://region-<SCS-REGION>.api.scs.splunk.com/system/mcp-gateway/v1/"
> >
> > [mcp_servers.splunk_mcp_gateway.http_headers]
> > "Accept" = "application/json, text/event-stream"
> > "X-SF-REALM" = "YOUR-REALM"
> > "X-SF-TOKEN" = "YOUR-USER-ACCESS-TOKEN"
> > "X-SPLUNK-O11Y-TOOL-SETS" = "agent_observability"
> > ```
> >
> > **3. Save and restart**
> >
> > Save the configuration and restart Codex for the changes to take effect. For more information, see [Configure Codex with config.toml](https://developers.openai.com/codex/mcp).
>
> > [tab] VS Code
> >
> > **1. Open MCP settings**
> >
> > Install the [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) extension if you haven't already. Open the Command Palette and run **MCP: Open User Configuration**.
> >
> > **2. Add the Splunk MCP Gateway configuration**
> >
> > ```json VS Code SaaS MCP Configuration highlight={3-12} theme={null}
> > {
> >   "servers": {
> >     "splunk_mcp_gateway": {
> >       "type": "http",
> >       "url": "https://region-<SCS-REGION>.api.scs.splunk.com/system/mcp-gateway/v1/",
> >       "headers": {
> >         "Accept": "application/json, text/event-stream",
> >         "X-SF-REALM": "YOUR-REALM",
> >         "X-SF-TOKEN": "YOUR-USER-ACCESS-TOKEN",
> >         "X-SPLUNK-O11Y-TOOL-SETS": "agent_observability"
> >       }
> >     }
> >   },
> >   "inputs": []
> > }
> > ```
> >
> > **3. Reload VS Code**
> >
> > Save the configuration, then open the Command Palette and run **Developer: Reload Window**.
>
> > [tab] Cursor
> >
> > **1. Open the MCP server configuration file**
> >
> > Open or create `.cursor/mcp.json` in your project, or `~/.cursor/mcp.json` to make the server available across projects.
> >
> > **2. Add the Splunk MCP Gateway configuration**
> >
> > ```json Cursor SaaS MCP Configuration highlight={3-11} theme={null}
> > {
> >   "mcpServers": {
> >     "splunk_mcp_gateway": {
> >       "url": "https://region-<SCS-REGION>.api.scs.splunk.com/system/mcp-gateway/v1/",
> >       "headers": {
> >         "Accept": "application/json, text/event-stream",
> >         "X-SF-REALM": "YOUR-REALM",
> >         "X-SF-TOKEN": "YOUR-USER-ACCESS-TOKEN",
> >         "X-SPLUNK-O11Y-TOOL-SETS": "agent_observability"
> >       }
> >     }
> >   }
> > }
> > ```
> >
> > **3. Save and restart**
> >
> > Save the configuration and restart Cursor for the changes to take effect.
>
> To include the default Splunk Observability Cloud tools as well, set `X-SPLUNK-O11Y-TOOL-SETS` to `default,agent_observability`.

## Verify your setup

Once configured, you can verify your MCP setup by asking your AI assistant
in your IDE:

```text Example Query theme={null}
Can you show me how to add Splunk Agent Observability logging to my agent bot?
```

```text Create Dataset Query theme={null}
Help me create a synthetic dataset for customer support queries
```

```text Integration Query theme={null}
How do I integrate Splunk Agent Observability with LangChain?
```

Your AI assistant should now be able to access Splunk Agent Observability's capabilities and
respond with information from your Splunk Agent Observability account.

## Tools

The Splunk Agent Observability MCP server provides powerful tools that you can access through
natural conversation with your AI assistant. Simply ask questions or make
requests, and the AI will use these tools to help you.

> [accordion] Create Datasets
>
> Generate synthetic datasets or upload your own data to test and evaluate your AI applications. The tool supports creating datasets with various types of queries including general queries, prompt injections, off-topic content, and toxic content scenarios.
>
> **What you can ask:**
>
> ```text Query wrap theme={null}
> Create a dataset with 50 customer service queries about billing issues
> ```
>
> ```text Query wrap theme={null}
> Generate a dataset of 30 chatbot queries, including some prompt injection attempts
> ```
>
> ```text Query wrap theme={null}
> Make a dataset with product recommendation queries and include off-topic questions
> ```

> [accordion] Check Dataset Status
>
> Track the progress of your dataset generation and preview the generated content. You'll see the first 10 rows of data along with generation status and progress updates.
>
> **What you can ask:**
>
> ```text Query wrap theme={null}
> Check the status of my dataset that's currently generating
> ```
>
> ```text Query wrap theme={null}
> Show me the preview of dataset abc-123
> ```
>
> ```text Query wrap theme={null}
> Is my customer service dataset ready yet?
> ```

> [accordion] Create Prompt Templates
>
> Build reusable prompt templates that you can use across all your projects. Set up model configurations, temperature settings, and other parameters for consistent prompt behavior.
>
> **What you can ask:**
>
> ```text Query wrap theme={null}
> Create a prompt template called "Friendly Assistant" for customer support responses
> ```
>
> ```text Query wrap theme={null}
> Make a prompt template for summarizing technical documentation with lower temperature
> ```
>
> ```text Query wrap theme={null}
> Set up a chat template for a code review assistant
> ```

> [accordion] Set Up Experiments
>
> Get complete guidance on setting up and running Splunk Agent Observability experiments, including dataset preparation, evaluators configuration, and integration with your existing code. Available for Python and other supported languages.
>
> **What you can ask:**
>
> ```text Query wrap theme={null}
> How do I set up a Splunk Agent Observability experiment in Python?
> ```
>
> ```text Query wrap theme={null}
> Show me how to run an experiment with my RAG application
> ```
>
> ```text Query wrap theme={null}
> Guide me through creating an experiment for my agentic workflow
> ```

> [accordion] Remediate Signals
>
> Investigate a signal's recommended code change and supporting evidence from your IDE. Start with the brief generated by **Fix in your codebase** on the signal's **Remediate** tab.
>
> Your coding agent can use the following tools:
>
> * `get_code_remediation`: Read the signal's diagnosis and recommended change.
> * `get_signal_evidence`: Retrieve affected occurrences and their evidence references.
> * `get_signal_evidence_context`: Read nearby spans for an affected event.
> * `get_signal_evidence_span`: Read a referenced span's input and output.
>
> **What you can ask:**
>
> ```text Query wrap theme={null}
> Use this Signal brief to review the recommended change and its supporting
> evidence, then propose a fix in my codebase.
> ```
>
> ```text Query wrap theme={null}
> Show me the evidence behind this recommendation and suggest tests for the fix.
> ```

> [accordion] Integrate with OpenAI
>
> Get step-by-step integration guides for adding Splunk Agent Observability to your OpenAI applications. Automatically log prompts, responses, model parameters, and token usage with minimal code changes.
>
> **What you can ask:**
>
> ```text Query wrap theme={null}
> How do I add Splunk Agent Observability logging to my OpenAI application?
> ```
>
> ```text Query wrap theme={null}
> Show me how to integrate Splunk Agent Observability with OpenAI
> ```
>
> ```text Query wrap theme={null}
> Help me set up Splunk Agent Observability for my GPT-4 chatbot
> ```

> [accordion] Integrate with LangChain
>
> Get complete integration instructions for adding Splunk Agent Observability to your LangChain applications. Capture full traces of your chains, agents, and tools with automatic logging.
>
> **What you can ask:**
>
> ```text Query wrap theme={null}
> How do I integrate Splunk Agent Observability with my LangChain application?
> ```
>
> ```text Query wrap theme={null}
> Show me how to add Splunk Agent Observability tracing to my LangChain agent
> ```
>
> ```text Query wrap theme={null}
> Help me log my LangChain RAG pipeline with Splunk Agent Observability
> ```

> [accordion] Search Documentation
>
> Find relevant information, code examples, API references, and implementation guides across all Splunk Agent Observability documentation. Get direct links to the pages you need.
>
> **What you can ask:**
>
> ```text Query wrap theme={null}
> How do I set up data logging in Splunk Agent Observability?
> ```
>
> ```text Query wrap theme={null}
> Find documentation about custom evaluators
> ```
>
> ```text Query wrap theme={null}
> Search for examples of agentic AI evaluation
> ```

## Example use cases

### Create a synthetic dataset

Ask your AI assistant:

```text Query wrap theme={null}
Create a synthetic dataset with 20 customer service queries about product
returns. Include both general queries and off-topic queries.
```

The MCP server will guide you through the dataset creation process and
provide a dataset ID to track progress.

### Get integration help

Ask your AI assistant:

```text Query wrap theme={null}
How do I integrate Splunk Agent Observability with my LangChain application in Python?
```

The MCP server will provide complete integration code examples and setup
instructions.

### Remediate a signal in your codebase

1. Open a signal in your Agent Stream and select the **Remediate** tab.
2. For a recommendation that supports code changes, select **Fix in your codebase**.
3. Select **Open in Codex**, **Open in Cursor**, or **Copy prompt** to provide the brief to your coding agent.
4. Connect your coding agent to the MCP server for the deployment that hosts the signal.

The brief includes the signal's context, remediation instructions, and references to supporting evidence. Your coding agent can retrieve the evidence through MCP, inspect your codebase, and propose changes and tests.

For more information, see [Signals](https://agent-observability-docs.splunk.com/concepts/signals/signals.md).

## Troubleshooting

> [accordion] Error connecting to Splunk Agent Observability MCP Server
>
> * For on-premises deployments, check that the MCP server URL is set to `<your-splunk-ao-api-url>/mcp/http/mcp`.
> * For SaaS, check that the MCP Gateway URL uses the region for your Splunk Observability Cloud realm and ends with `/system/mcp-gateway/v1/`.
> * Ensure the `Accept` header is set to `application/json, text/event-stream`
> * Restart your IDE MCP connection after making configuration changes

> [accordion] Signals evidence tools are unavailable
>
> * Confirm that your MCP connection points to the deployment that hosts the signal.
> * Confirm that Signals is available in that deployment.
> * For SaaS, include `agent_observability` in the `X-SPLUNK-O11Y-TOOL-SETS` header. Use `default,agent_observability` to include both tool sets.
> * Refresh your IDE's MCP connection to reload the available tools.

> [accordion] On-premises API key errors
>
> * Confirm your API key is properly set in the configuration
> * Check that your API key has not expired
> * Generate a new API key from the **API keys** page in the UI

> [accordion] SaaS authentication errors
>
> * Confirm that `X-SF-REALM` matches your Splunk Observability Cloud realm.
> * Confirm that `X-SF-TOKEN` contains a valid user API access token for that realm.
> * If the token has expired, retrieve a new token and update your configuration.

## Next steps

> [card] [Log your first trace](https://agent-observability-docs.splunk.com/getting-started/quickstart.md)
>
> Learn how to log your first trace with Splunk Agent Observability

> [card] [Run your first experiment](https://agent-observability-docs.splunk.com/getting-started/experiments.md)
>
> Set up and run experiments to evaluate your AI applications

> [card] [Explore integrations](https://agent-observability-docs.splunk.com/sdk-api/third-party-integrations/overview.md)
>
> Learn about Splunk Agent Observability integrations with third-party frameworks


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.