Give AI coding agents full context of the Aftermath API using minimal tokens.
Aftermath MCP is a Model Context Protocol server that indexes the full Aftermath Finance OpenAPI spec (142 endpoints across 7 categories) and exposes it to AI assistants through three lightweight tools. Instead of stuffing an entire API spec into your context window, your assistant can search and retrieve only the endpoints it needs — keeping token usage low and responses accurate.
Works with any MCP-compatible client: Claude Code, Cursor, VS Code, Windsurf, Codex, and more.
Installation
No API key required — the server is hosted and ready to use. Pick your client below.
Add the following to .cursor/mcp.json in your project root (create the file if it doesn't exist):
Restart Cursor after saving. The MCP tools will appear in the agent's available tools.
VS Code / Copilot
Add the following to .vscode/mcp.json in your project root (create the file if it doesn't exist):
Restart VS Code after saving. The tools will be available to Copilot in agent mode.
Windsurf
Add the following to your Windsurf MCP config (~/.windsurf/mcp.json):
Restart Windsurf after saving.
How It Works
Traditional approach: paste an entire OpenAPI spec into your prompt and burn thousands of tokens on endpoints you never use.
Aftermath MCP takes a different approach:
The server pre-indexes the full Aftermath API spec at startup
Your AI assistant discovers available categories with list_tags
It searches for relevant endpoints with search_endpoints
It fetches full details (params, schemas, descriptions) only for the endpoints it actually needs with get_endpoint_details
The result: your assistant gets complete, accurate API context while using a fraction of the tokens.
Tools
Tool
Description
list_tags
List all API categories with endpoint counts
search_endpoints
Search by keyword, tag, HTTP method, or path pattern
get_endpoint_details
Get full parameters, request/response schemas for a specific endpoint
Examples
Once installed, you can ask your AI assistant to work with the Aftermath API naturally. The agent will use the MCP tools behind the scenes to discover the right endpoints, understand their schemas, and write correct code.
Build a TypeScript function that fetches 1h candles for BTC-PERP:
The agent will search for candle/OHLCV endpoints, inspect the request body schema and response format, and produce a working function with the correct URL, method, and parameters.
Generate a Python script to monitor perpetuals account health:
The agent will discover the accounts and positions endpoints, understand the response schemas including margin and PnL fields, and generate a complete script with proper error handling.
Write a TypeScript function using fetch that pulls the last 24 hours of 1-hour
OHLCV candles for the BTC-PERP market from the Aftermath API. Return the data
as an array of { open, high, low, close, volume, timestamp } objects.
Write a Python script that takes an account ID as a CLI argument, fetches its
open perpetuals positions from the Aftermath API, and prints a table showing
each position's market, side, size, entry price, mark price, margin, and
unrealized PnL. Warn if any position's margin ratio is below 5%.