Akamai Traffic MCP

Akamai Traffic MCP

Exposes the Akamai Reporting API v2 to enable traffic analysis, cache offload measurement, and error rate monitoring via natural language. It provides advanced features for forecasting future traffic trends and exporting multi-sheet Excel reports.

Category
访问服务器

README

Akamai Traffic MCP

An MCP (Model Context Protocol) server that exposes the Akamai Reporting API v2 as tools an LLM can call directly — via Claude Desktop, any MCP-compatible client, or your own agent.

Generate traffic reports by hostname or CP code, analyse HTTP error rates, measure cache offload, and forecast future traffic trends — all through natural language.


Features

Tool What it does
list_accounts Discover all Akamai accounts accessible with your credentials
get_traffic_by_hostname Edge/origin bytes and hits grouped by hostname
get_traffic_by_cpcode Bytes, midgress, and offload % grouped by CP code
get_http_status_breakdown 4xx / 5xx error hit counts at edge and origin
get_edge_origin_offload Cache offload percentage by CP code
get_raw_traffic Flexible query with custom dimensions and metrics
predict_traffic Timeseries forecast (linear regression or EMA)
export_traffic_report Export all four reports to a multi-sheet Excel file

Key behaviours:

  • Default time window: last 15 days (adjustable per call)
  • Multi-account support via accountSwitchKey — call list_accounts() first
  • Forecasting requires no heavy ML dependencies — uses numpy only
  • Credentials never leave your machine; all auth is via Akamai EdgeGrid

Architecture

Claude Desktop / MCP client
        │  MCP (streamable-http)
        ▼
  server.py  (FastMCP)
        │
        ├── akamai_api/client.py    EdgeGrid auth + HTTP session
        ├── akamai_api/reports.py   Request body builders
        ├── forecast.py             Linear regression & EMA forecasting
        ├── export.py               Excel report writer (openpyxl)
        └── config.py               .edgerc + .env config loader

Prerequisites

  • Python 3.11+
  • An Akamai ~/.edgerc file with a [default] section (or the section name of your choice)
  • API credentials with access to:
    • Identity Management API v3 (for account switching)
    • Reporting API v2 (for traffic data)

Quick Start (local)

1. Clone and install

git clone https://github.com/gamittal-ak/traffic_report_mcp.git
cd traffic_report_mcp
python3.11 -m venv .venv
source .venv/bin/activate        # Windows: .venv\Scripts\activate
pip install -r requirements.txt

2. Configure environment

cp .env.example .env

Edit .env:

EDGERC_PATH=/home/you/.edgerc   # path to your .edgerc file
EDGERC_SECTION=default           # section name inside .edgerc
MCP_HOST=0.0.0.0
MCP_PORT=8000
LOG_LEVEL=INFO

3. Start the server

python server.py

The MCP server is now available at http://localhost:8000/mcp.


Connect to Claude Desktop

Edit your Claude Desktop config file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "akamai-traffic": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:8000/mcp",
        "--allow-http"
      ]
    }
  }
}

Restart Claude Desktop. The Akamai traffic tools will appear automatically.


Example conversations

"Show me traffic for all my accounts over the last 7 days"

"Which hostnames had the most edge hits in the past 15 days for account ACME Corp?"

"What were my 5xx error rates last week for CP codes 12345 and 67890?"

"Forecast my edge bytes for the next 7 days using exponential moving average"

"Export a full traffic report to Excel for account XYZ"


Tool reference

list_accounts(search="")

Returns all accounts accessible via your API credentials. search filters by account name (optional). Always call this first to get the accountSwitchKey needed by other tools.

→ [{accountSwitchKey, accountName, accountId}, ...]

get_traffic_by_hostname(...)

Traffic broken down by hostname.

Param Default Description
account_switch_key "" From list_accounts()
start 15 days ago ISO-8601 UTC, e.g. 2025-02-01T00:00:00Z
end now ISO-8601 UTC
cpcode all List of CP code integers to filter
hostname all List of hostname strings to filter

Metrics returned: edgeBytesSum, edgeHitsSum, originBytesSum, originHitsSum, midgressBytesSum


get_traffic_by_cpcode(...)

Traffic grouped by CP code with offload percentage.

Metrics returned: edgeBytesSum, originBytesSum, midgressBytesSum, offloadedBytesPercentage


get_http_status_breakdown(...)

4xx and 5xx error hit counts at edge and origin. Useful for spotting error spikes and diagnosing origin health issues.


get_edge_origin_offload(...)

Cache offload percentage by CP code. Higher offloadedBytesPercentage = more traffic served from Akamai edge = less load on your origin.


get_raw_traffic(dimensions, metrics, ...)

Flexible raw query with custom dimensions and metrics.

Available dimensions: cpcode, hostname, responseCode, responseClass, time5minutes, time1hour, time1day, httpMethod, deliveryType

Available metrics: edgeBytesSum, edgeHitsSum, originBytesSum, originHitsSum, midgressBytesSum, midgressHitsSum, offloadedBytesPercentage, offloadedHitsPercentage


predict_traffic(metric, ...)

Forecast future traffic values from historical data.

Param Default Description
metric required e.g. edgeBytesSum, edgeHitsSum
forecast_periods 7 Number of future data points to predict
granularity time1day time1day, time1hour, or time5minutes
method linear linear (OLS regression) or ema (exponential moving average)

Response includes:

  • trendincreasing, decreasing, or stable
  • summary — historical avg, forecast avg, % change
  • historical — list of {timestamp, value} from the API
  • forecast — list of {timestamp, value} predicted values

export_traffic_report(...)

Fetches all four reports and saves them to a multi-sheet .xlsx file. Only call this when the user explicitly asks to export to Excel.


Deploying on Linode

See deploy/README_deploy.md for the complete step-by-step guide, including VM provisioning, systemd service setup, and firewall configuration.

Quick summary:

# On Linode
git clone https://github.com/gamittal-ak/traffic_report_mcp.git /opt/trafficMCP
cd /opt/trafficMCP
python3.11 -m venv .venv && .venv/bin/pip install -r requirements.txt

# Copy credentials from your local machine
scp ~/.edgerc deploy@<LINODE_IP>:/home/deploy/.edgerc

# Install and start the systemd service
sudo cp deploy/trafficmcp.service /etc/systemd/system/
sudo systemctl enable --now trafficmcp

Claude Desktop config for the remote server:

{
  "mcpServers": {
    "akamai-traffic": {
      "command": "npx",
      "args": ["mcp-remote", "http://<LINODE_IP>:8000/mcp", "--allow-http"]
    }
  }
}

To update after a git push:

cd /opt/trafficMCP && git pull && sudo systemctl restart trafficmcp

Project structure

traffic_report_mcp/
├── server.py                  # FastMCP server + all 8 tool definitions
├── config.py                  # .edgerc + .env config loader
├── forecast.py                # Timeseries forecasting (linear / EMA)
├── export.py                  # Excel report writer
├── requirements.txt
├── .env.example               # Environment variable template
├── akamai_api/
│   ├── __init__.py
│   ├── client.py              # EdgeGrid-authenticated HTTP client
│   └── reports.py             # Request body builders + default time helpers
├── deploy/
│   ├── README_deploy.md       # Full Linode deployment guide
│   └── trafficmcp.service     # systemd unit file
└── tests/
    ├── test_client.py
    ├── test_export.py
    └── test_reports.py

Running tests

pytest tests/ -v

Dependencies

Package Purpose
fastmcp MCP server framework
edgegrid-python Akamai EdgeGrid authentication (akamai.edgegrid)
python-dotenv .env file loading
uvicorn ASGI server
pydantic Data validation
openpyxl Excel export
numpy Timeseries forecasting

Security notes

  • Never commit .edgerc or .env — both are in .gitignore
  • When deploying on Linode, restrict port 8000 to your own IP via ufw
  • Keep the GitHub repo Private if your CP codes or account names are sensitive

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选