blacksmith-usage-mcp
A local MCP server that exposes Blacksmith.sh's usage and cost data, enabling queries for CI spend through agents, alerts, or dashboards.
README
blacksmith-usage-mcp
A local MCP server that exposes Blacksmith.sh's usage & cost data, which Blacksmith does not officially publish as an API. It lets you pull CI spend into agents, alerts, dashboards, or scheduled reports instead of eyeballing the web UI.
Unofficial / unaffiliated. It replays your own authenticated dashboard session against Blacksmith's private backend. Endpoints may change without notice.
What it gives you
Read-only tools over the metrics the dashboard itself uses:
| Tool | Returns |
|---|---|
blacksmith_whoami |
session identity (auth check) |
blacksmith_list_orgs |
your GitHub orgs/installations |
blacksmith_cost_summary |
jobs, minutes, $ cost for a month |
blacksmith_cost_daily |
per-day jobs / minutes / cost |
blacksmith_cost_by_repo |
cost per repository |
blacksmith_cost_by_runner |
cost per runner type |
blacksmith_sticky_disk_cost |
Docker-cache storage $ + GB-hours (often the biggest line item) |
blacksmith_sticky_disk_daily |
daily cache footprint (GB held) — the growth curve; spots an unbounded cache |
blacksmith_monthly_usage |
billable vs included-free minutes |
blacksmith_current_vcpu |
live vCPU/jobs right now |
blacksmith_vcpu_timeseries |
usage over time |
blacksmith_cost_overview |
one-shot month report (totals + free-tier headroom + top repos/runners) |
blacksmith_cost_trend |
month-over-month compute vs sticky-disk cost (last N months) |
Every tool takes an optional month ("YYYY-MM", default current) and org
(defaults to $BLACKSMITH_ORG).
Example
Ask your agent "what's my Blacksmith spend this month?" and
blacksmith_cost_overview returns:
{
"org": "your-org",
"month": "2026-06",
"compute_cost_usd": 2.13,
"sticky_disk_cost_usd": 15.47,
"total_cost_usd": 17.6,
"total_jobs": 141,
"billable_minutes": 1064,
"free_minutes": 3000,
"free_tier_remaining_minutes": 1936,
"cost_by_repo": [{ "repo_name": "your-org/app", "cost": 2.13, "runtime_minutes": 267 }],
"cost_by_runner": [{ "runner_type": "blacksmith-4vcpu-ubuntu-2404", "cost": 2.12, "runtime_minutes": 265 }]
}
Note how sticky-disk (Docker cache) storage can dwarf compute — it's frequently the largest single line item, and the one most worth alerting on.
How auth works
Blacksmith's dashboard (app.blacksmith.sh) talks to a Laravel backend at
dashboardbackend.blacksmith.sh/api. There is no public API key or bearer
token — auth is a stateful session cookie (blacksmith_session, httponly,
~14-day rolling). GitHub OAuth only bootstraps that cookie, and the
code → session exchange uses Blacksmith's server-side client secret, so the
OAuth flow can't be replayed headlessly.
So the model is: sign in once via GitHub, harvest the cookie, replay it. Two non-obvious details this server handles for you:
- The backend is Laravel Sanctum (stateful), so every request sends
Origin: https://app.blacksmith.sh. Without that header the cookie is rejected with a 401. - The server rotates the session cookie on every response; the client persists
the fresh value back to storage, so the session stays alive as long as it's
used within ~14 days. The durable
remember_web_*cookie is harvested too.
Setup
git clone https://github.com/dholliday3/blacksmith-usage-mcp.git
cd blacksmith-usage-mcp
pnpm install # or: npm install
pnpm exec playwright install chromium # one-time, for the login helper
pnpm login # opens a browser; sign in with GitHub
pnpm check # prints a cost overview — confirms it works
pnpm login uses a persistent browser profile under .auth/ (gitignored) so
your GitHub session sticks around and future refreshes usually skip 2FA. Re-run
pnpm login whenever a tool returns a "session expired" error (~every 14 days
if unused).
Set your org once so you can omit it from every call:
export BLACKSMITH_ORG=your-github-org-slug # find it via `blacksmith_list_orgs`
Register with an MCP client
Claude Code:
claude mcp add blacksmith-usage -s user -- pnpm --dir /abs/path/to/blacksmith-usage-mcp start
Generic mcp.json:
{
"mcpServers": {
"blacksmith-usage": {
"command": "pnpm",
"args": ["--dir", "/abs/path/to/blacksmith-usage-mcp", "start"],
"env": { "BLACKSMITH_ORG": "your-github-org-slug" }
}
}
}
Where the session is stored
In priority order:
$BLACKSMITH_SESSION_JSON— full session JSON inline. Handy for CI / headless, where you inject a cookie harvested elsewhere.- macOS Keychain (
security, serviceblacksmith-session-cookie) — default on macOS. - A
0600file at$BLACKSMITH_SESSION_FILE, or${XDG_CONFIG_HOME:-~/.config}/blacksmith-usage-mcp/session.json— default on Linux/Windows, or whenever$BLACKSMITH_SESSION_FILEis set.
The cookie is a live credential to your Blacksmith account and is never
written into the repo. .gitignore blocks .auth/ and any stray
.session.json.
Notes
- Read-only by design — no tool mutates Blacksmith state. (Writes would require
sending the
X-XSRF-TOKENheader, which this client deliberately never does.) - Schemas use
.passthrough(), so if Blacksmith adds fields they surface rather than break parsing. - Requires Node ≥ 20 (uses
fetch+Headers.getSetCookie).
Cost model
docs/blacksmith-cost-model.md explains how Blacksmith bills (compute vs. the two caches), how to run jobs with $0 caching cost, and the unbounded-Docker-cache footgun that makes bills balloon — with citations to Blacksmith's docs and a recording date (pricing can change).
Blacksmith's own LLM docs
Handy to feed an agent alongside this server (product docs, not the usage API):
- Index: https://docs.blacksmith.sh/llms.txt
- Full text: https://docs.blacksmith.sh/llms-full.txt
License
MIT — see LICENSE.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。