Elfa MCP
Model Context Protocol server for the Elfa API — API v3 events, positions and rankings across crypto and equities, Auto, a condition engine that watches the market and fires an action when your conditions are met, plus crypto social intelligence from X and Telegram.
Works with any MCP client, either signed in to the hosted server or running locally with an API key.
Install
Hosted, sign in with Elfa
Add https://mcp.elfa.ai/mcp as a remote MCP server in your client and approve it in your browser with your dev.elfa.ai account. No key to copy, nothing to install. If your client cannot sign in, run the server locally instead. Setup steps are in the MCP guide.
Local, API key
Get an API key at dev.elfa.ai. No install step — npx fetches the server on demand.
One click
[Add to Cursor]
[Add to VS Code]
Claude Desktop
Download elfa-mcp-<version>.mcpb from the latest release and open it. Claude Desktop installs it, prompts for your API key, and keeps it updated. Nothing else to configure.
Claude Code
Cursor, VS Code, Claude Desktop, and other clients
VS Code uses "servers" instead of "mcpServers". Everything else is the same.
Ask "what's trending in crypto right now?" to confirm it works.
Configuration
Upstream requests identify themselves as User-Agent: elfa-mcp/<version> (<transport>; client=<app>). On stdio, <app> is the MCP client's name and version from the handshake; over HTTP, it is the connecting client's own User-Agent header. Set User-Agent in ELFA_EXTRA_HEADERS to send your own instead.
The timeout is high and retries are off on purpose. The interpretation endpoints are LLM-backed and can take over a minute, and they cost credits per attempt, so a silent retry would bill you again for a call you never saw. Raise ELFA_RETRIES only if you are calling the cheap measurement endpoints.
Some MCP clients apply their own timeout, often around 60 seconds. narratives and market_chat can exceed that; the request still completes and is still charged, even if the client gives up first.
Tools
16 tools, mapped to every documented /v2 and /v3 operation.
Not exposed as tools:
chat-stream-v2 — A tool call returns one result, so streaming adds nothing. market_chat covers the same analysis.
auto-stream-queries-v2 — Long lived streams have no tool equivalent. Poll with auto_query.
auto-stream-query-v2 — Long lived streams have no tool equivalent. Poll with auto_query.
getAccountSmartStats-v2 — Deprecated and not maintained, so no tool wraps it. To rank accounts, use top_accounts; mentions with mode=search returns per-post engagement metrics with the posting account.
Some tools depend on the plan: today market_chat, which needs a higher-tier plan than the free one, and the API v3 tools on a key whose scopes leave them out. At startup (stdio) or per request (HTTP, cached for a minute per key), the server reads the key's scopes from /v2/key-status. A tool the plan doesn't include stays listed, but its description says it needs a higher-tier plan, and calling it returns the upgrade link without calling the API or spending credits. If the scopes can't be read within 3 seconds, every tool is listed as usual and the API decides.
Streaming endpoints stay available through the SDKs for applications that can consume SSE.
API v3
entities, events, market, calls and top_accounts read API v3: events, storylines and arcs; call books, mindshare and trending contracts; calls, call episodes and positioning; ranked accounts. They cover crypto and equities and are open to every plan. Each call costs credits, priced per endpoint on the pricing page.
- Filters take entity ids, not tickers. Resolve an asset with
entities first and reuse the id.
- Times are unix seconds. Milliseconds are refused.
- How far back a key reads depends on its plan.
api_status returns it as historyFrom.
Where this differs from the raw API
The tools deliberately do not inherit every API default, because an agent pays for verbosity in context.
Every value is still settable per call: pageSize accepts up to 100, and limit up to the endpoint's maximum.
Auto
Auto queries run unattended. Once armed, a query keeps evaluating and fires its action without asking again.
The flow is three steps:
auto_build — describe what to watch in plain language, get EQL back
auto_validate — check the syntax and get the credit cost
auto_query_write — activate it
Actions can notify you, call a webhook, message a Telegram bot, or run an LLM analysis.
There is no push channel over MCP. Poll auto_query with method=get, and wait for the returned pollAfterSeconds between calls.
Remote server
The same server runs over Streamable HTTP for hosted deployments:
It is stateless — no sessions, one server instance per request, safe behind a load balancer. Credentials come from the x-elfa-api-key request header, falling back to the environment, or from an OAuth sign-in (see below).
DNS rebinding protection is on by default. The server accepts only the loopback names it binds — localhost:PORT and 127.0.0.1:PORT — which covers the local run above and nothing else. Any deployment that answers on a different Host must list the values it serves:
That includes a public domain, a reverse proxy, and a container that maps the port to a different one than the server binds. A Host the list does not cover is rejected with 403.
Set ELFA_MCP_ALLOWED_ORIGINS as well when browsers call the server directly. It complements the host allowlist rather than replacing it: a rebound request is same origin, so it carries no Origin header for that list to check, and the Host header is the only one still naming the attacker's domain.
OAuth sign-in
A hosted server can let clients sign in through a browser instead of sending an API key. Set ELFA_MCP_AUTH=oauth and the server becomes an OAuth resource server under the MCP authorization spec:
- A request with no credential gets
401 and a WWW-Authenticate challenge.
- The challenge points the client to the protected-resource metadata at
/.well-known/oauth-protected-resource/mcp.
- That metadata names the authorization server, where the user signs in.
- The client then sends
Authorization: Bearer <token>.
- The server checks the token against the authorization server's introspection endpoint. The endpoint answers with the Elfa API key the request runs as, so the token never reaches the Elfa API.
Notes:
- An
x-elfa-api-key header still works in OAuth mode.
ELFA_API_KEY is ignored in OAuth mode, so a caller with no credential never runs as the server's own key.
- Valid tokens are cached for up to a minute, which bounds how long a revoked token keeps working.
Safety
api_status is the fastest way to tell an auth problem from a credit problem.
Mentions, news and narratives return third-party social text that anyone can write, events are written up from it, and the v3 tools carry third-party asset, account and channel names. The server marks it as untrusted in every response, and the server instructions tell the model to treat it as data. Keep that in mind before letting an agent chain from that content into auto_query_write.
Development
npm run verify runs typecheck, tests, the spec drift check, and the docs check.
manifest.json maps every documented API operation to the tool that covers it. npm run check:drift fails if the API grows an operation the server does not handle. The tool table above is generated from the same file with npm run docs:tools.
Links
License
MIT