mpulse-mcp
MCP server wrapping the Akamai mPulse Query API v2 to fetch RUM aggregate data (summaries, histograms, per-minute time series) with loss-free numbers for downstream statistical analysis.
README
mpulse-mcp
An MCP (Model Context Protocol) server that wraps the Akamai mPulse Query API v2 and exposes it as tools for Claude Desktop (local stdio). It fetches mPulse RUM (Real User Monitoring) aggregate data — summaries, histograms, and per-minute time series — and returns loss-free numbers suitable for downstream p75 / statistical analysis.
- Accuracy first — endpoints, parameters, and schemas were confirmed against the live mPulse docs before implementation (see Verified API contract).
- Loss-free data — numeric values are never rounded, summarized, or dropped.
- stdio-safe — nothing is ever written to stdout (that would corrupt the JSON-RPC stream); all logs go to stderr. Secrets are masked in logs.
Verified API contract
Fetched from techdocs.akamai.com/mpulse during implementation. The table below
records what was confirmed and any differences from the original brief's
assumed defaults.
| Item | Confirmed value |
|---|---|
| Query base host | https://mpulse.soasta.com ✅ matches |
| Query URL format | /concerto/mpulse/api/v2/<api-key>/<query-type>?<params> ✅ matches |
| Auth header | Authentication: <token> (not Authorization) ✅ matches |
| Common param | format=json (the default legacy format is deprecated) ✅ |
| Token endpoint | PUT /concerto/services/rest/RepositoryService/v1/Tokens |
| Token request body | { "apiToken": "<pre-issued>", "tenant": "<tenant>" } (API-token/SSO flow; no username/password) |
| Token response | { "token": "<security token>" } |
| Token lifetime | expires after 5 hours of inactivity |
| Data characteristics | per-minute aggregation, one calendar day per query, timezone-dependent |
Confirmed query-type slugs → explicit tools
| Tool | query-type slug | Response core |
|---|---|---|
get_summary |
summary |
median, moe, n, p95, p98 |
get_histogram |
histogram |
series.series[].buckets/aPoints, median, p95, p98 |
get_timers |
by-minute |
series.series[].aPoints[{x,y}], statistics (single timer) |
get_metrics |
timers-metrics |
dataTimeZone, values[{id, history[], latest}] (multiple) |
Other confirmed slugs (reachable via the generic query tool):
dimension-values, dimension-over-time, metrics-by-dimension,
metric-per-page-load-time, sessions-per-page-load-time, app-error-summary,
page-groups, browsers, ab-tests, bandwidth, geography.
Confirmed parameters: timer (default PageLoad) / custom-timer,
metric (default Beacons), percentile (1–99, default 50), date
(YYYY-MM-DD), date-comparator (Last30Minutes, LastHour, Last24Hours,
ThisWeek, Last + trailing-seconds, Between + date-start/date-end),
timezone (Java TZ id, default UTC).
Confirmed drilldown params: page-group, browser, browser-family,
ab-test, country (ISO alpha-2), region, device-type, device-model,
device-manufacturer, os, os-family, connection-type, isp,
bandwidth-block, beacon-type, site-version, custom-dimension-{label}.
Unsupported drilldown combinations return empty data, not an error — the
server flags this in the result note.
Differences from the brief's assumed defaults
date_comparator→ wire namedate-comparator(hyphen). Tool arguments use underscores and are mapped to the hyphenated wire names automatically.- Token lifetime is "5 hours of inactivity", not a very-short token. The
server still refreshes proactively (soft 4h TTL) and reactively on a query
401, so correctness does not depend on the exact figure. - Rate-limit numbers (concurrent 3 / 100 per-min / 10k per-hour / 50k
per-day) could not be re-confirmed from the doc pages fetched. They are
adopted from the brief and kept configurable as constants in
client.py(MAX_CONCURRENCY,PER_MINUTE_LIMIT, retry settings). The per-hour/per-day caps are advisory (not separately throttled).
Install
Requires Python 3.11+ and uv.
uv sync --extra dev
Configure
Secrets go in the environment; the non-secret app registry goes in a JSON file.
-
Registry — copy the example and fill in your api keys / tenant:
cp mpulse_apps.example.json mpulse_apps.json{ "default_app": "app-a", "tenant": "your-tenant", "api_token_env": "MPULSE_API_TOKEN", "apps": { "app-a": { "api_key": "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" }, "app-b": { "api_key": "YYYYY-YYYYY-YYYYY-YYYYY-YYYYY", "tenant": "override-if-different", "api_token_env": "MPULSE_API_TOKEN_APP_B" } } }Resolution: an app's
tenant/api_token_envoverride the top-level defaults;api_keyis required per app. The registry path is found viaMPULSE_APPS_CONFIG, else./mpulse_apps.json. -
Secrets — set the pre-issued mPulse API token(s) (mPulse → your name → Account → Generate/Revoke API Token). See
.env.example:MPULSE_API_TOKEN=your-pre-issued-api-token # MPULSE_API_TOKEN_APP_B=... # only if an app overrides api_token_envThe short-lived security token used on each request is minted at runtime from the API token + tenant — you never manage it yourself.
Where does
.envgo? For local runs and the smoke test, place.envin the project root (the folder withpyproject.toml, i.e. the working directory). It is auto-loaded at startup — also from the directory ofMPULSE_APPS_CONFIG. Existing environment variables are never overridden. For Claude Desktop, do not use.env— put secrets in theenvblock ofclaude_desktop_config.json(below); that is what Claude Desktop injects, and it takes precedence over any.env.
Run
uv run mpulse-mcp # or: uv run python -m mpulse_mcp
Transport is stdio; the process speaks MCP on stdout and logs to stderr.
Register in Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"mpulse": {
"command": "uv",
"args": ["--directory", "/Users/hyoon/Projects/mpulse-mcp", "run", "mpulse-mcp"],
"env": {
"MPULSE_API_TOKEN": "your-pre-issued-api-token",
"MPULSE_APPS_CONFIG": "/Users/hyoon/Projects/mpulse-mcp/mpulse_apps.json"
}
}
}
}
Restart Claude Desktop; the mPulse tools appear in the tools menu.
Tools
Explicit (typed, validated): get_summary, get_histogram, get_timers
(single timer, per-minute), get_metrics (multiple timers/metrics, per-minute).
Each accepts app (optional → default app), exactly one of date
(YYYY-MM-DD) or date_comparator, optional timezone, drilldown filters
(page_group, browser, ab_test, country, device_type, …), and
raw (default false).
Generic: query(query_type, app=None, params={...}, raw=False) — any
query-type with wire-name params, for cases the explicit tools don't cover.
Meta (anti-hallucination): list_apps, list_query_types,
describe_query(query_type).
Output format
raw=false(default): a flat envelope —app,query_type,period,timezone,aggregation,drilldowns,empty, andbody(the envelope-stripped, loss-free data). Empty results are flagged, with a note when an unsupported drilldown combination is the likely cause.raw=true: mPulse's untouched JSON underdata.
Constraints surfaced to the model
One calendar day per query (ranges are rejected with guidance to split into per-day calls — the server does not fan out implicitly); per-minute aggregation; timezone-dependent; unsupported drilldown combinations return empty data.
Errors
401 → one automatic token re-issue + replay, then an auth error. 403 →
mPulse Lite / permission guidance (the Query API is not available on Lite).
429 → exponential backoff + jitter (up to 5 retries), then a rate-limit error.
Network/timeout/5xx → retried, then a friendly upstream error. Invalid
app/query-type/params → validation errors with hints. No error message ever
contains a secret.
Tests
uv run pytest # unit tests (respx-mocked; no network)
Covers: token mint/cache/expiry/refresh + single-flight, Authentication
header, 401 replay, 429 backoff, 403→Lite mapping, loss-free normalization,
date/date_comparator mutual exclusivity, and multi-app / default fallback.
Manual smoke test against the real API:
export MPULSE_API_TOKEN=... # or rely on your .env / shell env
export MPULSE_APPS_CONFIG=/Users/hyoon/Projects/mpulse-mcp/mpulse_apps.json
uv run python tests/smoke.py # default app, yesterday
uv run python tests/smoke.py app-b 2026-08-01
Project layout
src/mpulse_mcp/
server.py FastMCP instance + tool registration (entry point)
config.py app registry + credential loading
auth.py token mint/cache/refresh (single-flight)
client.py HTTP client + rate limiting + retries
query_types.py query-type / parameter metadata
formatting.py loss-free normalization + raw passthrough
errors.py typed exceptions + status mapping
tests/ unit tests + smoke.py
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。