@dreamcash-org/mcp 0.3.6 → 0.3.7
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 +15 -4
- package/dist/THIRD_PARTY_LICENSES.md +2 -2
- package/dist/dreamcash-mcp.js +129 -37
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,9 +91,10 @@ isn't found, use its full path, which `which npx` prints in your terminal
|
|
|
91
91
|
6-character code, valid for 10 minutes.
|
|
92
92
|
2. Tell your agent to connect to Dreamcash with that code. It's connected
|
|
93
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 (
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
3. To let it trade on its own, open it in Connected AI, pick its limits (they
|
|
95
|
+
start at $50 per order, 3x leverage and $250 a day, or at the budget and
|
|
96
|
+
leverage you gave your agent) and how many days its key lasts, and approve
|
|
97
|
+
its key with your main wallet.
|
|
97
98
|
|
|
98
99
|
Or, without a code: ask your agent to connect to Dreamcash. It answers with an
|
|
99
100
|
approval link (or your agent app opens it for you). Open it on the phone with
|
|
@@ -112,6 +113,15 @@ your agent for. A key that is still there but can't be read (a locked keychain,
|
|
|
112
113
|
another user) is not lost: the agent says how to make it readable, and asks
|
|
113
114
|
for no link.
|
|
114
115
|
|
|
116
|
+
### When you disconnected it
|
|
117
|
+
|
|
118
|
+
Once you disconnect the agent in the app, its next call to Dreamcash finds
|
|
119
|
+
out: it makes a new key and answers, in that same call, with an approval link
|
|
120
|
+
for you (or your agent app opens it). Approve it in the app to connect the
|
|
121
|
+
agent again; the old key never comes back. Until then the agent can't trade
|
|
122
|
+
on its own, and every Dreamcash call answers the same link rather than an
|
|
123
|
+
error to retry.
|
|
124
|
+
|
|
115
125
|
## Safety
|
|
116
126
|
|
|
117
127
|
- **Dreamcash holds no key that can trade for you.** Everything you approve is
|
|
@@ -169,7 +179,8 @@ for no link.
|
|
|
169
179
|
|
|
170
180
|
| What the agent reports | What to do |
|
|
171
181
|
| --- | --- |
|
|
172
|
-
| `dreamcash_unreachable` | Check the machine is online
|
|
182
|
+
| `dreamcash_unreachable` | Check the machine is online, then ask the agent to try again. |
|
|
183
|
+
| `disconnected` | You disconnected the agent (or removed its connection): open the link it shows and approve it in the app, or give it a new code. |
|
|
173
184
|
| `npx` not found | Use its full path (`which npx` prints it), as above. |
|
|
174
185
|
| `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. When the key is in the macOS keychain or a Linux keyring, `tell_the_user` says how to open it: usually start the agent from your logged-in desktop session (the store is locked over SSH and before you log in), or on macOS unlock the keychain first (`security unlock-keychain`). Never pair again to get past `key_unreadable`: the key you approved is still there. 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. |
|
|
175
186
|
| No Dreamcash tools after connecting | Restart the agent or reload its MCP servers: some clients don't notice new tools by themselves. |
|
|
@@ -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 1.8.0 (MIT)
|
|
735
735
|
|
|
736
736
|
The MIT License (MIT)
|
|
737
737
|
|
|
@@ -755,7 +755,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
755
755
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
756
756
|
THE SOFTWARE.
|
|
757
757
|
|
|
758
|
-
## @noble/hashes
|
|
758
|
+
## @noble/hashes 2.4.0 (MIT)
|
|
759
759
|
|
|
760
760
|
The MIT License (MIT)
|
|
761
761
|
|
package/dist/dreamcash-mcp.js
CHANGED
|
@@ -21115,7 +21115,7 @@ import { createHash } from "node:crypto";
|
|
|
21115
21115
|
// package.json
|
|
21116
21116
|
var package_default = {
|
|
21117
21117
|
name: "@dreamcash-org/mcp",
|
|
21118
|
-
version: "0.3.
|
|
21118
|
+
version: "0.3.7",
|
|
21119
21119
|
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.",
|
|
21120
21120
|
keywords: [
|
|
21121
21121
|
"mcp",
|
|
@@ -21235,11 +21235,12 @@ var agentApi = (baseUrl, account) => {
|
|
|
21235
21235
|
claim: (id) => call("POST", tradeRequest(id, "/claim"), {}),
|
|
21236
21236
|
sent: (id) => call("POST", tradeRequest(id, "/sent"), {}),
|
|
21237
21237
|
notSent: (id, reason) => call("POST", tradeRequest(id, "/not-sent"), { reason: reason.slice(0, 200) }),
|
|
21238
|
-
pair: (code, clientName) => call("POST", "/api/ai-agent/links/pair", {
|
|
21238
|
+
pair: (code, clientName, limits = {}) => call("POST", "/api/ai-agent/links/pair", {
|
|
21239
21239
|
code,
|
|
21240
|
-
clientName: clientName.slice(0, AI_CLIENT_NAME_MAX_LENGTH)
|
|
21240
|
+
clientName: clientName.slice(0, AI_CLIENT_NAME_MAX_LENGTH),
|
|
21241
|
+
limits
|
|
21241
21242
|
}),
|
|
21242
|
-
connectLink: (clientName) => call("POST", "/api/ai-agent/links/request", { clientName: clientName.slice(0, AI_CLIENT_NAME_MAX_LENGTH) })
|
|
21243
|
+
connectLink: (clientName, limits = {}) => call("POST", "/api/ai-agent/links/request", { clientName: clientName.slice(0, AI_CLIENT_NAME_MAX_LENGTH), limits })
|
|
21243
21244
|
};
|
|
21244
21245
|
};
|
|
21245
21246
|
|
|
@@ -48945,7 +48946,7 @@ ${AI_REPLY_STYLE}`;
|
|
|
48945
48946
|
var CONNECT_TOOL = {
|
|
48946
48947
|
name: "connect_dreamcash",
|
|
48947
48948
|
title: "Connect to Dreamcash",
|
|
48948
|
-
description: "Connects you to the user's Dreamcash account
|
|
48949
|
+
description: "Connects you to the user's Dreamcash account, so you can trade on your own once they let you. Without a code it answers whether you're connected, and if not, gives a link for the user to approve you in their Dreamcash app (or says what to ask them); after the user disconnected you, the link approves a new key. With the 6-character code their Dreamcash app shows under Settings › Connected AI, it pairs at once. If the user named a budget or leverage for you, pass them: the app's setup for trading on your own starts from them, and the user still approves it there. again: true pairs a new key; if that fails, the package keeps the key it had, which works only while that connection is still on.",
|
|
48949
48950
|
inputSchema: {
|
|
48950
48951
|
type: "object",
|
|
48951
48952
|
properties: {
|
|
@@ -48960,11 +48961,39 @@ var CONNECT_TOOL = {
|
|
|
48960
48961
|
agent_name: {
|
|
48961
48962
|
type: "string",
|
|
48962
48963
|
description: 'How the user sees you in their app, e.g. "Grok Bot".'
|
|
48964
|
+
},
|
|
48965
|
+
max_order_usd: {
|
|
48966
|
+
type: "number",
|
|
48967
|
+
description: "The most one order may be worth (the position's value, not its margin), from a budget the user named: a $20 budget at up to 2x is 40."
|
|
48968
|
+
},
|
|
48969
|
+
max_leverage: {
|
|
48970
|
+
type: "integer",
|
|
48971
|
+
description: 'The most leverage the user named, e.g. 2 for "max 2x".'
|
|
48972
|
+
},
|
|
48973
|
+
max_daily_usd: {
|
|
48974
|
+
type: "number",
|
|
48975
|
+
description: "The most the user said you may trade in a day (what the orders are worth), only if they named one."
|
|
48963
48976
|
}
|
|
48964
48977
|
}
|
|
48965
48978
|
},
|
|
48966
48979
|
annotations: { readOnlyHint: false, openWorldHint: true }
|
|
48967
48980
|
};
|
|
48981
|
+
var CONNECT_TOOL_DISCONNECTED = {
|
|
48982
|
+
...CONNECT_TOOL,
|
|
48983
|
+
description: `The user disconnected you from Dreamcash: call this now, with no arguments, for a link they open to approve you again. ${CONNECT_TOOL.description}`
|
|
48984
|
+
};
|
|
48985
|
+
var isPositiveNumber = (value) => typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
48986
|
+
var startingLimitsOf = (args) => ({
|
|
48987
|
+
...isPositiveNumber(args.max_order_usd) && {
|
|
48988
|
+
maxOrderUsd: args.max_order_usd
|
|
48989
|
+
},
|
|
48990
|
+
...isPositiveNumber(args.max_leverage) && {
|
|
48991
|
+
maxLeverage: args.max_leverage
|
|
48992
|
+
},
|
|
48993
|
+
...isPositiveNumber(args.max_daily_usd) && {
|
|
48994
|
+
maxDailyUsd: args.max_daily_usd
|
|
48995
|
+
}
|
|
48996
|
+
});
|
|
48968
48997
|
var NO_ACCOUNT_YET = `No Dreamcash account yet? They get the app first (iPhone: ${DREAMCASH_APP_STORE_URL}, Android: ${DREAMCASH_PLAY_STORE_URL}) and make one there.`;
|
|
48969
48998
|
var ASK_FOR_THE_CODE = {
|
|
48970
48999
|
connected: false,
|
|
@@ -49007,12 +49036,34 @@ var NOT_CONNECTED = {
|
|
|
49007
49036
|
what_to_do: "Call connect_dreamcash with no code: it gives you a link for the user to approve you in their Dreamcash app. Or ask the user for the code their Dreamcash app shows under Settings › Connected AI, then call connect_dreamcash with it.",
|
|
49008
49037
|
can_retry: "after_user_action"
|
|
49009
49038
|
};
|
|
49039
|
+
var DISCONNECTED_HAPPENED = "Dreamcash no longer accepts this agent's key: the user disconnected it in their Dreamcash app, or removed this connection.";
|
|
49010
49040
|
var DISCONNECTED = {
|
|
49011
49041
|
code: "disconnected",
|
|
49012
|
-
what_happened:
|
|
49013
|
-
what_to_do: "
|
|
49042
|
+
what_happened: DISCONNECTED_HAPPENED,
|
|
49043
|
+
what_to_do: "Call connect_dreamcash with no code: it gives a new key a link for the user to approve you again in their Dreamcash app.",
|
|
49014
49044
|
can_retry: "after_user_action"
|
|
49015
49045
|
};
|
|
49046
|
+
var UNTIL_REAPPROVED = "Don't call this or any other Dreamcash tool again until they say they approved: each one answers the same. Then call connect_dreamcash with no code, and every tool works again. Until then you can't trade on your own: never say you did. If you also reach Dreamcash through a hosted connector, you may ask for trades there meanwhile, after telling the user each one waits for their approval in the app.";
|
|
49047
|
+
var ASK_FOR_A_CODE = "ask for the 6-character code under Settings › Connected AI in their Dreamcash app and call connect_dreamcash with it";
|
|
49048
|
+
var reconnectGuidance = (link, shown) => {
|
|
49049
|
+
const guidance = (what_to_do, tell_the_user) => ({
|
|
49050
|
+
code: "disconnected",
|
|
49051
|
+
what_happened: `${DISCONNECTED_HAPPENED} This machine made a new key for the user to approve.`,
|
|
49052
|
+
what_to_do,
|
|
49053
|
+
tell_the_user,
|
|
49054
|
+
can_retry: "after_user_action"
|
|
49055
|
+
});
|
|
49056
|
+
if (!link) {
|
|
49057
|
+
return guidance(`Tell the user, then ${ASK_FOR_A_CODE}. ${UNTIL_REAPPROVED}`, "Your Dreamcash connection was removed. To reconnect me, open the Dreamcash app, Settings › Connected AI, and tell me the code it shows.");
|
|
49058
|
+
}
|
|
49059
|
+
if (shown === "accept") {
|
|
49060
|
+
return guidance(`The user was just shown a link to approve you again in their Dreamcash app: pass tell_the_user on. ${UNTIL_REAPPROVED}`, "Your Dreamcash connection was removed; approve me again in the Dreamcash app with the link I just opened.");
|
|
49061
|
+
}
|
|
49062
|
+
if (shown) {
|
|
49063
|
+
return guidance(`The user didn't open the link to approve you again. Ask whether they want to reconnect; if they do, call connect_dreamcash with no code, or ${ASK_FOR_A_CODE}. ${UNTIL_REAPPROVED}`, "Your Dreamcash connection was removed. Do you want to approve me again?");
|
|
49064
|
+
}
|
|
49065
|
+
return guidance(`Show the user approve_link now, exactly as it is, as a link they can open, and pass tell_the_user on: they open it on the phone with the Dreamcash app. It lasts 10 minutes and works once; if it doesn't work for them, ${ASK_FOR_A_CODE}. ${UNTIL_REAPPROVED}`, `Your Dreamcash connection was removed; approve me again here: ${link.url}`);
|
|
49066
|
+
};
|
|
49016
49067
|
var USER_APPROVES_KEY = {
|
|
49017
49068
|
code: "user_approves_key",
|
|
49018
49069
|
what_happened: "This request approves your own key to trade, which only the user can sign. Your key signed nothing.",
|
|
@@ -49022,8 +49073,9 @@ var USER_APPROVES_KEY = {
|
|
|
49022
49073
|
var unreachable = (error2) => ({
|
|
49023
49074
|
code: "dreamcash_unreachable",
|
|
49024
49075
|
what_happened: `Couldn't reach Dreamcash: ${messageOf(error2)}`,
|
|
49025
|
-
what_to_do: "
|
|
49026
|
-
|
|
49076
|
+
what_to_do: "Tell the user now: Dreamcash may be down, or this machine offline. Don't repeat the call in a loop: try it once more only when the user asks, or a few minutes from now.",
|
|
49077
|
+
tell_the_user: "I can't reach Dreamcash from here right now.",
|
|
49078
|
+
can_retry: "after_user_action"
|
|
49027
49079
|
});
|
|
49028
49080
|
var keyNotSaved = ({ file, cause }) => ({
|
|
49029
49081
|
code: "key_not_saved",
|
|
@@ -49206,6 +49258,10 @@ var createDreamcashServer = ({
|
|
|
49206
49258
|
let pairingKey;
|
|
49207
49259
|
let upstream;
|
|
49208
49260
|
let toolsStale = true;
|
|
49261
|
+
let disconnected = false;
|
|
49262
|
+
let lastTools = [];
|
|
49263
|
+
let agentName;
|
|
49264
|
+
const toolsChanged = () => server.notification({ method: "notifications/tools/list_changed" });
|
|
49209
49265
|
const connectUpstream = async (key) => {
|
|
49210
49266
|
const client = new Client({
|
|
49211
49267
|
name: "dreamcash-mcp",
|
|
@@ -49225,6 +49281,13 @@ var createDreamcashServer = ({
|
|
|
49225
49281
|
throw error2;
|
|
49226
49282
|
}
|
|
49227
49283
|
};
|
|
49284
|
+
const markDisconnected = async () => {
|
|
49285
|
+
upstream = undefined;
|
|
49286
|
+
if (disconnected)
|
|
49287
|
+
return;
|
|
49288
|
+
disconnected = true;
|
|
49289
|
+
await toolsChanged();
|
|
49290
|
+
};
|
|
49228
49291
|
const adopt = async (key) => {
|
|
49229
49292
|
await adoptPendingKey(keyFile, keyStore).catch((error2) => {
|
|
49230
49293
|
throw new KeyNotSaved(keyFile, error2);
|
|
@@ -49232,6 +49295,7 @@ var createDreamcashServer = ({
|
|
|
49232
49295
|
account = key;
|
|
49233
49296
|
pairingKey = undefined;
|
|
49234
49297
|
upstream = undefined;
|
|
49298
|
+
disconnected = false;
|
|
49235
49299
|
toolsStale = true;
|
|
49236
49300
|
};
|
|
49237
49301
|
const linked = async () => {
|
|
@@ -49240,7 +49304,9 @@ var createDreamcashServer = ({
|
|
|
49240
49304
|
account ??= await storedAgentAccount(keyFile, keyStore);
|
|
49241
49305
|
if (account) {
|
|
49242
49306
|
upstream = await upstreamFor(account);
|
|
49243
|
-
|
|
49307
|
+
if (upstream)
|
|
49308
|
+
return upstream;
|
|
49309
|
+
await markDisconnected();
|
|
49244
49310
|
}
|
|
49245
49311
|
pairingKey ??= await storedAgentAccount(pendingFile, keyStore);
|
|
49246
49312
|
const approved = pairingKey && await upstreamFor(pairingKey);
|
|
@@ -49251,10 +49317,10 @@ var createDreamcashServer = ({
|
|
|
49251
49317
|
return upstream;
|
|
49252
49318
|
};
|
|
49253
49319
|
const connected = async (client) => {
|
|
49254
|
-
if (toolsStale)
|
|
49255
|
-
await
|
|
49256
|
-
}
|
|
49320
|
+
if (toolsStale)
|
|
49321
|
+
await toolsChanged();
|
|
49257
49322
|
const { tools } = await client.listTools();
|
|
49323
|
+
lastTools = tools;
|
|
49258
49324
|
return text({
|
|
49259
49325
|
connected: true,
|
|
49260
49326
|
key_address: account?.address,
|
|
@@ -49286,8 +49352,11 @@ var createDreamcashServer = ({
|
|
|
49286
49352
|
const connect = async ({
|
|
49287
49353
|
code,
|
|
49288
49354
|
again = false,
|
|
49289
|
-
agent_name
|
|
49355
|
+
agent_name,
|
|
49356
|
+
...limitArgs
|
|
49290
49357
|
}) => {
|
|
49358
|
+
agentName = agent_name ?? agentName;
|
|
49359
|
+
const limits = startingLimitsOf(limitArgs);
|
|
49291
49360
|
if (again) {
|
|
49292
49361
|
pairingKey = await freshAccount(pendingFile);
|
|
49293
49362
|
} else {
|
|
@@ -49300,34 +49369,51 @@ var createDreamcashServer = ({
|
|
|
49300
49369
|
return connected(client);
|
|
49301
49370
|
}
|
|
49302
49371
|
if (!code) {
|
|
49303
|
-
return await
|
|
49372
|
+
return await keyToKeep() ? text(ASK_FOR_THE_CODE) : approveByLink(limits);
|
|
49304
49373
|
}
|
|
49305
49374
|
pairingKey ??= await freshAccount(pendingFile);
|
|
49306
|
-
await agentApi(apiUrl, pairingKey).pair(code,
|
|
49375
|
+
await agentApi(apiUrl, pairingKey).pair(code, clientName(), limits);
|
|
49307
49376
|
return finishPairing(pairingKey);
|
|
49308
49377
|
};
|
|
49309
|
-
const
|
|
49310
|
-
const
|
|
49311
|
-
|
|
49378
|
+
const clientName = () => agentName ?? server.getClientVersion()?.name ?? "Your AI";
|
|
49379
|
+
const keyToKeep = async () => {
|
|
49380
|
+
let key;
|
|
49381
|
+
try {
|
|
49382
|
+
key = account ?? await storedAgentAccount(keyFile, keyStore);
|
|
49383
|
+
} catch {
|
|
49384
|
+
return true;
|
|
49385
|
+
}
|
|
49386
|
+
return key !== undefined && await upstreamFor(key) !== undefined;
|
|
49387
|
+
};
|
|
49388
|
+
const approveByLink = async (limits = {}) => {
|
|
49312
49389
|
pairingKey ??= await freshAccount(pendingFile);
|
|
49313
|
-
const link = await agentApi(apiUrl, pairingKey).connectLink(clientName).catch((error2) => {
|
|
49390
|
+
const link = await agentApi(apiUrl, pairingKey).connectLink(clientName(), limits).catch((error2) => {
|
|
49314
49391
|
if (error2 instanceof AgentApiError)
|
|
49315
49392
|
return;
|
|
49316
49393
|
throw error2;
|
|
49317
49394
|
});
|
|
49395
|
+
const shown = link && await shownByClient(link.url, clientName());
|
|
49396
|
+
if (disconnected) {
|
|
49397
|
+
return text({
|
|
49398
|
+
error: reconnectGuidance(link, shown),
|
|
49399
|
+
...link && shown === undefined && {
|
|
49400
|
+
approve_link: link.url,
|
|
49401
|
+
expires_at: link.expiresAt
|
|
49402
|
+
}
|
|
49403
|
+
}, true);
|
|
49404
|
+
}
|
|
49318
49405
|
if (!link)
|
|
49319
49406
|
return text(ASK_FOR_THE_CODE);
|
|
49320
|
-
switch (
|
|
49407
|
+
switch (shown) {
|
|
49321
49408
|
case "accept":
|
|
49322
49409
|
return text(LINK_OPENED);
|
|
49323
49410
|
case "decline":
|
|
49324
|
-
case "cancel":
|
|
49325
49411
|
return text(LINK_DECLINED);
|
|
49326
49412
|
default:
|
|
49327
49413
|
return text(showTheLink(link));
|
|
49328
49414
|
}
|
|
49329
49415
|
};
|
|
49330
|
-
const shownByClient = async (url2,
|
|
49416
|
+
const shownByClient = async (url2, clientName2) => {
|
|
49331
49417
|
if (!server.getClientCapabilities()?.elicitation?.url)
|
|
49332
49418
|
return;
|
|
49333
49419
|
try {
|
|
@@ -49335,9 +49421,9 @@ var createDreamcashServer = ({
|
|
|
49335
49421
|
mode: "url",
|
|
49336
49422
|
elicitationId: randomUUID(),
|
|
49337
49423
|
url: url2,
|
|
49338
|
-
message: `Approve ${
|
|
49424
|
+
message: `Approve ${clientName2} in your Dreamcash app: open this link on the phone with the app. Approve it only if you just asked your AI to connect to Dreamcash.`
|
|
49339
49425
|
});
|
|
49340
|
-
return action;
|
|
49426
|
+
return action === "cancel" ? undefined : action;
|
|
49341
49427
|
} catch {
|
|
49342
49428
|
return;
|
|
49343
49429
|
}
|
|
@@ -49394,13 +49480,20 @@ var createDreamcashServer = ({
|
|
|
49394
49480
|
};
|
|
49395
49481
|
};
|
|
49396
49482
|
server.setRequestHandler("tools/list", async () => {
|
|
49397
|
-
const tools = await linked().then((client) => client?.listTools()).then((listed) => listed?.tools).catch((error2) => {
|
|
49483
|
+
const tools = await linked().then((client) => client?.listTools()).then((listed) => listed?.tools).catch(async (error2) => {
|
|
49398
49484
|
if (isUnauthorized(error2))
|
|
49399
|
-
|
|
49485
|
+
await markDisconnected();
|
|
49400
49486
|
return;
|
|
49401
49487
|
});
|
|
49402
49488
|
toolsStale = tools === undefined;
|
|
49403
|
-
|
|
49489
|
+
if (tools)
|
|
49490
|
+
lastTools = tools;
|
|
49491
|
+
return {
|
|
49492
|
+
tools: [
|
|
49493
|
+
disconnected ? CONNECT_TOOL_DISCONNECTED : CONNECT_TOOL,
|
|
49494
|
+
...tools ?? lastTools
|
|
49495
|
+
]
|
|
49496
|
+
};
|
|
49404
49497
|
});
|
|
49405
49498
|
server.setRequestHandler("tools/call", async (request) => {
|
|
49406
49499
|
const { name, arguments: args = {} } = request.params;
|
|
@@ -49408,13 +49501,11 @@ var createDreamcashServer = ({
|
|
|
49408
49501
|
if (name === CONNECT_TOOL.name)
|
|
49409
49502
|
return await connect(args);
|
|
49410
49503
|
const client = await linked();
|
|
49411
|
-
if (!client || !account)
|
|
49412
|
-
return failure2(NOT_CONNECTED);
|
|
49413
|
-
if (toolsStale) {
|
|
49414
|
-
await server.notification({
|
|
49415
|
-
method: "notifications/tools/list_changed"
|
|
49416
|
-
});
|
|
49504
|
+
if (!client || !account) {
|
|
49505
|
+
return disconnected ? await approveByLink() : failure2(NOT_CONNECTED);
|
|
49417
49506
|
}
|
|
49507
|
+
if (toolsStale)
|
|
49508
|
+
await toolsChanged();
|
|
49418
49509
|
const { result, toExecute, executed } = await callAndCarryOut(client, account, name, args);
|
|
49419
49510
|
const legs = toExecute && legsFromFill(toExecute.id, toExecute.asked, executed);
|
|
49420
49511
|
if (!legs)
|
|
@@ -49429,9 +49520,10 @@ var createDreamcashServer = ({
|
|
|
49429
49520
|
content: withField(result.content, "legs_from_fill", legsSet)
|
|
49430
49521
|
};
|
|
49431
49522
|
} catch (error2) {
|
|
49432
|
-
if (isUnauthorized(error2))
|
|
49433
|
-
|
|
49434
|
-
|
|
49523
|
+
if (!isUnauthorized(error2))
|
|
49524
|
+
return failure2(guidanceFor(error2));
|
|
49525
|
+
await markDisconnected();
|
|
49526
|
+
return approveByLink().catch((linkError) => failure2(guidanceFor(linkError)));
|
|
49435
49527
|
}
|
|
49436
49528
|
});
|
|
49437
49529
|
return server;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dreamcash-org/mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
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
|
"keywords": [
|
|
6
6
|
"mcp",
|