@dreamcash-org/mcp 0.1.1 → 0.1.2

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 CHANGED
@@ -7,8 +7,9 @@ account and markets, and trade: **each trade confirmed by you in your own
7
7
  wallet, 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 `https://api.dreamcash.xyz/mcp` as
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. Each trade
12
+ > then waits for you; trading on its own needs this package.
12
13
 
13
14
  ## What your agent can do
14
15
 
@@ -73,9 +74,16 @@ command = "npx"
73
74
  args = ["-y", "@dreamcash-org/mcp"]
74
75
  ```
75
76
 
77
+ **Gemini for Mac**: Customize › Connectors › Add custom app › Local MCP, with
78
+ the command `npx -y @dreamcash-org/mcp`.
79
+
76
80
  **Agents that set up their own tools** (Grok Bot, Hermes, OpenClaw): ask
77
81
  the agent to add a local MCP server that runs `npx -y @dreamcash-org/mcp`.
78
82
 
83
+ Desktop apps often start servers without your terminal's `PATH`: if `npx`
84
+ isn't found, use its full path, which `which npx` prints in your terminal
85
+ (e.g. `/opt/homebrew/bin/npx`).
86
+
79
87
  ## Connect your account
80
88
 
81
89
  1. Ask your agent to connect to Dreamcash. It gives you a link and a short
@@ -122,7 +130,8 @@ the agent to add a local MCP server that runs `npx -y @dreamcash-org/mcp`.
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
- | `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. Deleting a paired key file disconnects this machine. |
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. |
127
136
  | `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
137
 
@@ -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.1.1",
21459
+ version: "0.1.2",
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: [
@@ -48865,21 +48865,24 @@ var createDreamcashServer = ({
48865
48865
  }));
48866
48866
  return client;
48867
48867
  };
48868
- const linked = async () => {
48869
- if (upstream)
48870
- return upstream;
48871
- account ??= await storedAgentAccount(keyFile);
48872
- if (!account)
48873
- return;
48868
+ const upstreamFor = async (key) => {
48874
48869
  try {
48875
- upstream = await connectUpstream(account);
48876
- return upstream;
48870
+ return await connectUpstream(key);
48877
48871
  } catch (error2) {
48878
48872
  if (isUnauthorized(error2))
48879
48873
  return;
48880
48874
  throw error2;
48881
48875
  }
48882
48876
  };
48877
+ const linked = async () => {
48878
+ if (upstream)
48879
+ return upstream;
48880
+ account ??= await storedAgentAccount(keyFile);
48881
+ if (!account)
48882
+ return;
48883
+ upstream = await upstreamFor(account);
48884
+ return upstream;
48885
+ };
48883
48886
  const connected = async (client, tradeRequestId) => {
48884
48887
  shownCode = undefined;
48885
48888
  if (toolsStale) {
@@ -48898,27 +48901,58 @@ var createDreamcashServer = ({
48898
48901
  });
48899
48902
  };
48900
48903
  const freshAccount = async (file) => {
48904
+ shownCode = undefined;
48901
48905
  try {
48902
48906
  return await newAgentAccount(file);
48903
48907
  } catch (error2) {
48904
48908
  throw new KeyNotSaved(file, error2);
48905
48909
  }
48906
48910
  };
48911
+ const finishPairing = async (key, tradeRequestId) => {
48912
+ await adoptPendingKey(keyFile).catch((error2) => {
48913
+ throw new KeyNotSaved(keyFile, error2);
48914
+ });
48915
+ account = key;
48916
+ pairingKey = undefined;
48917
+ upstream = undefined;
48918
+ toolsStale = true;
48919
+ const client = await linked();
48920
+ if (!client) {
48921
+ return failure2({
48922
+ code: "pairing_not_accepted",
48923
+ what_happened: "The user approved the code, but Dreamcash doesn't accept this agent's key.",
48924
+ what_to_do: "Call connect_dreamcash with again: true and give the user the new code.",
48925
+ can_retry: "after_user_action"
48926
+ });
48927
+ }
48928
+ return connected(client, tradeRequestId);
48929
+ };
48907
48930
  const connect = async ({
48908
48931
  again = false,
48909
48932
  agent_name
48910
48933
  }) => {
48911
- pairingKey ??= await storedAgentAccount(pendingFile);
48912
48934
  if (again) {
48913
48935
  pairingKey = await freshAccount(pendingFile);
48914
48936
  } else if (!pairingKey) {
48915
- const client2 = await linked();
48916
- if (client2)
48917
- return connected(client2);
48937
+ pairingKey = await storedAgentAccount(pendingFile);
48938
+ if (pairingKey && await upstreamFor(pairingKey)) {
48939
+ return finishPairing(pairingKey);
48940
+ }
48941
+ }
48942
+ if (!pairingKey) {
48943
+ const client = await linked();
48944
+ if (client)
48945
+ return connected(client);
48918
48946
  pairingKey = await freshAccount(pendingFile);
48919
48947
  }
48920
48948
  const key = pairingKey;
48921
48949
  const api2 = agentApi(apiUrl, key);
48950
+ if (shownCode) {
48951
+ const shown = await api2.pairingStatus(shownCode);
48952
+ if (shown.status === "approved") {
48953
+ return finishPairing(key, shown.tradeRequestId);
48954
+ }
48955
+ }
48922
48956
  const clientName = agent_name ?? server.getClientVersion()?.name ?? "Your AI";
48923
48957
  const pairing = await api2.createPairing(clientName);
48924
48958
  const pairingStep = {
@@ -48950,23 +48984,7 @@ var createDreamcashServer = ({
48950
48984
  next_step: "The new key wasn't paired. Call connect_dreamcash again if the user wants to connect."
48951
48985
  });
48952
48986
  }
48953
- await adoptPendingKey(keyFile).catch((error2) => {
48954
- throw new KeyNotSaved(keyFile, error2);
48955
- });
48956
- account = key;
48957
- pairingKey = undefined;
48958
- upstream = undefined;
48959
- toolsStale = true;
48960
- const client = await linked();
48961
- if (!client) {
48962
- return failure2({
48963
- code: "pairing_not_accepted",
48964
- what_happened: "The user approved the code, but Dreamcash doesn't accept this agent's key.",
48965
- what_to_do: "Call connect_dreamcash with again: true and give the user the new code.",
48966
- can_retry: "after_user_action"
48967
- });
48968
- }
48969
- return connected(client, status.tradeRequestId);
48987
+ return finishPairing(key, status.tradeRequestId);
48970
48988
  };
48971
48989
  const executeWithKey = async (id, asked, key) => {
48972
48990
  const { info, exchangeSignedBy } = createTradeRequestClients();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamcash-org/mcp",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
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": [