Most people I talk to are moving toward OAuth for this, and I'd like to see how we could do that as well, but what follows is what we got working today to keep users from being surprised by an expired MCP token. It's two pieces, a daily alert that emails each user at 30, 14, 7 and 1 days before their MCP token dies, and a Dashboard Studio dashboard so the Splunk admins can see who is coming up to expire, who never used their MCP token, and who has lapsed with no replacement. The end goal is simple, give people runway to request a new MCP token before the old one goes dead. Part 1: The alert The MCP token inventory comes from the REST endpoint /services/authorization/tokens. The search calculates days until expiry per token and filters down to the warning windows. | rest /services/authorization/tokens splunk_server=local | search "claims.aud"="<your_audience_value>" | where match('claims.sub', "^[A-Za-z0-9._%+-]+@yourdomain\.com$") | dedup "claims.sub" | eval days_until_expiry=round(('claims.exp' - now())/86400) | where days_until_expiry=30 OR days_until_expiry=14 OR days_until_expiry=7 OR days_until_expiry=1 | eval expires_on=strftime('claims.exp', "%Y-%m-%d") | eval last_used=if('lastUsed'=0 OR isnull('lastUsed') OR 'lastUsed'="", "Never used", strftime('lastUsed', "%Y-%m-%d %H:%M:%S")) | rename "claims.sub" as user, "claims.aud" as audience | table user, audience, days_until_expiry, expires_on, last_used | sort days_until_expiry, user Save it as a Splunk Alert, not a Report, since Reports don't carry per-result trigger actions the same way. Schedule it daily, set the trigger to "For each result", set the email action to send to $result.user$, and check "Add to Triggered Alerts" so you get a searchable history. Recipients: $result.user$ Subject: Your Splunk MCP token expires in $result.days_until_expiry$ day(s) Message: Your Splunk MCP connector token is set to expire on $result.expires_on$ ($result.days_until_expiry$ day(s) from now). Please file a new token request via the SPLUNK project if you still need access after that date. A few gotchas that cost us debugging time Use = on days_until_expiry, not <=. Otherwise everyone inside the window gets emailed every single day instead of only on their milestone day. The real field names aren't the ones you'd guess. Expiry and issue time are claims.exp and claims.iat as epoch seconds, not something like expiresOnStr, so run | rest /services/authorization/tokens splunk_server=local | head 1 | table * first to see what you're working with. When an alert fires with multiple matching results it sends one email per result, as long as your "to" field uses a per-result token like $result.user$, so same-day expirations don't collide. We've confirmed this works end to end, each user matching on their milestone day gets their own email. Part 2: The admin health dashboard The alert tells users, but I also wanted the Splunk admins to have one place to see the whole picture. The key design choice is that each user is counted once, using their newest token, so someone who already requested a replacement doesn't show up as expired because of an old MCP token still sitting in the list. The base search for every panel: | rest /services/authorization/tokens splunk_server=local | search "claims.aud"="<your_audience_value>" | where match('claims.sub', "^[A-Za-z0-9._%+-]+@yourdomain\.com$") | rename "claims.sub" as user | eval exp=tonumber('claims.exp'), lu=coalesce(tonumber(lastUsed),0) | stats count as tokens_issued max(exp) as exp max(lu) as lu by user | eval days_until_expiry=round((exp-now())/86400) | eval status=case(exp<=now(),"EXPIRED", days_until_expiry<=14,"Expiring soon", true(),"Active") | eval days_since_used=if(lu=0,null(),round((now()-lu)/86400)) | eval used_bucket=case(lu=0,"Never used", days_since_used<=7,"Last 7 days", days_since_used<=30,"8-30 days", true(),"30+ days") | eval expires_on=strftime(exp,"%Y-%m-%d"), last_used=if(lu=0,"Never used",strftime(lu,"%Y-%m-%d %H:%M:%S")) | fields user status days_until_expiry expires_on last_used days_since_used used_bucket tokens_issued Taking max(exp) and max(lu) by user is what gives you the newest MCP token per person. Every panel is a chained search off that one base search, so the dashboard only hits the REST endpoint once. The panels: All Created User MCP Tokens, a single value of distinct users who have an MCP token, expired ones included. Active users, a single value of users whose MCP token isn't expired and has actually been used. Expired with no active MCP token, a single value count of users whose newest MCP token is expired. Expired, no replacement MCP token, a table of who they are, hidden when there's nothing to show. All users (filtered), a table of user, status, days until expiry, expiry date and last used, sorted by soonest to expire, with dropdown filters for User, Status (Active, Expiring soon, EXPIRED) and Last used (Never used, Last 7 days, 8-30 days, 30+ days). I feel like the "Never used" and "30+ days" buckets end up being the most useful part, because they show you MCP tokens that were issued and never needed, which is a good conversation to have before you renew anything. The full dashboard JSON is attached below as a txt file, swap in your own audience value and email domain before importing. I hope this is useful to others!
... View more