
OilpriceAPI
io.github.OilpriceAPI由 GitHub 账号 OilpriceAPI 发布v3.6.0更新于 Oct 24, 2026
Source-timestamped energy data and reviewed OilPriceAPI product facts for MCP clients.
概览
本地 MCP 服务器,让助手获取带来源时间戳的石油、天然气、LNG、碳和燃料价格、期货、船用燃料及能源市场数据
- 可以做什么
- 查询单一商品的当前现货价格,对比 2-5 种商品及价差,列出商品目录并获取按类别分组的市场概览,可直接使用 brent oil、natural gas 等自然名称而非代码;无密钥时可用有限商品的演示模式,另有经审核的产品事实工具和资源,说明报价、时效、认证、权益和数据权利。获取历史价格与按日期区间的小时到月度数据、近月期货、含升贴水分析的完整远期曲线,以及按合约月份的期货 OHLC 历史。查询按港口和燃料类型划分的船用燃料价格、加油港口目录和船用燃料历史,以及美国各州零售柴油价格和零担与包裹承运商燃油附加费。
- 适用场景
- 当助手需要能源市场背景时使用:原油、天然气、LNG、碳、柴油、航空燃油或船用燃料价格,价差与裂解价差分析,期货曲线,钻机数量,OPEC 产量,库存水平,EIA 库存与预测,或钻井许可与产量数据。适用于市场简报、车队与燃油附加费计算、航次成本、海事合规和宏观研究。无密钥演示足以在注册前评估数据是否合适。
- 运行要求
- 通过 stdio 在本地运行,通常用 npx 从 npm 包 oilpriceapi-mcp 启动,因此需要 Node.js;也提供容器构建方式。OilPriceAPI 账户和 OILPRICEAPI_KEY 中的 API 密钥是可选的:不提供时服务器运行有限的免密钥演示。可选设置包括 OILPRICEAPI_BASE_URL、OILPRICEAPI_MCP_SCOPE(默认 read)、OILPRICEAPI_MCP_PROFILE 和 OILPRICEAPI_MCP_CATEGORIES。需要访问 api.oilpriceapi.com 的网络连接。
安装
在 SourceWeft 中
- 打开 控制台中的 OilpriceAPI,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
OilPriceAPI MCP Server
Give compatible AI clients source-timestamped oil, gas, LNG, carbon, fuel, and related energy data through MCP. No API key is needed to try the limited demo.
Get a Free API Key · Documentation · API Explorer · Pricing
Backed by OilPriceAPI, a normalized REST API for energy dashboards, fleet and logistics tools, maritime workflows, and market research.
Canonical sources: Public product facts · Official MCP Registry record
Features
- Reviewed product facts — a keyless read-only tool and stable resource for offer, freshness, authentication, catalog, entitlement, and data-rights questions
- Data and workflow tools — latest values, history, futures, marine fuels, fuel surcharges, energy intelligence, alerts, market briefs, and persistent watches
- Resources — the reviewed product contract plus subscribable price snapshots
- Prompts — analyst templates for briefings, spread analysis, gas markets, diesel costs, and supply analysis
- Natural language — ask for "brent oil" or "natural gas", not codes
- Broad catalog — oil, gas, coal, refined products, metals, forex, bunker fuels, state diesel, and selected energy-intelligence datasets; access varies by plan and account
- Smart errors — unrecognized commodities get suggestions, not silent fallbacks
Quick Start
The default scope is read-only. Account mutations are not listed and direct mutation calls are rejected unless write scope is explicitly enabled:
Inspect the package without opening an MCP stdio session:
--config generates client-native, copy/paste-valid JSON for
claude-desktop, claude-code, cursor, vscode, cline, or windsurf.
It never reads or prints the configured API key. Claude Code, VS Code, and
Windsurf outputs use their supported environment or secure-input references;
Claude Desktop, Cursor, and Cline use an explicit local replacement marker.
Add --demo to omit API-key configuration entirely. Scope, profile, and
category options are preserved in the generated server arguments.
What can your agent get?
Example commodity codes:
Installation
Try it without an API key
The server works out of the box in keyless demo mode — just omit OILPRICEAPI_KEY from the configs below. The price tools (opa_get_price, opa_compare_prices, opa_list_commodities, opa_market_overview) serve latest available values for a limited demo commodity set, and every other data tool explains its account requirements. Demo responses are marked with a footer. For the broader account-enabled catalog, history, futures, and alerts, get a free API key and add it to your config.
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
Claude Code
Add to your project's .mcp.json:
Cursor
Add to .cursor/mcp.json in your project root:
VS Code + Cline
Add to .vscode/mcp.json:
Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
Global Install
Build the Container
Container builds require the source revision and commit timestamp so the image, capability manifest, and build metadata are traceable to the same checkout:
The runtime image uses the unprivileged node user. Omit OILPRICEAPI_KEY for
the limited keyless demo, or inject it with your container platform's secret
manager. Do not bake credentials into the image.
Transport
This server runs locally over stdio only. Its MCP Registry record lists the npm package and no remote endpoint.
The hosted connector at https://mcp.oilpriceapi.com/mcp is not this server.
It is a separate, smaller set of energy_* tools with OAuth account linking,
used by hosted clients that cannot launch a local process. Use this package for
the full opa_* tool set.
Environment Variables
Tool Scope and Profiles
read scope includes all non-mutating tools, including alert history,
subscription listing, and subscription event polling. The four create/delete
tools require --scope write or OILPRICEAPI_MCP_SCOPE=write. Unknown scope,
profile, or category values fail closed before stdio starts.
Profiles reduce tool overload without replacing first-class MCP actions:
For example, a read-only price and product-facts server can use:
Doctor and Capability Contract
doctor checks the Node runtime, package entry point, API reachability, key
validity, current plan, and reported feature gates. doctor --demo performs a
bounded keyless request. Failures distinguish missing configuration, 401, 402,
403, 429, timeout, DNS/TLS, and upstream 5xx responses. The API key is never
printed.
Every package includes build/capabilities.json. It is generated from the same
SDK registry used by tools/list and records the package/version/source commit,
minimum Node version, scopes, profiles, exact inventories, per-tool annotations,
key/entitlement requirements, resources, commands, and support URLs. Website and
docs consumers should pin a package version, validate schemaVersion and
sourceCommit, and update the artifact only through an explicit dependency
upgrade. They should not scrape CLI prose or hard-code tool counts.
API-to-MCP capability ledger
capability-ledger.json records an explicit decision for every operation in
the published OilPriceAPI contract (https://api.oilpriceapi.com/openapi.json).
Each operation is either exposed, naming the registered tool(s), or
not_exposed with a disposition (selected, deferred, alias,
unsupported, internal) and a one-line reason. Families group operations into
workflows, including preview API families the server calls that are not in the
canonical contract yet.
npm run build && npm run check:capability-ledger compares the ledger with the
live contract, build/capabilities.json and the REST paths src/index.ts
calls. It exits 1 on drift, such as a new API operation with no decision, a
removed one, or an unrecorded tool or path. It exits 2 when it cannot check: the
contract is unreachable, the build manifest is missing, or the route-policy
snapshot is older than its stated threshold. CI runs it on every pull request
and daily. When a decision changes, bump ledgerVersion, append to changes,
and link that change from the release notes.
Tools
All tools are prefixed with opa_ to avoid name collisions when multiple MCP servers are loaded.
Price Alert Tools (authenticated)
These tools create and manage persistent price alerts tied to your OilPriceAPI account, so they require an API key (OILPRICEAPI_KEY). The alert engine evaluates eligible source updates and notifies you (by email, plus webhook if you provide one) when a condition is met.
Market Brief & Subscription Tools (authenticated)
The market brief gives a multi-commodity snapshot in one call. Subscriptions ("watches") are persistent, recurring snapshots tied to your account — the API records an event every interval, and the agent polls for new events via a per-user cursor (events are polled, not pushed — there is no always-on connection). These require an API key (OILPRICEAPI_KEY). A subscription differs from an alert: a watch always emits an event each interval (a running log), whereas an alert fires only on a threshold crossing. Per-account code, watch, and cadence limits apply; the API response is authoritative and returns the current limit when exceeded.
Example Questions
Resources
Subscribable price data (JSON):
Product Facts and Model Knowledge
opa_get_product_facts and oilpriceapi://product-facts improve accuracy for a connected MCP session. They do not retrain a model or update its general knowledge. The server prefers the canonical keyless contract, uses a bounded cache, and labels any checksum-verified package fallback with source and warning metadata.
Prompts
Pre-built analyst templates:
Natural Language Support
Development
Breaking Changes in v3.0.0
- The default tool scope is now read-only. Create/delete alert and subscription
tools require explicit
--scope writeorOILPRICEAPI_MCP_SCOPE=write. - Invalid scope/profile/category configuration now fails before MCP stdio starts.
- Use
--list-tools --jsonor--capabilities --jsoninstead of relying on a hard-coded inventory.
Breaking Changes in v2.0.0
- All tool names now use
opa_prefix (e.g.,get_commodity_price->opa_get_price) - Unrecognized commodity names now return an error with suggestions instead of silently defaulting to Brent
list_commoditiesnow fetches live from the API (falls back to static list if unavailable)
The whole OilPriceAPI toolbox
Same data, every stack:
Explore the API
- 🧭 Interactive explorer: api.oilpriceapi.com/swagger — try every endpoint in the browser (demo mode, no key needed)
- 📜 OpenAPI spec: swagger.json
Privacy Policy
This MCP server runs locally on your machine and only communicates with the OilPriceAPI service:
- What is sent: tool requests are translated into HTTPS calls to
api.oilpriceapi.com(commodity codes, query parameters such as time period or state, carrier slugs and service-level inputs for fuel surcharges, and — for alert/subscription tools — the alert parameters you specify), authenticated with your API key. No conversation content is transmitted — only the structured tool inputs above. - API key storage: your key is stored locally in your MCP client's configuration (or the
OILPRICEAPI_KEYenvironment variable). It is sent only toapi.oilpriceapi.comas an Authorization header. - Logging and demand telemetry: each tool emits a local structured hit/miss event to stderr and attributes its API request with the tool name plus a deliberately lossy argument shape. Commodity codes, intervals, state codes, and bounded numeric controls may be retained; free text, prompts, names, IDs, API well numbers, coordinates, and thresholds are reduced to
provided. API request logging follows the OilPriceAPI Privacy Policy. - Third parties: no data is shared with third parties beyond what that policy describes.
- Demo mode: without an API key, price tools call the keyless demo endpoint on the same host; no key or account data is involved.
Questions: [email protected]
Pricing Boundary (HTTP 402)
Where the free/paid line sits for this server (#10):
- Always open: the MCP server itself (MIT), setup, docs, discovery (tool listing), and keyless demo mode for low-volume evaluation.
- API key: use the public product facts and your account response for the current trial, allowance, reset window, and dataset entitlement. Keyless demo mode remains available for a limited dataset.
- Behind the paywall: high-volume usage and premium datasets (futures, energy intelligence, well permits/production, alerts at scale). When a request crosses that boundary the API returns a standard HTTP 402/403/429 with the exact limit or feature gate in the body, and this server surfaces that message plus an upgrade link — agents get a machine-readable stop, never a silent failure.
- x402 protocol: per-request crypto micropayments via the x402 protocol are not currently supported — payment is by account plan (Stripe), authenticated with your API key.
License
MIT
Links
Also Available As
- Python SDK - Python client with Pandas integration
- Node.js SDK - TypeScript/JavaScript SDK
- Go SDK - Idiomatic Go client
- OpenBB Integration - OpenBB Platform provider
来源:README.md,提交 8a6c36a
工具
0版本历史
4- v3.6.0最新Oct 18, 2026
- v3.5.0Oct 16, 2026
- v3.4.2Oct 3, 2026
- v3.4.1Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分