@dreamcash-org/mcp 0.1.1 → 0.2.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/README.md +38 -28
- package/dist/THIRD_PARTY_LICENSES.md +2 -2
- package/dist/dreamcash-mcp.js +59 -79
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
Let your own AI agent work with your [Dreamcash](https://dreamcash.xyz)
|
|
4
4
|
account. Dreamcash is a trading app on Hyperliquid; this MCP server lets an
|
|
5
5
|
agent such as Claude Code, Grok Bot, Hermes, OpenClaw or Cursor read your
|
|
6
|
-
account and markets, and trade: **each trade
|
|
7
|
-
|
|
6
|
+
account and markets, and trade: **each trade approved by you in the Dreamcash
|
|
7
|
+
app, or, if you let it, on its own within limits you set.**
|
|
8
8
|
|
|
9
9
|
> Using a chat app that connects to remote MCP servers (Claude, ChatGPT,
|
|
10
|
-
> Grok)? You don't need this package: add
|
|
11
|
-
> a custom connector instead
|
|
10
|
+
> Grok, Gemini)? You don't need this package: add
|
|
11
|
+
> `https://api.dreamcash.xyz/mcp` as a custom connector instead, and enter
|
|
12
|
+
> the code from the Dreamcash app (Settings › Connected AI) when it asks. Each
|
|
13
|
+
> trade then waits for you; trading on its own needs this package.
|
|
12
14
|
|
|
13
15
|
## What your agent can do
|
|
14
16
|
|
|
@@ -19,10 +21,10 @@ wallet, or, if you let it, on its own within limits you set.**
|
|
|
19
21
|
orders, cancel or change orders, take profit and stop loss, leverage and
|
|
20
22
|
margin, spot and prediction orders, vault deposits and withdrawals, moving
|
|
21
23
|
USDC between spot and perps, and withdrawing to one of your own wallets.
|
|
22
|
-
Each request
|
|
23
|
-
|
|
24
|
-
minutes. Trades pay the same fees as in the app.
|
|
25
|
-
- **Trade on its own**, if you
|
|
24
|
+
Each request sends a push to the Dreamcash app, where you review exactly
|
|
25
|
+
what will be signed and approve or refuse it. Requests you don't answer
|
|
26
|
+
expire after 15 minutes. Trades pay the same fees as in the app.
|
|
27
|
+
- **Trade on its own**, if you turn it on in the app: your main wallet
|
|
26
28
|
approves the agent's key on Hyperliquid once, for the days you pick (up to
|
|
27
29
|
180), and its orders, position changes and HLP moves on your main wallet go
|
|
28
30
|
through without asking you, within your limits per order, on leverage and
|
|
@@ -73,26 +75,31 @@ command = "npx"
|
|
|
73
75
|
args = ["-y", "@dreamcash-org/mcp"]
|
|
74
76
|
```
|
|
75
77
|
|
|
78
|
+
**Gemini for Mac**: Customize › Connectors › Add custom app › Local MCP, with
|
|
79
|
+
the command `npx -y @dreamcash-org/mcp`.
|
|
80
|
+
|
|
76
81
|
**Agents that set up their own tools** (Grok Bot, Hermes, OpenClaw): ask
|
|
77
82
|
the agent to add a local MCP server that runs `npx -y @dreamcash-org/mcp`.
|
|
78
83
|
|
|
84
|
+
Desktop apps often start servers without your terminal's `PATH`: if `npx`
|
|
85
|
+
isn't found, use its full path, which `which npx` prints in your terminal
|
|
86
|
+
(e.g. `/opt/homebrew/bin/npx`).
|
|
87
|
+
|
|
79
88
|
## Connect your account
|
|
80
89
|
|
|
81
|
-
1.
|
|
82
|
-
code, valid for 10 minutes.
|
|
83
|
-
2.
|
|
84
|
-
|
|
85
|
-
3.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
many days its key lasts. Then approve; for trading on its own, your wallet
|
|
89
|
-
then signs the key's approval on the next page.
|
|
90
|
+
1. In the Dreamcash app, open **Settings › Connected AI**. It shows a
|
|
91
|
+
6-character code, valid for 10 minutes.
|
|
92
|
+
2. Tell your agent to connect to Dreamcash with that code. It's connected
|
|
93
|
+
at once, and the app lists it under Connected AI.
|
|
94
|
+
3. To let it trade on its own, open it in Connected AI, pick its limits (by
|
|
95
|
+
default $1,000 per order, 10x leverage, $5,000 a day) and how many days its
|
|
96
|
+
key lasts, and approve its key with your main wallet.
|
|
90
97
|
|
|
91
98
|
## Safety
|
|
92
99
|
|
|
93
|
-
- **Dreamcash holds no key that can trade for you.** Everything you
|
|
94
|
-
signed in
|
|
95
|
-
|
|
100
|
+
- **Dreamcash holds no key that can trade for you.** Everything you approve is
|
|
101
|
+
signed in the Dreamcash app, which shows exactly what you sign. Read it
|
|
102
|
+
before you approve: an agent can be wrong, or be misled by what it reads.
|
|
96
103
|
- **The agent's key stays on its machine.** The first time it connects, this
|
|
97
104
|
server makes a key and saves it in `~/.dreamcash/agent-key.json`, readable
|
|
98
105
|
only by your user. Dreamcash never sees it. Every call the agent makes is
|
|
@@ -107,23 +114,26 @@ the agent to add a local MCP server that runs `npx -y @dreamcash-org/mcp`.
|
|
|
107
114
|
short key life. Before it signs a trade, this server checks that it is the
|
|
108
115
|
one the agent asked for, on your main wallet, at prices within 10% of
|
|
109
116
|
Hyperliquid's live price.
|
|
110
|
-
- **
|
|
111
|
-
|
|
117
|
+
- **Give your code only to your own agent.** Anyone who has it in its 10
|
|
118
|
+
minutes can connect their agent to your account; the app tells you each
|
|
119
|
+
time an AI connects.
|
|
112
120
|
- **What the agent sees**: the balances, positions and history of every
|
|
113
121
|
wallet in your Dreamcash account.
|
|
114
|
-
- **To disconnect**
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
`agent-key.json.pending`; the key before it keeps working until
|
|
118
|
-
|
|
122
|
+
- **To disconnect** it, swipe it away in Connected AI: the app also revokes
|
|
123
|
+
its key on Hyperliquid when it trades on its own. Deleting the key file
|
|
124
|
+
disconnects this machine too. Pairing again makes a new key in
|
|
125
|
+
`agent-key.json.pending`; the key before it keeps working until the new one
|
|
126
|
+
pairs.
|
|
119
127
|
|
|
120
128
|
## Troubleshooting
|
|
121
129
|
|
|
122
130
|
| What the agent reports | What to do |
|
|
123
131
|
| --- | --- |
|
|
124
132
|
| `dreamcash_unreachable` | Check the machine is online; try again in a minute. |
|
|
125
|
-
| `
|
|
133
|
+
| `npx` not found | Use its full path (`which npx` prints it), as above. |
|
|
134
|
+
| `key_not_saved`, `key_unreadable` | Make the key file readable and writable by the user the agent runs as, or set `DREAMCASH_AGENT_KEY_FILE` to a file that is, then restart the agent. An app that runs servers in a sandbox (e.g. Gemini for Mac) may allow writes only to some folders: put the key file in one of them. Deleting a paired key file disconnects this machine. |
|
|
126
135
|
| No Dreamcash tools after connecting | Restart the agent or reload its MCP servers: some clients don't notice new tools by themselves. |
|
|
136
|
+
| `code_invalid` | The code expired or was used: read the one the app shows now (Settings › Connected AI) and give it to the agent. |
|
|
127
137
|
| `update_required` | Run the server as `npx -y @dreamcash-org/mcp@latest` once (npx may keep using a version it already downloaded), then restart the agent. |
|
|
128
138
|
|
|
129
139
|
## Settings
|
|
@@ -707,7 +707,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
707
707
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
708
708
|
THE SOFTWARE.
|
|
709
709
|
|
|
710
|
-
## @noble/hashes
|
|
710
|
+
## @noble/hashes 1.8.0 (MIT)
|
|
711
711
|
|
|
712
712
|
The MIT License (MIT)
|
|
713
713
|
|
|
@@ -731,7 +731,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
731
731
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
732
732
|
THE SOFTWARE.
|
|
733
733
|
|
|
734
|
-
## @noble/hashes
|
|
734
|
+
## @noble/hashes 2.3.0 (MIT)
|
|
735
735
|
|
|
736
736
|
The MIT License (MIT)
|
|
737
737
|
|
package/dist/dreamcash-mcp.js
CHANGED
|
@@ -21456,7 +21456,7 @@ import { createHash } from "node:crypto";
|
|
|
21456
21456
|
// package.json
|
|
21457
21457
|
var package_default = {
|
|
21458
21458
|
name: "@dreamcash-org/mcp",
|
|
21459
|
-
version: "0.
|
|
21459
|
+
version: "0.2.0",
|
|
21460
21460
|
description: "Connect your own AI agent to your Dreamcash account: it reads your account and trades, each trade confirmed by you or on its own within your limits.",
|
|
21461
21461
|
license: "MIT",
|
|
21462
21462
|
keywords: [
|
|
@@ -21577,16 +21577,15 @@ var agentApi = (baseUrl, account) => {
|
|
|
21577
21577
|
return answer;
|
|
21578
21578
|
};
|
|
21579
21579
|
const tradeRequest = (id, action = "") => `/api/ai-connections/agent/trade-requests/${encodeURIComponent(id)}${action}`;
|
|
21580
|
-
const link = (code = "") => `/api/ai-agent/links${code ? `/${encodeURIComponent(code)}` : ""}`;
|
|
21581
21580
|
return {
|
|
21582
21581
|
get: (id) => call("GET", tradeRequest(id)),
|
|
21583
21582
|
claim: (id) => call("POST", tradeRequest(id, "/claim"), {}),
|
|
21584
21583
|
sent: (id) => call("POST", tradeRequest(id, "/sent"), {}),
|
|
21585
21584
|
notSent: (id, reason) => call("POST", tradeRequest(id, "/not-sent"), { reason: reason.slice(0, 200) }),
|
|
21586
|
-
|
|
21585
|
+
pair: (code, clientName) => call("POST", "/api/ai-agent/links/pair", {
|
|
21586
|
+
code,
|
|
21587
21587
|
clientName: clientName.slice(0, AI_CLIENT_NAME_MAX_LENGTH)
|
|
21588
|
-
})
|
|
21589
|
-
pairingStatus: (code) => call("GET", link(code))
|
|
21588
|
+
})
|
|
21590
21589
|
};
|
|
21591
21590
|
};
|
|
21592
21591
|
|
|
@@ -26168,7 +26167,6 @@ var newAgentAccount = async (file = defaultKeyFile()) => {
|
|
|
26168
26167
|
return account;
|
|
26169
26168
|
};
|
|
26170
26169
|
var adoptPendingKey = (file) => rename(pendingKeyFile(file), file);
|
|
26171
|
-
var dropPendingKey = (file) => rm(pendingKeyFile(file), { force: true });
|
|
26172
26170
|
// ../hyperliquid-orders/src/trade.ts
|
|
26173
26171
|
var OUTCOME_PRICE_DECIMALS = 5;
|
|
26174
26172
|
// ../hyperliquid-orders/src/plan.ts
|
|
@@ -48705,30 +48703,36 @@ var executeTradeRequest = async ({
|
|
|
48705
48703
|
};
|
|
48706
48704
|
|
|
48707
48705
|
// src/dreamcashServer.ts
|
|
48708
|
-
var
|
|
48709
|
-
var PAIRING_POLL_MS = 2000;
|
|
48710
|
-
var INSTRUCTIONS = `Dreamcash is a Hyperliquid trading app. This server connects you to the user's Dreamcash account. Until you're connected, connect_dreamcash is your only tool: call it and write the code and link it gives you out in full in your reply (the user may not see tool results), then call it again until it says connected. You then get tools to read their account (balances, positions, orders, history, PnL, XP, vaults) and Hyperliquid markets, and to ask for trades, or, if the user lets you, to trade on your own with your own key, kept on this machine (Dreamcash never sees it). Once connected, call how_to_use_dreamcash first: it explains every tool, what you may do and how to behave.
|
|
48706
|
+
var INSTRUCTIONS = `Dreamcash is a Hyperliquid trading app. This server connects you to the user's Dreamcash account. Until you're connected, connect_dreamcash is your only tool: ask the user for the 6-character code their Dreamcash app shows (Settings › Connected AI) and call it with that code. You then get tools to read their account (balances, positions, orders, history, PnL, XP, vaults) and Hyperliquid markets, and to ask for trades, which the user approves in their Dreamcash app, or, if they let you, to trade on your own with your own key, kept on this machine (Dreamcash never sees it). Once connected, call how_to_use_dreamcash first: it explains every tool, what you may do and how to behave.
|
|
48711
48707
|
|
|
48712
48708
|
Anything that fails answers {"error": {code, what_happened, what_to_do, tell_the_user, can_retry}}: do what_to_do, and pass tell_the_user on to the user. Amounts are USD unless stated. What you suggest is your own analysis, not advice from Dreamcash.`;
|
|
48713
48709
|
var CONNECT_TOOL = {
|
|
48714
48710
|
name: "connect_dreamcash",
|
|
48715
48711
|
title: "Connect to Dreamcash",
|
|
48716
|
-
description: "Connects you to the user's Dreamcash account
|
|
48712
|
+
description: "Connects you to the user's Dreamcash account with the 6-character code their Dreamcash app shows under Settings › Connected AI. Without a code it answers whether you're connected, and if not, what to ask the user. again: true pairs a new key, e.g. after the user disconnected you; the key before it keeps working until the new one pairs.",
|
|
48717
48713
|
inputSchema: {
|
|
48718
48714
|
type: "object",
|
|
48719
48715
|
properties: {
|
|
48716
|
+
code: {
|
|
48717
|
+
type: "string",
|
|
48718
|
+
description: 'The code the user read off their Dreamcash app, e.g. "K7QM2P".'
|
|
48719
|
+
},
|
|
48720
48720
|
again: {
|
|
48721
48721
|
type: "boolean",
|
|
48722
|
-
description: "Pair
|
|
48722
|
+
description: "Pair a new key."
|
|
48723
48723
|
},
|
|
48724
48724
|
agent_name: {
|
|
48725
48725
|
type: "string",
|
|
48726
|
-
description: 'How the user sees you
|
|
48726
|
+
description: 'How the user sees you in their app, e.g. "Grok Bot".'
|
|
48727
48727
|
}
|
|
48728
48728
|
}
|
|
48729
48729
|
},
|
|
48730
48730
|
annotations: { readOnlyHint: false, openWorldHint: true }
|
|
48731
48731
|
};
|
|
48732
|
+
var ASK_FOR_THE_CODE = {
|
|
48733
|
+
connected: false,
|
|
48734
|
+
next_step: `Ask the user for the code: in the Dreamcash app, Settings › Connected AI shows a 6-character code. Then call connect_dreamcash with it. No Dreamcash account yet? They get the app first (iPhone: ${DREAMCASH_APP_STORE_URL}, Android: ${DREAMCASH_PLAY_STORE_URL}) and make one there.`
|
|
48735
|
+
};
|
|
48732
48736
|
var text = (value, isError = false) => ({
|
|
48733
48737
|
content: [{ type: "text", text: JSON.stringify(value) }],
|
|
48734
48738
|
...isError && { isError: true }
|
|
@@ -48745,19 +48749,19 @@ class KeyNotSaved extends Error {
|
|
|
48745
48749
|
var NOT_CONNECTED = {
|
|
48746
48750
|
code: "not_connected",
|
|
48747
48751
|
what_happened: "This agent isn't connected to a Dreamcash account.",
|
|
48748
|
-
what_to_do: "
|
|
48752
|
+
what_to_do: "Ask the user for the code their Dreamcash app shows under Settings › Connected AI, then call connect_dreamcash with it.",
|
|
48749
48753
|
can_retry: "after_user_action"
|
|
48750
48754
|
};
|
|
48751
48755
|
var DISCONNECTED = {
|
|
48752
48756
|
code: "disconnected",
|
|
48753
48757
|
what_happened: "Dreamcash no longer accepts this agent: the user disconnected it, or it was never approved.",
|
|
48754
|
-
what_to_do: "If the user wants to connect again, call connect_dreamcash
|
|
48758
|
+
what_to_do: "If the user wants to connect again, ask them for a new code from their Dreamcash app (Settings › Connected AI) and call connect_dreamcash with it and again: true.",
|
|
48755
48759
|
can_retry: "after_user_action"
|
|
48756
48760
|
};
|
|
48757
48761
|
var USER_APPROVES_KEY = {
|
|
48758
48762
|
code: "user_approves_key",
|
|
48759
48763
|
what_happened: "This request approves your own key to trade, which only the user can sign. Your key signed nothing.",
|
|
48760
|
-
what_to_do: "
|
|
48764
|
+
what_to_do: "The user approves it in their Dreamcash app, which got a push for it: tell them, then call get_trade_request with request_id.",
|
|
48761
48765
|
can_retry: "after_user_action"
|
|
48762
48766
|
};
|
|
48763
48767
|
var unreachable = (error2) => ({
|
|
@@ -48853,7 +48857,6 @@ var createDreamcashServer = ({
|
|
|
48853
48857
|
let account;
|
|
48854
48858
|
let pairingKey;
|
|
48855
48859
|
let upstream;
|
|
48856
|
-
let shownCode;
|
|
48857
48860
|
let toolsStale = true;
|
|
48858
48861
|
const connectUpstream = async (key) => {
|
|
48859
48862
|
const client = new Client({
|
|
@@ -48865,23 +48868,25 @@ var createDreamcashServer = ({
|
|
|
48865
48868
|
}));
|
|
48866
48869
|
return client;
|
|
48867
48870
|
};
|
|
48868
|
-
const
|
|
48869
|
-
if (upstream)
|
|
48870
|
-
return upstream;
|
|
48871
|
-
account ??= await storedAgentAccount(keyFile);
|
|
48872
|
-
if (!account)
|
|
48873
|
-
return;
|
|
48871
|
+
const upstreamFor = async (key) => {
|
|
48874
48872
|
try {
|
|
48875
|
-
|
|
48876
|
-
return upstream;
|
|
48873
|
+
return await connectUpstream(key);
|
|
48877
48874
|
} catch (error2) {
|
|
48878
48875
|
if (isUnauthorized(error2))
|
|
48879
48876
|
return;
|
|
48880
48877
|
throw error2;
|
|
48881
48878
|
}
|
|
48882
48879
|
};
|
|
48883
|
-
const
|
|
48884
|
-
|
|
48880
|
+
const linked = async () => {
|
|
48881
|
+
if (upstream)
|
|
48882
|
+
return upstream;
|
|
48883
|
+
account ??= await storedAgentAccount(keyFile);
|
|
48884
|
+
if (!account)
|
|
48885
|
+
return;
|
|
48886
|
+
upstream = await upstreamFor(account);
|
|
48887
|
+
return upstream;
|
|
48888
|
+
};
|
|
48889
|
+
const connected = async (client) => {
|
|
48885
48890
|
if (toolsStale) {
|
|
48886
48891
|
await server.notification({ method: "notifications/tools/list_changed" });
|
|
48887
48892
|
}
|
|
@@ -48891,10 +48896,7 @@ var createDreamcashServer = ({
|
|
|
48891
48896
|
key_address: account?.address,
|
|
48892
48897
|
tools: tools.map((tool) => tool.name),
|
|
48893
48898
|
how_to_use: client.getInstructions(),
|
|
48894
|
-
next_step: "Call how_to_use_dreamcash: it explains every tool, what you may do and how to behave."
|
|
48895
|
-
...tradeRequestId && {
|
|
48896
|
-
note: "The user is approving your key to trade on its own; until they sign, each trade waits for them at a link."
|
|
48897
|
-
}
|
|
48899
|
+
next_step: "Call how_to_use_dreamcash: it explains every tool, what you may do and how to behave."
|
|
48898
48900
|
});
|
|
48899
48901
|
};
|
|
48900
48902
|
const freshAccount = async (file) => {
|
|
@@ -48904,52 +48906,7 @@ var createDreamcashServer = ({
|
|
|
48904
48906
|
throw new KeyNotSaved(file, error2);
|
|
48905
48907
|
}
|
|
48906
48908
|
};
|
|
48907
|
-
const
|
|
48908
|
-
again = false,
|
|
48909
|
-
agent_name
|
|
48910
|
-
}) => {
|
|
48911
|
-
pairingKey ??= await storedAgentAccount(pendingFile);
|
|
48912
|
-
if (again) {
|
|
48913
|
-
pairingKey = await freshAccount(pendingFile);
|
|
48914
|
-
} else if (!pairingKey) {
|
|
48915
|
-
const client2 = await linked();
|
|
48916
|
-
if (client2)
|
|
48917
|
-
return connected(client2);
|
|
48918
|
-
pairingKey = await freshAccount(pendingFile);
|
|
48919
|
-
}
|
|
48920
|
-
const key = pairingKey;
|
|
48921
|
-
const api2 = agentApi(apiUrl, key);
|
|
48922
|
-
const clientName = agent_name ?? server.getClientVersion()?.name ?? "Your AI";
|
|
48923
|
-
const pairing = await api2.createPairing(clientName);
|
|
48924
|
-
const pairingStep = {
|
|
48925
|
-
connected: false,
|
|
48926
|
-
code: pairing.code,
|
|
48927
|
-
pair_url: pairing.pairUrl,
|
|
48928
|
-
expires_at: pairing.expiresAt,
|
|
48929
|
-
key_address: key.address,
|
|
48930
|
-
next_step: `Tell the user: open the Dreamcash app, or get it and make an account (iPhone: ${DREAMCASH_APP_STORE_URL}, Android: ${DREAMCASH_PLAY_STORE_URL}). Then visit ${pairing.pairUrl}, sign in with that same account and enter ${pairing.code}. The page shows the key it pairs, which must be ${key.address}. Then call connect_dreamcash again.`
|
|
48931
|
-
};
|
|
48932
|
-
if (pairing.code !== shownCode) {
|
|
48933
|
-
shownCode = pairing.code;
|
|
48934
|
-
return text(pairingStep);
|
|
48935
|
-
}
|
|
48936
|
-
const deadline = Date.now() + PAIRING_WAIT_MS;
|
|
48937
|
-
let status = await api2.pairingStatus(pairing.code);
|
|
48938
|
-
while (status.status === "pending" && Date.now() < deadline) {
|
|
48939
|
-
await sleep3(PAIRING_POLL_MS);
|
|
48940
|
-
status = await api2.pairingStatus(pairing.code);
|
|
48941
|
-
}
|
|
48942
|
-
if (status.status === "pending")
|
|
48943
|
-
return text(pairingStep);
|
|
48944
|
-
if (status.status !== "approved") {
|
|
48945
|
-
pairingKey = undefined;
|
|
48946
|
-
await dropPendingKey(keyFile);
|
|
48947
|
-
return text({
|
|
48948
|
-
connected: false,
|
|
48949
|
-
status: status.status,
|
|
48950
|
-
next_step: "The new key wasn't paired. Call connect_dreamcash again if the user wants to connect."
|
|
48951
|
-
});
|
|
48952
|
-
}
|
|
48909
|
+
const finishPairing = async (key) => {
|
|
48953
48910
|
await adoptPendingKey(keyFile).catch((error2) => {
|
|
48954
48911
|
throw new KeyNotSaved(keyFile, error2);
|
|
48955
48912
|
});
|
|
@@ -48961,12 +48918,35 @@ var createDreamcashServer = ({
|
|
|
48961
48918
|
if (!client) {
|
|
48962
48919
|
return failure2({
|
|
48963
48920
|
code: "pairing_not_accepted",
|
|
48964
|
-
what_happened: "The
|
|
48965
|
-
what_to_do: "
|
|
48921
|
+
what_happened: "The code paired, but Dreamcash doesn't accept this agent's key.",
|
|
48922
|
+
what_to_do: "Ask the user for a new code from their Dreamcash app, then call connect_dreamcash with it and again: true.",
|
|
48966
48923
|
can_retry: "after_user_action"
|
|
48967
48924
|
});
|
|
48968
48925
|
}
|
|
48969
|
-
return connected(client
|
|
48926
|
+
return connected(client);
|
|
48927
|
+
};
|
|
48928
|
+
const connect = async ({
|
|
48929
|
+
code,
|
|
48930
|
+
again = false,
|
|
48931
|
+
agent_name
|
|
48932
|
+
}) => {
|
|
48933
|
+
if (again) {
|
|
48934
|
+
pairingKey = await freshAccount(pendingFile);
|
|
48935
|
+
} else {
|
|
48936
|
+
pairingKey ??= await storedAgentAccount(pendingFile);
|
|
48937
|
+
if (pairingKey && await upstreamFor(pairingKey)) {
|
|
48938
|
+
return finishPairing(pairingKey);
|
|
48939
|
+
}
|
|
48940
|
+
const client = pairingKey && code ? undefined : await linked();
|
|
48941
|
+
if (client)
|
|
48942
|
+
return connected(client);
|
|
48943
|
+
}
|
|
48944
|
+
if (!code)
|
|
48945
|
+
return text(ASK_FOR_THE_CODE);
|
|
48946
|
+
pairingKey ??= await freshAccount(pendingFile);
|
|
48947
|
+
const clientName = agent_name ?? server.getClientVersion()?.name ?? "Your AI";
|
|
48948
|
+
await agentApi(apiUrl, pairingKey).pair(code, clientName);
|
|
48949
|
+
return finishPairing(pairingKey);
|
|
48970
48950
|
};
|
|
48971
48951
|
const executeWithKey = async (id, asked, key) => {
|
|
48972
48952
|
const { info, exchangeSignedBy } = createTradeRequestClients();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dreamcash-org/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Connect your own AI agent to your Dreamcash account: it reads your account and trades, each trade confirmed by you or on its own within your limits.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|