@elfa-ai/mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/LICENSE +21 -0
- package/README.md +154 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1360 -0
- package/manifest.json +214 -0
- package/package.json +73 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
First release of the TypeScript server, published as `@elfa-ai/mcp`.
|
|
6
|
+
|
|
7
|
+
- 12 tools covering the documented `/v2` surface: mentions, trending tokens and contract addresses, narratives, account stats, market chat, and the Auto condition engine including drafts, executions, LLM sessions and exchange connections
|
|
8
|
+
- Runs over stdio or Streamable HTTP from one codebase, stateless so it scales horizontally
|
|
9
|
+
- Structured output with schemas, and tool annotations so clients know which tools write
|
|
10
|
+
- Response shaping: verbosity control, small page defaults, size ceilings, and field pruning
|
|
11
|
+
- Errors written for the model to recover from rather than raw status codes
|
|
12
|
+
- HMAC request signing for Auto trading actions and exchange linking
|
|
13
|
+
- `manifest.json` maps every documented API operation to its tool, enforced in CI
|
|
14
|
+
|
|
15
|
+
Streaming endpoints are not exposed as tools, since a tool call returns a single result. Poll `elfa_auto_query` instead, or use an SDK for SSE.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2025] [elfa.ai]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Elfa MCP
|
|
2
|
+
|
|
3
|
+
Model Context Protocol server for the [Elfa API](https://docs.elfa.ai) — crypto social intelligence from X and Telegram, plus **Auto**, a condition engine that watches the market and fires an action when your conditions are met.
|
|
4
|
+
|
|
5
|
+
Works with any MCP client: Claude Code, Claude Desktop, Cursor, VS Code, Codex, and anything else that speaks MCP.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Get an API key at [dev.elfa.ai](https://dev.elfa.ai). No install step — `npx` fetches the server on demand.
|
|
10
|
+
|
|
11
|
+
**Claude Code**
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
claude mcp add elfa --env ELFA_API_KEY=your-key -- npx -y @elfa-ai/mcp
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Cursor, VS Code, Claude Desktop, and other clients**
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"mcpServers": {
|
|
22
|
+
"elfa": {
|
|
23
|
+
"command": "npx",
|
|
24
|
+
"args": ["-y", "@elfa-ai/mcp"],
|
|
25
|
+
"env": {
|
|
26
|
+
"ELFA_API_KEY": "your-key"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
VS Code uses `"servers"` instead of `"mcpServers"`. Everything else is the same.
|
|
34
|
+
|
|
35
|
+
Ask *"what's trending in crypto right now?"* to confirm it works.
|
|
36
|
+
|
|
37
|
+
## Configuration
|
|
38
|
+
|
|
39
|
+
| Variable | Required | Purpose |
|
|
40
|
+
| --- | --- | --- |
|
|
41
|
+
| `ELFA_API_KEY` | yes | Authenticates every request |
|
|
42
|
+
| `ELFA_HMAC_SECRET` | no | Signs Auto requests. Needed only to connect an exchange, or to run a query whose action places an order |
|
|
43
|
+
| `ELFA_TIMEOUT` | no | Request timeout in ms, default `30000` |
|
|
44
|
+
| `ELFA_MCP_MAX_RESPONSE_CHARS` | no | Response size ceiling, default `60000` |
|
|
45
|
+
|
|
46
|
+
Without `ELFA_HMAC_SECRET` everything still works except exchange linking and order-placing queries — those return a message telling you what to set.
|
|
47
|
+
|
|
48
|
+
## Tools
|
|
49
|
+
|
|
50
|
+
<!-- tools:start -->
|
|
51
|
+
|
|
52
|
+
12 tools, mapped to every documented `/v2` operation.
|
|
53
|
+
|
|
54
|
+
| Tool | Mode | Cost | What it does |
|
|
55
|
+
| --- | --- | --- | --- |
|
|
56
|
+
| `elfa_status` | read | Free | Check API key tier, credit usage and remaining requests. Also confirms the API is reachable. |
|
|
57
|
+
| `elfa_mentions` | read | 1 per call | Social mentions from X and Telegram. mode=top ranks a ticker's mentions by engagement, mode=search filters by keyword or account, mode=news returns the token news feed. |
|
|
58
|
+
| `elfa_trending` | read | 1 per call | What is gaining social attention. scope=tokens for tickers, scope=contracts_twitter or scope=contracts_telegram for contract addresses. |
|
|
59
|
+
| `elfa_narratives` | read | 5 per call | Written narrative analysis with source links. scope=market extracts market-wide narratives, scope=keywords summarises events for specific keywords. |
|
|
60
|
+
| `elfa_account_stats` | read | 1 per call | Smart follower and engagement stats for an X account. |
|
|
61
|
+
| `elfa_chat` | read | Varies by speed | Ask for written market analysis. Supports conversational chat, macro overview, quick summary, token intro, token analysis and account analysis. |
|
|
62
|
+
| `elfa_auto_build` | read | 1 plus LLM usage | Turn a plain-language monitoring request into an EQL query. Returns a draft to validate and activate, it does not activate anything itself. |
|
|
63
|
+
| `elfa_auto_validate` | read | Free | Check EQL syntax and get a cost estimate before activating. Accepts an inline query or a draft id. |
|
|
64
|
+
| `elfa_auto_query` | read | Free | Read side of Auto: list queries, poll one query, and read its executions and LLM sessions. |
|
|
65
|
+
| `elfa_auto_query_write` | write | 5 plus LLM usage to create, free to cancel or delete | Activate, cancel or delete an Auto query. Activated queries run unattended and fire their action when conditions are met. |
|
|
66
|
+
| `elfa_auto_draft` | write | Free, except convert which costs the same as creating a query | Manage inactive Auto drafts. Drafts do not evaluate until converted into an active query. |
|
|
67
|
+
| `elfa_auto_exchanges` | write | Free | List, connect and disconnect the exchange accounts Auto uses for order actions, and check whether a symbol is tradeable. |
|
|
68
|
+
|
|
69
|
+
Not exposed as tools:
|
|
70
|
+
|
|
71
|
+
- `chat-stream-v2` — A tool call returns one result, so streaming adds nothing. elfa_chat covers the same analysis.
|
|
72
|
+
- `auto-stream-queries-v2` — Long lived streams have no tool equivalent. Poll with elfa_auto_query.
|
|
73
|
+
- `auto-stream-query-v2` — Long lived streams have no tool equivalent. Poll with elfa_auto_query.
|
|
74
|
+
|
|
75
|
+
<!-- tools:end -->
|
|
76
|
+
|
|
77
|
+
Streaming endpoints stay available through the [SDKs](https://docs.elfa.ai) for applications that can consume SSE.
|
|
78
|
+
|
|
79
|
+
### Where this differs from the raw API
|
|
80
|
+
|
|
81
|
+
The tools deliberately do not inherit every API default, because an agent pays for verbosity in context.
|
|
82
|
+
|
|
83
|
+
| | API | Here | Why |
|
|
84
|
+
| --- | --- | --- | --- |
|
|
85
|
+
| `pageSize` | 10 to 50 depending on endpoint, max 100 | 10 | Page through rather than pull everything |
|
|
86
|
+
| `speed` on chat | `expert` | `fast` | Cheaper by default, ask for `expert` when depth matters |
|
|
87
|
+
| Mention fields | full record | high signal fields | Pass `verbosity: "detailed"` for the rest |
|
|
88
|
+
| Large responses | returned whole | trimmed to fit, with a note | Keeps one call from filling the context window |
|
|
89
|
+
|
|
90
|
+
Every value is still settable per call, and `pageSize` accepts up to 100.
|
|
91
|
+
|
|
92
|
+
## Auto
|
|
93
|
+
|
|
94
|
+
Auto queries run unattended. Once armed, a query keeps evaluating and fires its action without asking again.
|
|
95
|
+
|
|
96
|
+
The flow is three steps:
|
|
97
|
+
|
|
98
|
+
1. `elfa_auto_build` — describe what to watch in plain language, get EQL back
|
|
99
|
+
2. `elfa_auto_validate` — check the syntax and get the credit cost
|
|
100
|
+
3. `elfa_auto_query_write` — activate it
|
|
101
|
+
|
|
102
|
+
Actions can notify you, call a webhook, message a Telegram bot, run an LLM analysis, or place an order on a connected exchange. Order actions need `ELFA_HMAC_SECRET` and a connected exchange.
|
|
103
|
+
|
|
104
|
+
### Connecting an exchange
|
|
105
|
+
|
|
106
|
+
| Venue | Connect from here | Credentials |
|
|
107
|
+
| --- | --- | --- |
|
|
108
|
+
| `binance` | yes | `apiKey`, `secret` |
|
|
109
|
+
| `pacifica` | yes | `privateKey`, `walletAddress` |
|
|
110
|
+
| `hyperliquid` | no, wallet is set up in the Elfa app | none |
|
|
111
|
+
| `gmx` | no, wallet is set up in the Elfa app | none |
|
|
112
|
+
|
|
113
|
+
Credentials are verified on connect, so a wrong value fails there rather than when an order fires. They are ordinary tool arguments, so they pass through the model and land in the client's transcript.
|
|
114
|
+
|
|
115
|
+
There is no push channel over MCP. Poll `elfa_auto_query` with `method=get`, and wait for the returned `pollAfterSeconds` between calls.
|
|
116
|
+
|
|
117
|
+
## Remote server
|
|
118
|
+
|
|
119
|
+
The same server runs over Streamable HTTP for hosted deployments:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
ELFA_MCP_TRANSPORT=http ELFA_MCP_PORT=3000 npx -y @elfa-ai/mcp
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
It is stateless — no sessions, one server instance per request, safe behind a load balancer. Credentials come from `x-elfa-api-key` and `x-elfa-hmac-secret` request headers, falling back to the environment. Set `ELFA_MCP_ALLOWED_ORIGINS` to a comma separated allowlist when exposing it publicly.
|
|
126
|
+
|
|
127
|
+
## Safety
|
|
128
|
+
|
|
129
|
+
`elfa_status` is the fastest way to tell an auth problem from a credit problem.
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
Mentions, news and narratives return third-party social text that anyone can write. 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 `elfa_auto_query_write` or `elfa_auto_exchanges`.
|
|
133
|
+
|
|
134
|
+
## Development
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
npm install
|
|
138
|
+
npm run build
|
|
139
|
+
npm run verify
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`npm run verify` runs typecheck, tests, the spec drift check, and the docs check.
|
|
143
|
+
|
|
144
|
+
`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`.
|
|
145
|
+
|
|
146
|
+
## Links
|
|
147
|
+
|
|
148
|
+
- [Documentation](https://docs.elfa.ai)
|
|
149
|
+
- [API keys](https://dev.elfa.ai)
|
|
150
|
+
- [TypeScript SDK](https://www.npmjs.com/package/@elfa-ai/sdk)
|
|
151
|
+
|
|
152
|
+
## License
|
|
153
|
+
|
|
154
|
+
MIT
|
package/dist/index.d.ts
ADDED