If you are adding MacroFeed to Cursor, Claude Code, OpenClaw, or another MCP client, start with Connect in 60 seconds. This page is for applications that call the Context SDK from their own server code.
Prerequisites
- Sign in to Context to create the embedded wallet.
- Set the USDC spending cap and fund the wallet. The official MCP prerequisites describe the current setup order.
- Open Context Settings and create an API key beginning with
sk_live_. - Install the TypeScript or Python SDK in your server-side application.
TypeScript
Python
CONTEXT_API_KEY; the variable name itself is your choice.
Choose a mode
Discovery is free. MacroFeed’s current Query listing price is
$0.00, but a Query can still incur Context model/orchestration cost. Always inspect the returned cost object. Execute sessions provide the clearest hard spend envelope for deterministic integrations.
Execute a tool
This example discovers MacroFeed, opens a session capped at$0.01, fetches the next USD CPI release, and closes the session so accrued calls can settle.
get_next_release currently costs $0.0004 per Execute call. The response contains MacroFeed’s structured event object in response.result, plus method-price and session-spend metadata.
Run a managed Query
Use Query when the caller has a question rather than a predetermined tool call. Context can discover, select, call, and combine MacroFeed methods before returning an answer with evidence.tools constrains the managed run to this product. includeDeveloperTrace is useful during development for inspecting tool-call counts, retries, and fallback behavior.
Use Python
The Python SDK exposes the same Query product surface. This example pins every run to MacroFeed.Build a recurring MacroFeed routine
For a daily brief, alert, or scheduled research job, keep the MacroFeed listing ID pinned so every run uses the same product surface. When your own agent will write the report, request evidence rather than a second synthesized answer.evidence_only, and full-data references.
Production guidance
- Prefer Execute when your application already knows the MacroFeed method and arguments.
- Use a fresh, appropriately sized Execute session for each bounded workflow and close it in
finally. - Prefer Query for user-facing natural-language answers where synthesis is worth the additional model cost.
- Log
method.executePriceUsd,session.spent, and Querycostmetadata for billing visibility. - Keep indicator keys stable in application code. Call
list_indicatorswhen users need discovery or taxonomy lookup. - Treat
nullactual, previous, or change values as explicit data availability states, not zero. - Forecast and surprise fields are reserved for compatibility; primary indicator response objects focus on official timing, actuals, previous values, and derived changes.
- For long Query jobs, follow the current polling guidance in the official CTX MCP documentation rather than starting the same paid query twice.