Your logs are already in Splunk. Your AI agent can't read them. The lazy fix is to hand the agent an admin login and hope it behaves, and that is the fix I would avoid.

I've spent about 12 years in DevSecOps and SIEM work, and I'm a certified Splunk architect. The first thing that work teaches you about any new data path is to decide who can read what, and how you will prove it afterward. An AI agent with a search tool is a new data path. It deserves the same treatment as a new analyst account: its own identity, a short list of indexes, search limits, and an audit trail.

The Splunk MCP Server app gives you the pieces for that. This guide sets it up on a homelab so an agent can search your logs and nothing else: a dedicated role, a dedicated user, an encrypted token that expires, limits on how much it can pull, and a way to see every search it ran.

Who this is for: You run Splunk Enterprise in your homelab (my Splunk homelab monitoring guide gets you there) and you want an MCP client such as Claude Code or Cursor to query it. You need a license that supports users and tokens. Splunk Free does not. Section 02 explains the options.

Sources and versions: Facts below come from Splunk's MCP Server documentation, the Splunkbase listing, and Splunk's licensing and role documentation as of December 3, 2026. Menu names move between releases. Where I could not confirm an exact value, I say so in the text.

01 What the Splunk MCP Server Does

It is an app you install from Splunkbase on a search head. It exposes a set of tools to any MCP client that supports streamable HTTP. The client authenticates with an encrypted token, and every tool call runs as the Splunk user who owns that token.

The tool that matters most is splunk_run_query. It runs SPL, and SPL2 if you prefix the query with @spl2. Around it sit tools to list indexes, read index details, pull host and source metadata, list sourcetypes, run a saved search by name, and inspect alerts. The five alert tools that arrived with version 2.0 are read-only. If you also install Splunk AI Assistant, extra tools such as generate_spl and explain_spl show up. You do not need it for anything here.

Three behaviors are what make this reasonable to point an agent at:

  • Every query from splunk_run_query is checked against an allowlist of safe SPL commands. Splunk describes the tool as meant for quick, non-destructive searches, and it fails if a query uses a blocked command, runs past the timeout, or asks for more rows than the limit allows.
  • The rest command works through it, read-only. POST and DELETE are blocked.
  • Tools run as the calling user, so your existing index and knowledge-object permissions still apply. You do not maintain a second permission model for agents.

Because of that, the agent sees exactly what its user sees, so the job is to make that user very boring.

02 Why Splunk Free Won't Work

Splunk's own documentation is blunt about what Free removes. There are no users or roles, no login, and the only role is a fixed admin. Features that rely on user authentication do not work, and search restrictions such as user quotas, maximum time ranges, and search filters are not supported.

The MCP Server needs token authentication, and a role to hang limits on. Splunk's docs do not list the MCP Server by name among the Free restrictions, so this part is my inference from the missing authentication. I would not expect it to work, and a read-only role is the whole point anyway.

You have three realistic options for a homelab:

  • The 60-day Enterprise Trial that every fresh Splunk Enterprise install starts with. It has the full feature set and a 500 MB per day limit. After 60 days it converts to Free, which means users, roles, and token authentication stop working. Good for trying this guide, not for keeping it.
  • The Splunk Developer license. It gives you the full Enterprise feature set, 10 GB per day, and it expires after 6 months. You can request a renewal one week before it expires. You request it on Splunk's developer program page.
  • A paid Enterprise license.

Read the license terms before you rely on the Developer license. Splunk describes it as a license for developing and testing content for use with Splunk, under the Splunk Developer Agreement, and says it cannot be used for production use cases. Whether monitoring your own homelab fits inside that is a question for the agreement and for Splunk, not for me. I am not giving legal advice on it.

If you followed my Free guide and switched your instance to the Free license, you need to move to one of the options above first. Splunk notes that user accounts and roles you create no longer work after switching to Free, so check your users and roles after you switch back.

03 Architecture on a Tailnet

The shape is simple. The agent client talks to the MCP Server app over HTTPS with a bearer token. The app runs searches against Splunk as the agent's user. Splunk records each search in the _audit index.

Agent client                 Splunk MCP Server app          Splunk search head
(Claude Code, Cursor)  --->  (role: mcp_agent_ro)    --->   (main, docker only)
   HTTPS + bearer token                                          |
                                                                 v
                                              _audit: every search, tagged as MCP

Keep the whole thing off the public internet, as in the rest of this site's homelab guides. Allow the agent host and nothing else to reach Splunk. With Tailscale, that is a rule for one node:

# Allow only the agent host's Tailscale IP to reach the Splunk management port
sudo ufw allow from 100.x.y.z to any port 8089 proto tcp

# Never expose Splunk ports directly to the public internet

Use whichever port your MCP endpoint is on. Section 06 explains how to find it. My AI agent homelab guide covers the Tailscale setup the agent host sits on.

04 Install and Enable

Turn on token authentication

Splunk Enterprise has two prerequisites for token authentication: TLS enabled on the instance, and the app key value store (KV Store) running, which is on by default on search heads. Then, as an admin, go to Settings, Tokens, and select Enable Token Authentication. It takes effect immediately, with no restart.

One thing to know up front: you cannot use a token to log in to Splunk Web. You always need a username and password for that.

Install the app

The Splunk MCP Server is Splunkbase app 7931. The default version listed on December 3, 2026 is 2.2.0, released November 25, 2026, with compatibility from Splunk Enterprise 9.3 through 10.8. Install it with the normal add-on process (Apps, Manage Apps, Install app from file). Splunk says you might be prompted to restart so the new capabilities become available, so restart if it asks.

The app adds two capabilities:

  • mcp_tool_execute lets a role use the MCP tools.
  • mcp_tool_admin lets a role manage tools, settings, and tokens.

Your agent's role gets the first and never the second.

One thing I could not pin down: Splunk's setup page says roles that use the MCP tools also need access to the APIs, without naming a capability. If the agent gets a permissions error after you assign mcp_tool_execute, check this first, and compare against what the default user role includes.

05 Lock It Down

Create the role

You can do this in Settings, Roles, or in authorize.conf. The file version is easier to review and paste into your notes. Role names must be lowercase, the stanza starts with role_, and Splunk needs a restart or an authentication reload before the role appears.

# /opt/splunk/etc/system/local/authorize.conf
[role_mcp_agent_ro]
importRoles = user
srchIndexesAllowed = main;docker
srchIndexesDefault = main
srchTimeWin = 604800
srchJobsQuota = 2
srchDiskQuota = 100
mcp_tool_execute = enabled
sudo /opt/splunk/bin/splunk reload auth

Here is what each line does:

  • importRoles = user starts from the stock role for ordinary searchers. Splunk does not let you disable an inherited capability, so open the role in Settings, Roles and read the capability list before you trust it.
  • srchIndexesAllowed is the list of indexes the role can search, separated by semicolons. Only list indexes that hold nothing you would be upset to see in a chat transcript. If an index captures environment variables, tokens, or request bodies, leave it out. A wildcard here does not match internal indexes that start with an underscore, so _internal and _audit stay closed.
  • srchTimeWin is the maximum time range of one search, in seconds. 604800 is seven days.
  • srchJobsQuota is the number of historical searches the role can run at the same time. Two is plenty for one agent.
  • srchDiskQuota is the disk space in megabytes that its search jobs can use. Splunk's default is 100.

Splunk also supports srchFilter, which silently adds a filter to every search the role runs. It accepts terms like host= and sourcetype=. I leave it out here because limiting indexes does most of the work on a homelab, but it is the tool to reach for if one index mixes sensitive and harmless hosts.

Create the user

Create a user, mcp-agent, and give it only this role. For time range and job limits, Splunk applies the least restrictive value when a user holds several roles, so a second role quietly undoes your quotas. Use a long random password you never type anywhere, because this account only ever authenticates with a token.

Limit which tools the agent sees

In the MCP Server app, open Settings, then Tools. You can map Splunk roles to individual tools. A tool with a role mapping is hidden from, and blocked for, every role that is not on the list, except roles with mcp_tool_admin. A tool with no mapping is open to every role that has mcp_tool_execute.

So the way to hide a tool from the agent is to map it to a role the agent does not hold. Saving a tool with no roles selected clears its policy and opens it up again. I would hide anything about users, KV Store, and knowledge objects, and hide splunk_run_saved_search until you have read what each saved search does. That is my judgment call, not a Splunk requirement. The agent keeps splunk_run_query, splunk_get_indexes, splunk_get_index_info, splunk_get_metadata, splunk_get_sourcetypes, and splunk_get_info.

Set the server limits

Still in the app, Settings, then Server holds the guardrails an admin controls: the tool timeout, the default row limit, the maximum row limit, the rate-limit window, and a global rate limit on tool calls. The release notes for 2.2 say the default row limit is 10,000 and the maximum row limit defaults to 50,000. Older pages in Splunk's docs quote lower numbers, including a 1,000-event cap and a 60-second timeout for the rest command. Read the values on your own Server page and do not trust my numbers or theirs.

For a homelab I would lower the row limits well below the defaults, because an agent summarizing logs never needs 10,000 raw rows. Set a global rate limit too. The Commands tab shows the SPL allowlist. Only add a command if you hit a real need, since the bundled defaults can't be removed but anything you add can widen what the agent can run.

Create the token

In the app, go to Settings, then Encrypted Tokens, and select Create token. As an admin you can create it for the mcp-agent user. The audience is fixed to mcp. Choose an expiry of 30 days, the shortest preset (the others are 60, 90, and 120 days, or a custom date). Splunk shows the token once, so copy it straight into your password manager.

Splunk's notes on these tokens are worth repeating. They work only for MCP authentication and cannot call the Splunk REST API directly. They are also ordinary Splunk tokens, so you can see them on the main Tokens page. The generated JSON configuration contains the token, so treat that snippet as a secret. To rotate, create a new token and update the client before the old one expires.

06 Connect a Client

The app shows you the endpoint and a sample client configuration when you create a token. Use those values. On Splunk Cloud the endpoint is the Splunk Web URL over 443, and older clients can keep using the direct /services/mcp endpoint on the management port, which is 8089 by default. I can't tell you which form your build displays, so copy what the app gives you.

Splunk's own sample

Splunk's documented sample uses mcp-remote through npx, so it needs Node.js on the client machine. Replace both placeholders:

{
  "mcpServers": {
    "splunk-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://<MCP_SERVER_ENDPOINT>",
        "--header",
        "Authorization: Bearer <YOUR_ENCRYPTED_TOKEN>"
      ]
    }
  }
}

Claude Code

Claude Code can talk to a remote HTTP server directly, so you can skip mcp-remote. This form comes from Claude Code's documentation, not Splunk's:

claude mcp add --transport http splunk https://<MCP_SERVER_ENDPOINT> \
  --header "Authorization: Bearer <YOUR_ENCRYPTED_TOKEN>"

Claude Code saves this without checking the token, so run /mcp in a session to confirm it connected. The header value is stored in the client's config file, so treat that file like a credential.

Cursor

Cursor supports streamable HTTP with a headers block in mcp.json. Reading the token from an environment variable keeps it out of a file you might commit:

{
  "mcpServers": {
    "splunk": {
      "url": "https://<MCP_SERVER_ENDPOINT>",
      "headers": {
        "Authorization": "Bearer ${env:SPLUNK_MCP_TOKEN}"
      }
    }
  }
}

Set SPLUNK_MCP_TOKEN in your shell profile and restart Cursor fully so it picks it up.

Certificates: A fresh Splunk install uses a self-signed certificate. Splunk documents ssl_verify in mcp.conf and an NODE_TLS_REJECT_UNAUTHORIZED setting for the mcp-remote sample, and labels both as non-production only. In a homelab I would rather give Splunk a certificate the client already trusts than turn verification off.

Any other client that supports streamable HTTP and custom headers can use the same endpoint and header. I have not written client-specific steps for n8n or OpenClaw here. If you run either, my n8n workflows guide and OpenClaw deployment guide cover the base setup.

07 Five Questions to Ask Your Lab

Once connected, ask in plain language and have the agent show you the SPL it ran. Your agent will write its own queries, and they won't match mine. The versions below assume the main and docker indexes from my Splunk guide. Adjust field names to your own log formats.

Who is failing to log in over SSH?

Prompt: "Which hosts had failed SSH logins in the last 24 hours, and from which source IPs? Show me the search you ran."

index=main sourcetype=linux_secure "Failed password" earliest=-24h
| rex "from (?<src_ip>\d+\.\d+\.\d+\.\d+)"
| stats count by host, src_ip
| sort -count

Which containers are noisy?

Prompt: "Which containers logged the most errors in the last 6 hours?"

index=docker earliest=-6h ("error" OR "fatal" OR "panic")
| stats count by source
| sort -count
| head 10

Which hosts went quiet?

Prompt: "Which hosts have stopped sending logs for more than 30 minutes?" This is the query from my monitoring guide. If the allowlist rejects a command, the error says so, and the Commands tab in the app shows what is permitted.

| metadata type=hosts index=main
| where recentTime < now()-1800
| eval minutes_silent=round((now()-recentTime)/60)
| table host minutes_silent

Who ran sudo?

Prompt: "Who ran sudo on each host in the last day, and how many times?"

index=main sourcetype=linux_secure "sudo" "COMMAND" earliest=-24h
| rex "sudo:\s+(?<sudo_user>\S+)\s+:"
| stats count by host, sudo_user

How much am I ingesting? (This one should fail.)

Prompt: "Which indexes used the most license volume this week?" The usual answer comes from _internal, and the role above cannot read it. A refusal here means the limits are working. Run that search yourself in Splunk Web, or give the agent a summary index of license numbers that you build and control.

08 Audit the Agent

Splunk says searches issued through the MCP Server carry a provenance label into _audit. Published audit events show the label in the form MCP:Splunk_MCP_Server:<tool_name>. Confirm that on your own instance, then build the view you will check every week:

index=_audit action=search provenance="MCP:*"
| table _time user provenance search
| sort -_time

For a summary of which tools the agent leans on:

index=_audit action=search provenance="MCP:*"
| stats count by user, provenance

Turn the second idea into an alert for bursts. The threshold below is a starting guess, so tune it after a week of normal use:

index=_audit action=search provenance="MCP:*"
| bin _time span=5m
| stats count by _time, user
| where count > 30

The MCP Server app also has a Usage tab with telemetry dashboards for admins. I have not checked how much of it fills in on a self-hosted instance, so start with _audit, which is the first place a security team looks anyway. You can read _audit because you are an admin. The agent's role can't.

09 Failure Modes and Prompt Injection

A read-only Splunk role limits what the agent can do to Splunk. It does not limit what the agent does with what it reads.

Log lines are untrusted input. Anyone who can make something write a log entry can put text in front of your agent: a failed SSH username, a user-agent string, the output of a container someone else built. If the same client session also holds a shell, email, or an n8n webhook, a crafted log line is an attempt to use those tools. Keep the Splunk agent in its own session with no other tools, and pass summaries to anything that can act.

Other things to plan for:

  • The model can write expensive or wrong SPL. Quotas, the job limit, and the rate limit exist for that, and asking for the search text lets you check the answer. For anything that matters, rerun the search in Splunk Web.
  • A leaked token is a leaked identity. The 30-day expiry, the tailnet-only firewall rule, and keeping the token out of git bound the damage.
  • A role that quietly gains an index or capability later undoes all of this. Review the role every time you add a new data source.

The host-level work still matters. My Linux server hardening checklist covers the box Splunk runs on, and the agent-specific security section of the AI agent homelab guide covers least privilege and human approval for agents that can act.

Quick Answers

Does Splunk Free support the MCP Server?

I would not expect it to. Free has no users, roles, or login, and the MCP Server relies on token authentication and roles. Splunk does not list the MCP Server by name among the Free restrictions, so I could not confirm it either way.

Can the agent change my Splunk configuration?

Not through splunk_run_query with the setup above. Unsafe commands are blocked by the allowlist and rest is read-only. The agent's user can only do what its role allows, which is why you check the role's capability list in section 05.

How do I see what the agent searched?

Query index=_audit action=search provenance="MCP:*" as an admin. Section 08 has the full search.

What if the token expires?

The client starts failing authentication. Create a new token for the same user and update the client config. Creating the replacement a few days before expiry avoids the gap.

What We Didn't Cover

This gets an agent reading your logs safely. Several things go further and are out of scope here:

  • Write actions, such as restarting a container or blocking an IP, behind a human approval step
  • Pre-filtering and routing logs with Cribl before they reach the license meter
  • Splunk Universal Forwarder rollout across every host in the lab
  • Splunk AI Assistant tools and SPL2 against federated data
  • Running the agent on a local model with Ollama instead of a hosted one

Harden the pipeline around the agent

Once an agent can call tools or read real data, the pipeline has to catch the usual failures before they land. The Secure CI/CD Sprint puts those gates in your CI. If you want the agent itself reviewed (tool access, secrets, prompt injection, MCP permissions), that is a $3,500 engagement on the same page.

See the Secure CI/CD Sprint →

Start With Read-Only

Run the five questions for a week and read your _audit view each day. Once you trust what the agent asks and what it gets back, you will know which write actions, if any, are worth the extra risk.

About the author

Bryan Morrison is a certified Splunk architect with about 12 years in DevSecOps and SIEM. He runs Bmosan Labs.