@1claw/mcp 0.1.0 → 0.2.5
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/LICENSE +133 -0
- package/README.md +51 -50
- package/dist/client.d.ts +41 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +63 -4
- package/dist/client.js.map +1 -1
- package/dist/index.js +29 -7
- package/dist/index.js.map +1 -1
- package/dist/tools/share_secret.d.ts +4 -4
- package/dist/tools/share_secret.d.ts.map +1 -1
- package/dist/tools/share_secret.js +13 -8
- package/dist/tools/share_secret.js.map +1 -1
- package/dist/tools/simulate_transaction.d.ts +41 -0
- package/dist/tools/simulate_transaction.d.ts.map +1 -0
- package/dist/tools/simulate_transaction.js +61 -0
- package/dist/tools/simulate_transaction.js.map +1 -0
- package/dist/tools/submit_transaction.d.ts +61 -0
- package/dist/tools/submit_transaction.d.ts.map +1 -0
- package/dist/tools/submit_transaction.js +58 -0
- package/dist/tools/submit_transaction.js.map +1 -0
- package/dist/types.d.ts +40 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +46 -46
package/LICENSE
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# PolyForm Noncommercial License 1.0.0
|
|
2
|
+
|
|
3
|
+
<https://polyformproject.org/licenses/noncommercial/1.0.0>
|
|
4
|
+
|
|
5
|
+
Required Notice: Copyright (c) 2026 1Claw Contributors
|
|
6
|
+
|
|
7
|
+
## Acceptance
|
|
8
|
+
|
|
9
|
+
In order to get any license under these terms, you must agree
|
|
10
|
+
to them as both strict obligations and conditions to all
|
|
11
|
+
your licenses.
|
|
12
|
+
|
|
13
|
+
## Copyright License
|
|
14
|
+
|
|
15
|
+
The licensor grants you a copyright license for the
|
|
16
|
+
software to do everything you might do with the software
|
|
17
|
+
that would otherwise infringe the licensor's copyright
|
|
18
|
+
in it for any permitted purpose. However, you may
|
|
19
|
+
only distribute the software according to [Distribution
|
|
20
|
+
License](#distribution-license) and make changes or new works
|
|
21
|
+
based on the software according to [Changes and New Works
|
|
22
|
+
License](#changes-and-new-works-license).
|
|
23
|
+
|
|
24
|
+
## Distribution License
|
|
25
|
+
|
|
26
|
+
The licensor grants you an additional copyright license
|
|
27
|
+
to distribute copies of the software. Your license
|
|
28
|
+
to distribute covers distributing the software with
|
|
29
|
+
changes and new works permitted by [Changes and New Works
|
|
30
|
+
License](#changes-and-new-works-license).
|
|
31
|
+
|
|
32
|
+
## Notices
|
|
33
|
+
|
|
34
|
+
You must ensure that anyone who gets a copy of any part of
|
|
35
|
+
the software from you also gets a copy of these terms or the
|
|
36
|
+
URL for them above, as well as copies of any plain-text lines
|
|
37
|
+
beginning with `Required Notice:` that the licensor provided
|
|
38
|
+
with the software. For example:
|
|
39
|
+
|
|
40
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
41
|
+
|
|
42
|
+
## Changes and New Works License
|
|
43
|
+
|
|
44
|
+
The licensor grants you an additional copyright license to
|
|
45
|
+
make changes and new works based on the software for any
|
|
46
|
+
permitted purpose.
|
|
47
|
+
|
|
48
|
+
## Patent License
|
|
49
|
+
|
|
50
|
+
The licensor grants you a patent license for the software that
|
|
51
|
+
covers patent claims the licensor can license, or becomes able
|
|
52
|
+
to license, that you would infringe by using the software.
|
|
53
|
+
|
|
54
|
+
## Noncommercial Purposes
|
|
55
|
+
|
|
56
|
+
Any noncommercial purpose is a permitted purpose.
|
|
57
|
+
|
|
58
|
+
## Personal Uses
|
|
59
|
+
|
|
60
|
+
Personal use for research, experiment, and testing for
|
|
61
|
+
the benefit of public knowledge, personal study, private
|
|
62
|
+
entertainment, hobby projects, amateur pursuits, or religious
|
|
63
|
+
observance, without any anticipated commercial application,
|
|
64
|
+
is use for a permitted purpose.
|
|
65
|
+
|
|
66
|
+
## Noncommercial Organizations
|
|
67
|
+
|
|
68
|
+
Use by any charitable organization, educational institution,
|
|
69
|
+
public research organization, public safety or health
|
|
70
|
+
organization, environmental protection organization,
|
|
71
|
+
or government institution is use for a permitted purpose
|
|
72
|
+
regardless of the source of funding or obligations resulting
|
|
73
|
+
from the funding.
|
|
74
|
+
|
|
75
|
+
## Fair Use
|
|
76
|
+
|
|
77
|
+
You may have "fair use" rights for the software under the
|
|
78
|
+
law. These terms do not limit them.
|
|
79
|
+
|
|
80
|
+
## No Other Rights
|
|
81
|
+
|
|
82
|
+
These terms do not allow you to sublicense or transfer any of
|
|
83
|
+
your licenses to anyone else, or prevent the licensor from
|
|
84
|
+
granting licenses to anyone else. These terms do not imply
|
|
85
|
+
any other licenses.
|
|
86
|
+
|
|
87
|
+
## Patent Defense
|
|
88
|
+
|
|
89
|
+
If you make any written claim that the software infringes or
|
|
90
|
+
contributes to infringement of any patent, your patent license
|
|
91
|
+
for the software granted under these terms ends immediately. If
|
|
92
|
+
your company makes such a claim, your patent license ends
|
|
93
|
+
immediately for work on behalf of your company.
|
|
94
|
+
|
|
95
|
+
## Violations
|
|
96
|
+
|
|
97
|
+
The first time you are notified in writing that you have
|
|
98
|
+
violated any of these terms, or done anything with the software
|
|
99
|
+
not covered by your licenses, your licenses can nonetheless
|
|
100
|
+
continue if you come into full compliance with these terms,
|
|
101
|
+
and take practical steps to correct past violations, within
|
|
102
|
+
32 days of receiving notice. Otherwise, all your licenses
|
|
103
|
+
end immediately.
|
|
104
|
+
|
|
105
|
+
## No Liability
|
|
106
|
+
|
|
107
|
+
***As far as the law allows, the software comes as is, without
|
|
108
|
+
any warranty or condition, and the licensor will not be liable
|
|
109
|
+
to you for any damages arising out of these terms or the use
|
|
110
|
+
or nature of the software, under any kind of legal claim.***
|
|
111
|
+
|
|
112
|
+
## Definitions
|
|
113
|
+
|
|
114
|
+
The **licensor** is the individual or entity offering these
|
|
115
|
+
terms, and the **software** is the software the licensor makes
|
|
116
|
+
available under these terms.
|
|
117
|
+
|
|
118
|
+
**You** refers to the individual or entity agreeing to these
|
|
119
|
+
terms.
|
|
120
|
+
|
|
121
|
+
**Your company** is any legal entity, sole proprietorship,
|
|
122
|
+
or other kind of organization that you work for, plus all
|
|
123
|
+
organizations that have control over, are under the control of,
|
|
124
|
+
or are under common control with that organization. **Control**
|
|
125
|
+
means ownership of substantially all the assets of an entity,
|
|
126
|
+
or the power to direct its management and policies by vote,
|
|
127
|
+
contract, or otherwise. Control can be direct or indirect.
|
|
128
|
+
|
|
129
|
+
**Your licenses** are all the licenses granted to you for the
|
|
130
|
+
software under these terms.
|
|
131
|
+
|
|
132
|
+
**Use** means anything you do with the software requiring one
|
|
133
|
+
of your licenses.
|
package/README.md
CHANGED
|
@@ -6,10 +6,10 @@ An MCP (Model Context Protocol) server that gives AI agents secure, just-in-time
|
|
|
6
6
|
|
|
7
7
|
The server supports two transport modes:
|
|
8
8
|
|
|
9
|
-
| Mode
|
|
10
|
-
|
|
9
|
+
| Mode | Use case | Auth |
|
|
10
|
+
| ------------------- | ------------------------------ | --------------------------------------------------- |
|
|
11
11
|
| **stdio** (default) | Local — Claude Desktop, Cursor | Env vars: `ONECLAW_AGENT_TOKEN`, `ONECLAW_VAULT_ID` |
|
|
12
|
-
| **httpStream**
|
|
12
|
+
| **httpStream** | Hosted at `mcp.1claw.xyz` | Per-request headers: `Authorization`, `X-Vault-ID` |
|
|
13
13
|
|
|
14
14
|
Set `MCP_TRANSPORT=httpStream` and `PORT=8080` to run in hosted mode.
|
|
15
15
|
|
|
@@ -23,33 +23,34 @@ pnpm run build
|
|
|
23
23
|
|
|
24
24
|
## Environment Variables
|
|
25
25
|
|
|
26
|
-
| Variable
|
|
27
|
-
|
|
28
|
-
| `ONECLAW_AGENT_TOKEN` | stdio only | —
|
|
29
|
-
| `ONECLAW_VAULT_ID`
|
|
30
|
-
| `ONECLAW_BASE_URL`
|
|
31
|
-
| `MCP_TRANSPORT`
|
|
32
|
-
| `PORT`
|
|
26
|
+
| Variable | Required | Default | Description |
|
|
27
|
+
| --------------------- | ---------- | ----------------------- | --------------------------------------- |
|
|
28
|
+
| `ONECLAW_AGENT_TOKEN` | stdio only | — | Bearer token for the 1claw Agent API |
|
|
29
|
+
| `ONECLAW_VAULT_ID` | stdio only | — | UUID of the vault to operate on |
|
|
30
|
+
| `ONECLAW_BASE_URL` | No | `https://api.1claw.xyz` | API base URL (override for self-hosted) |
|
|
31
|
+
| `MCP_TRANSPORT` | No | `stdio` | Transport mode: `stdio` or `httpStream` |
|
|
32
|
+
| `PORT` | No | `8080` | HTTP port (httpStream mode only) |
|
|
33
33
|
|
|
34
34
|
## Tools
|
|
35
35
|
|
|
36
|
-
| Tool
|
|
37
|
-
|
|
38
|
-
| `list_secrets`
|
|
39
|
-
| `get_secret`
|
|
40
|
-
| `put_secret`
|
|
41
|
-
| `delete_secret`
|
|
42
|
-
| `describe_secret`
|
|
43
|
-
| `rotate_and_store` | Store a new value for an existing secret and return the version
|
|
44
|
-
| `get_env_bundle`
|
|
45
|
-
| `create_vault`
|
|
46
|
-
| `list_vaults`
|
|
47
|
-
| `grant_access`
|
|
36
|
+
| Tool | Description |
|
|
37
|
+
| ------------------ | ---------------------------------------------------------------------------- |
|
|
38
|
+
| `list_secrets` | List all secrets (metadata only — never values) |
|
|
39
|
+
| `get_secret` | Fetch the decrypted value of a secret by path |
|
|
40
|
+
| `put_secret` | Create or update a secret (creates a new version) |
|
|
41
|
+
| `delete_secret` | Soft-delete a secret at a path |
|
|
42
|
+
| `describe_secret` | Get metadata without fetching the value |
|
|
43
|
+
| `rotate_and_store` | Store a new value for an existing secret and return the version |
|
|
44
|
+
| `get_env_bundle` | Fetch an env_bundle secret and parse it as KEY=VALUE JSON |
|
|
45
|
+
| `create_vault` | Create a new vault (auto-shared with the agent's human creator) |
|
|
46
|
+
| `list_vaults` | List all vaults the agent can access (own + shared) |
|
|
47
|
+
| `grant_access` | Share a vault with a user or agent (own vaults only) |
|
|
48
|
+
| `share_secret` | Share a secret with your creator, a user/agent by ID, or create an open link |
|
|
48
49
|
|
|
49
50
|
## Resources
|
|
50
51
|
|
|
51
|
-
| URI
|
|
52
|
-
|
|
52
|
+
| URI | Description |
|
|
53
|
+
| ----------------- | ----------------------------------------------------- |
|
|
53
54
|
| `vault://secrets` | Browsable listing of all secret paths (metadata only) |
|
|
54
55
|
|
|
55
56
|
## Configuration
|
|
@@ -60,15 +61,15 @@ For MCP clients that support remote servers with HTTP streaming:
|
|
|
60
61
|
|
|
61
62
|
```json
|
|
62
63
|
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
"mcpServers": {
|
|
65
|
+
"1claw": {
|
|
66
|
+
"url": "https://mcp.1claw.xyz/mcp",
|
|
67
|
+
"headers": {
|
|
68
|
+
"Authorization": "Bearer <your-agent-token>",
|
|
69
|
+
"X-Vault-ID": "<your-vault-id>"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
70
72
|
}
|
|
71
|
-
}
|
|
72
73
|
}
|
|
73
74
|
```
|
|
74
75
|
|
|
@@ -78,16 +79,16 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
|
78
79
|
|
|
79
80
|
```json
|
|
80
81
|
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
"mcpServers": {
|
|
83
|
+
"1claw": {
|
|
84
|
+
"command": "node",
|
|
85
|
+
"args": ["/absolute/path/to/packages/mcp/dist/index.js"],
|
|
86
|
+
"env": {
|
|
87
|
+
"ONECLAW_AGENT_TOKEN": "your-agent-token-here",
|
|
88
|
+
"ONECLAW_VAULT_ID": "your-vault-id-here"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
89
91
|
}
|
|
90
|
-
}
|
|
91
92
|
}
|
|
92
93
|
```
|
|
93
94
|
|
|
@@ -97,16 +98,16 @@ Add to `.cursor/mcp.json` in your project root:
|
|
|
97
98
|
|
|
98
99
|
```json
|
|
99
100
|
{
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
"mcpServers": {
|
|
102
|
+
"1claw": {
|
|
103
|
+
"command": "node",
|
|
104
|
+
"args": ["./packages/mcp/dist/index.js"],
|
|
105
|
+
"env": {
|
|
106
|
+
"ONECLAW_AGENT_TOKEN": "${env:ONECLAW_AGENT_TOKEN}",
|
|
107
|
+
"ONECLAW_VAULT_ID": "${env:ONECLAW_VAULT_ID}"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
108
110
|
}
|
|
109
|
-
}
|
|
110
111
|
}
|
|
111
112
|
```
|
|
112
113
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SecretMetadata, SecretWithValue, SecretListResponse, VaultResponse, VaultListResponse, PolicyResponse, ShareLinkResponse } from "./types.js";
|
|
1
|
+
import type { SecretMetadata, SecretWithValue, SecretListResponse, VaultResponse, VaultListResponse, PolicyResponse, ShareLinkResponse, SimulationResponse, BundleSimulationResponse, TransactionResponse } from "./types.js";
|
|
2
2
|
export declare class OneClawApiError extends Error {
|
|
3
3
|
status: number;
|
|
4
4
|
detail: string;
|
|
@@ -9,11 +9,20 @@ export interface ClientConfig {
|
|
|
9
9
|
token: string;
|
|
10
10
|
vaultId: string;
|
|
11
11
|
}
|
|
12
|
+
export interface AgentCredentials {
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
agentId: string;
|
|
15
|
+
apiKey: string;
|
|
16
|
+
vaultId: string;
|
|
17
|
+
}
|
|
12
18
|
export declare class OneClawClient {
|
|
13
19
|
private baseUrl;
|
|
14
20
|
private token;
|
|
15
21
|
private vaultId;
|
|
16
|
-
|
|
22
|
+
private agentCredentials?;
|
|
23
|
+
private tokenExpiresAt;
|
|
24
|
+
constructor(config: ClientConfig | AgentCredentials);
|
|
25
|
+
private ensureToken;
|
|
17
26
|
private headers;
|
|
18
27
|
private vaultUrl;
|
|
19
28
|
private request;
|
|
@@ -37,5 +46,35 @@ export declare class OneClawClient {
|
|
|
37
46
|
max_access_count?: number;
|
|
38
47
|
}): Promise<ShareLinkResponse>;
|
|
39
48
|
createPolicy(vaultId: string, principalType: string, principalId: string, permissions: string[], secretPathPattern?: string): Promise<PolicyResponse>;
|
|
49
|
+
get agentId(): string | undefined;
|
|
50
|
+
simulateTransaction(agentId: string, tx: {
|
|
51
|
+
to: string;
|
|
52
|
+
value: string;
|
|
53
|
+
chain: string;
|
|
54
|
+
data?: string;
|
|
55
|
+
signing_key_path?: string;
|
|
56
|
+
gas_limit?: number;
|
|
57
|
+
}): Promise<SimulationResponse>;
|
|
58
|
+
simulateBundle(agentId: string, transactions: Array<{
|
|
59
|
+
to: string;
|
|
60
|
+
value: string;
|
|
61
|
+
chain: string;
|
|
62
|
+
data?: string;
|
|
63
|
+
signing_key_path?: string;
|
|
64
|
+
gas_limit?: number;
|
|
65
|
+
}>): Promise<BundleSimulationResponse>;
|
|
66
|
+
submitTransaction(agentId: string, tx: {
|
|
67
|
+
to: string;
|
|
68
|
+
value: string;
|
|
69
|
+
chain: string;
|
|
70
|
+
data?: string;
|
|
71
|
+
signing_key_path?: string;
|
|
72
|
+
nonce?: number;
|
|
73
|
+
gas_price?: string;
|
|
74
|
+
gas_limit?: number;
|
|
75
|
+
max_fee_per_gas?: string;
|
|
76
|
+
max_priority_fee_per_gas?: string;
|
|
77
|
+
simulate_first?: boolean;
|
|
78
|
+
}): Promise<TransactionResponse>;
|
|
40
79
|
}
|
|
41
80
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,iBAAiB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,CAAC;IAO9B,iBAAiB,CACnB,OAAO,EAAE,MAAM,EACf,EAAE,EAAE;QACA,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,wBAAwB,CAAC,EAAE,MAAM,CAAC;QAClC,cAAc,CAAC,EAAE,OAAO,CAAC;KAC5B,GACF,OAAO,CAAC,mBAAmB,CAAC;CAMlC"}
|
package/dist/client.js
CHANGED
|
@@ -14,16 +14,58 @@ function encodePath(path) {
|
|
|
14
14
|
.map((s) => encodeURIComponent(s))
|
|
15
15
|
.join("/");
|
|
16
16
|
}
|
|
17
|
+
const REFRESH_BUFFER_MS = 60_000;
|
|
17
18
|
export class OneClawClient {
|
|
18
19
|
baseUrl;
|
|
19
20
|
token;
|
|
20
21
|
vaultId;
|
|
22
|
+
agentCredentials;
|
|
23
|
+
tokenExpiresAt = 0;
|
|
21
24
|
constructor(config) {
|
|
22
25
|
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
23
|
-
this.token = config.token;
|
|
24
26
|
this.vaultId = config.vaultId;
|
|
27
|
+
if ("agentId" in config) {
|
|
28
|
+
this.agentCredentials = {
|
|
29
|
+
agentId: config.agentId,
|
|
30
|
+
apiKey: config.apiKey,
|
|
31
|
+
};
|
|
32
|
+
this.token = "";
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this.token = config.token;
|
|
36
|
+
}
|
|
25
37
|
}
|
|
26
|
-
|
|
38
|
+
async ensureToken() {
|
|
39
|
+
if (!this.agentCredentials)
|
|
40
|
+
return;
|
|
41
|
+
if (this.token && Date.now() < this.tokenExpiresAt - REFRESH_BUFFER_MS)
|
|
42
|
+
return;
|
|
43
|
+
const res = await fetch(`${this.baseUrl}/v1/auth/agent-token`, {
|
|
44
|
+
method: "POST",
|
|
45
|
+
headers: { "Content-Type": "application/json" },
|
|
46
|
+
body: JSON.stringify({
|
|
47
|
+
agent_id: this.agentCredentials.agentId,
|
|
48
|
+
api_key: this.agentCredentials.apiKey,
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
51
|
+
if (!res.ok) {
|
|
52
|
+
let detail = `HTTP ${res.status}`;
|
|
53
|
+
try {
|
|
54
|
+
const body = (await res.json());
|
|
55
|
+
if (body.detail)
|
|
56
|
+
detail = body.detail;
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
/* use default */
|
|
60
|
+
}
|
|
61
|
+
throw new OneClawApiError(res.status, `Agent auth failed: ${detail}`);
|
|
62
|
+
}
|
|
63
|
+
const data = (await res.json());
|
|
64
|
+
this.token = data.access_token;
|
|
65
|
+
this.tokenExpiresAt = Date.now() + data.expires_in * 1000;
|
|
66
|
+
}
|
|
67
|
+
async headers() {
|
|
68
|
+
await this.ensureToken();
|
|
27
69
|
return {
|
|
28
70
|
Authorization: `Bearer ${this.token}`,
|
|
29
71
|
"Content-Type": "application/json",
|
|
@@ -33,9 +75,10 @@ export class OneClawClient {
|
|
|
33
75
|
return `${this.baseUrl}/v1/vaults/${this.vaultId}${suffix}`;
|
|
34
76
|
}
|
|
35
77
|
async request(url, init) {
|
|
78
|
+
const hdrs = await this.headers();
|
|
36
79
|
const res = await fetch(url, {
|
|
37
80
|
...init,
|
|
38
|
-
headers: { ...
|
|
81
|
+
headers: { ...hdrs, ...init?.headers },
|
|
39
82
|
});
|
|
40
83
|
if (!res.ok) {
|
|
41
84
|
if (res.status === 402) {
|
|
@@ -69,7 +112,10 @@ export class OneClawClient {
|
|
|
69
112
|
await this.request(this.vaultUrl(`/secrets/${encodePath(path)}`), { method: "DELETE" });
|
|
70
113
|
}
|
|
71
114
|
async createVault(name, description) {
|
|
72
|
-
return this.request(`${this.baseUrl}/v1/vaults`, {
|
|
115
|
+
return this.request(`${this.baseUrl}/v1/vaults`, {
|
|
116
|
+
method: "POST",
|
|
117
|
+
body: JSON.stringify({ name, description: description ?? "" }),
|
|
118
|
+
});
|
|
73
119
|
}
|
|
74
120
|
async listVaults() {
|
|
75
121
|
return this.request(`${this.baseUrl}/v1/vaults`);
|
|
@@ -88,5 +134,18 @@ export class OneClawClient {
|
|
|
88
134
|
}),
|
|
89
135
|
});
|
|
90
136
|
}
|
|
137
|
+
// ── Transaction Simulation & Submission ──────────────
|
|
138
|
+
get agentId() {
|
|
139
|
+
return this.agentCredentials?.agentId;
|
|
140
|
+
}
|
|
141
|
+
async simulateTransaction(agentId, tx) {
|
|
142
|
+
return this.request(`${this.baseUrl}/v1/agents/${agentId}/transactions/simulate`, { method: "POST", body: JSON.stringify(tx) });
|
|
143
|
+
}
|
|
144
|
+
async simulateBundle(agentId, transactions) {
|
|
145
|
+
return this.request(`${this.baseUrl}/v1/agents/${agentId}/transactions/simulate-bundle`, { method: "POST", body: JSON.stringify({ transactions }) });
|
|
146
|
+
}
|
|
147
|
+
async submitTransaction(agentId, tx) {
|
|
148
|
+
return this.request(`${this.baseUrl}/v1/agents/${agentId}/transactions`, { method: "POST", body: JSON.stringify(tx) });
|
|
149
|
+
}
|
|
91
150
|
}
|
|
92
151
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAcA,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAE3B;IACA;IAFX,YACW,MAAc,EACd,MAAc;QAErB,KAAK,CAAC,MAAM,CAAC,CAAC;QAHP,WAAM,GAAN,MAAM,CAAQ;QACd,WAAM,GAAN,MAAM,C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AI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACjB,mBAAmB,EAAE,iBAAiB;gBACtC,cAAc,EAAE,aAAa;gBAC7B,YAAY,EAAE,WAAW;gBACzB,WAAW;aACd,CAAC;SACL,CACJ,CAAC;IACN,CAAC;IAED,wDAAwD;IAExD,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,mBAAmB,CACrB,OAAe,EACf,EAOC;QAED,OAAO,IAAI,CAAC,OAAO,CACf,GAAG,IAAI,CAAC,OAAO,cAAc,OAAO,wBAAwB,EAC5D,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAC/C,CAAC;IACN,CAAC;IAED,KAAK,CAAC,cAAc,CAChB,OAAe,EACf,YAOE;QAEF,OAAO,IAAI,CAAC,OAAO,CACf,GAAG,IAAI,CAAC,OAAO,cAAc,OAAO,+BAA+B,EACnE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,CAC7D,CAAC;IACN,CAAC;IAED,KAAK,CAAC,iBAAiB,CACnB,OAAe,EACf,EAYC;QAED,OAAO,IAAI,CAAC,OAAO,CACf,GAAG,IAAI,CAAC,OAAO,cAAc,OAAO,eAAe,EACnD,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAC/C,CAAC;IACN,CAAC;CACJ"}
|
package/dist/index.js
CHANGED
|
@@ -11,27 +11,47 @@ import { createVaultTool } from "./tools/create_vault.js";
|
|
|
11
11
|
import { listVaultsTool } from "./tools/list_vaults.js";
|
|
12
12
|
import { grantAccessTool } from "./tools/grant_access.js";
|
|
13
13
|
import { shareSecretTool } from "./tools/share_secret.js";
|
|
14
|
+
import { simulateTransactionTool } from "./tools/simulate_transaction.js";
|
|
15
|
+
import { submitTransactionTool } from "./tools/submit_transaction.js";
|
|
14
16
|
const baseUrl = process.env.ONECLAW_BASE_URL ?? "https://api.1claw.xyz";
|
|
15
17
|
const transport = process.env.MCP_TRANSPORT ?? "stdio";
|
|
16
18
|
const port = parseInt(process.env.PORT ?? "8080", 10);
|
|
17
19
|
// ── Shared client (stdio mode) ──────────────────────
|
|
18
20
|
let sharedClient;
|
|
19
21
|
if (transport === "stdio") {
|
|
20
|
-
const token = process.env.ONECLAW_AGENT_TOKEN;
|
|
21
22
|
const vaultId = process.env.ONECLAW_VAULT_ID;
|
|
22
|
-
if (!token) {
|
|
23
|
-
console.error("ONECLAW_AGENT_TOKEN is required. Set it as an environment variable.");
|
|
24
|
-
process.exit(1);
|
|
25
|
-
}
|
|
26
23
|
if (!vaultId) {
|
|
27
24
|
console.error("ONECLAW_VAULT_ID is required. Set it as an environment variable.");
|
|
28
25
|
process.exit(1);
|
|
29
26
|
}
|
|
30
|
-
|
|
27
|
+
const agentId = process.env.ONECLAW_AGENT_ID;
|
|
28
|
+
const agentApiKey = process.env.ONECLAW_AGENT_API_KEY;
|
|
29
|
+
const token = process.env.ONECLAW_AGENT_TOKEN;
|
|
30
|
+
if (agentId && agentApiKey) {
|
|
31
|
+
sharedClient = new OneClawClient({
|
|
32
|
+
baseUrl,
|
|
33
|
+
agentId,
|
|
34
|
+
apiKey: agentApiKey,
|
|
35
|
+
vaultId,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else if (token) {
|
|
39
|
+
sharedClient = new OneClawClient({ baseUrl, token, vaultId });
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
console.error("Authentication required. Set either:\n" +
|
|
43
|
+
" ONECLAW_AGENT_ID + ONECLAW_AGENT_API_KEY (recommended, auto-refreshes)\n" +
|
|
44
|
+
" ONECLAW_AGENT_TOKEN (static JWT, expires)");
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
31
47
|
}
|
|
32
48
|
function resolveClient(session) {
|
|
33
49
|
if (session) {
|
|
34
|
-
return new OneClawClient({
|
|
50
|
+
return new OneClawClient({
|
|
51
|
+
baseUrl,
|
|
52
|
+
token: session.token,
|
|
53
|
+
vaultId: session.vaultId,
|
|
54
|
+
});
|
|
35
55
|
}
|
|
36
56
|
if (sharedClient)
|
|
37
57
|
return sharedClient;
|
|
@@ -77,6 +97,8 @@ registerTool(createVaultTool);
|
|
|
77
97
|
registerTool(listVaultsTool);
|
|
78
98
|
registerTool(grantAccessTool);
|
|
79
99
|
registerTool(shareSecretTool);
|
|
100
|
+
registerTool(simulateTransactionTool);
|
|
101
|
+
registerTool(submitTransactionTool);
|
|
80
102
|
// ── Stretch: rotate_and_store ────────────────────────
|
|
81
103
|
server.addTool({
|
|
82
104
|
name: "rotate_and_store",
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE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ACZ,OAAO,EAAE,CAAC,CAAC,OAAO;gBAClB,UAAU,EAAE,CAAC,CAAC,UAAU;aAC3B,CAAC,CAAC,EACH,IAAI,EACJ,CAAC,CACJ;SACJ,CAAC;IACN,CAAC;CACJ,CAAC,CAAC;AAEH,wDAAwD;AAExD,IAAI,SAAS,KAAK,YAAY,EAAE,CAAC;IAC7B,MAAM,CAAC,KAAK,CAAC;QACT,aAAa,EAAE,YAAY;QAC3B,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;KACxC,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,sCAAsC,IAAI,mBAAmB,CAAC,CAAC;AAC/E,CAAC;KAAM,CAAC;IACJ,MAAM,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -5,7 +5,7 @@ export declare function shareSecretTool(client: OneClawClient): {
|
|
|
5
5
|
description: string;
|
|
6
6
|
parameters: z.ZodObject<{
|
|
7
7
|
secret_id: z.ZodString;
|
|
8
|
-
recipient_type: z.ZodEnum<["user", "agent", "anyone_with_link"]>;
|
|
8
|
+
recipient_type: z.ZodEnum<["user", "agent", "anyone_with_link", "creator"]>;
|
|
9
9
|
recipient_id: z.ZodOptional<z.ZodString>;
|
|
10
10
|
expires_at: z.ZodString;
|
|
11
11
|
max_access_count: z.ZodDefault<z.ZodNumber>;
|
|
@@ -13,18 +13,18 @@ export declare function shareSecretTool(client: OneClawClient): {
|
|
|
13
13
|
expires_at: string;
|
|
14
14
|
max_access_count: number;
|
|
15
15
|
secret_id: string;
|
|
16
|
-
recipient_type: "user" | "agent" | "anyone_with_link";
|
|
16
|
+
recipient_type: "user" | "agent" | "anyone_with_link" | "creator";
|
|
17
17
|
recipient_id?: string | undefined;
|
|
18
18
|
}, {
|
|
19
19
|
expires_at: string;
|
|
20
20
|
secret_id: string;
|
|
21
|
-
recipient_type: "user" | "agent" | "anyone_with_link";
|
|
21
|
+
recipient_type: "user" | "agent" | "anyone_with_link" | "creator";
|
|
22
22
|
max_access_count?: number | undefined;
|
|
23
23
|
recipient_id?: string | undefined;
|
|
24
24
|
}>;
|
|
25
25
|
execute: (args: {
|
|
26
26
|
secret_id: string;
|
|
27
|
-
recipient_type: "user" | "agent" | "anyone_with_link";
|
|
27
|
+
recipient_type: "user" | "agent" | "anyone_with_link" | "creator";
|
|
28
28
|
recipient_id?: string;
|
|
29
29
|
expires_at: string;
|
|
30
30
|
max_access_count: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"share_secret.d.ts","sourceRoot":"","sources":["../../src/tools/share_secret.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"share_secret.d.ts","sourceRoot":"","sources":["../../src/tools/share_secret.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;oBAsCvB;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,GAAG,OAAO,GAAG,kBAAkB,GAAG,SAAS,CAAC;QAClE,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,gBAAgB,EAAE,MAAM,CAAC;KAC5B;EAgCR"}
|
|
@@ -2,9 +2,9 @@ import { z } from "zod";
|
|
|
2
2
|
export function shareSecretTool(client) {
|
|
3
3
|
return {
|
|
4
4
|
name: "share_secret",
|
|
5
|
-
description: "Share a specific secret with a user or
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
description: "Share a specific secret with a user, agent, or your creator (the human who registered you). " +
|
|
6
|
+
"Use recipient_type 'creator' to share back with the human who owns this agent — " +
|
|
7
|
+
"no recipient_id needed. Agents cannot create email-based shares. " +
|
|
8
8
|
"For vault-wide access, use grant_access instead.",
|
|
9
9
|
parameters: z.object({
|
|
10
10
|
secret_id: z
|
|
@@ -12,13 +12,14 @@ export function shareSecretTool(client) {
|
|
|
12
12
|
.uuid()
|
|
13
13
|
.describe("UUID of the secret entry to share"),
|
|
14
14
|
recipient_type: z
|
|
15
|
-
.enum(["user", "agent", "anyone_with_link"])
|
|
16
|
-
.describe("Type of recipient:
|
|
15
|
+
.enum(["user", "agent", "anyone_with_link", "creator"])
|
|
16
|
+
.describe("Type of recipient: 'creator' (share with the human who registered this agent — recommended), " +
|
|
17
|
+
"'user' (by UUID), 'agent' (by UUID), or 'anyone_with_link'"),
|
|
17
18
|
recipient_id: z
|
|
18
19
|
.string()
|
|
19
20
|
.uuid()
|
|
20
21
|
.optional()
|
|
21
|
-
.describe("UUID of the recipient user or agent (required for user/agent types)"),
|
|
22
|
+
.describe("UUID of the recipient user or agent (required for user/agent types, not needed for creator)"),
|
|
22
23
|
expires_at: z
|
|
23
24
|
.string()
|
|
24
25
|
.describe("ISO-8601 expiry date (e.g. '2026-12-31T00:00:00Z')"),
|
|
@@ -30,7 +31,8 @@ export function shareSecretTool(client) {
|
|
|
30
31
|
.describe("Max number of times the secret can be accessed (default: 5)"),
|
|
31
32
|
}),
|
|
32
33
|
execute: async (args) => {
|
|
33
|
-
if ((args.recipient_type === "user" ||
|
|
34
|
+
if ((args.recipient_type === "user" ||
|
|
35
|
+
args.recipient_type === "agent") &&
|
|
34
36
|
!args.recipient_id) {
|
|
35
37
|
return `Error: recipient_id is required when sharing with a ${args.recipient_type}.`;
|
|
36
38
|
}
|
|
@@ -40,9 +42,12 @@ export function shareSecretTool(client) {
|
|
|
40
42
|
expires_at: args.expires_at,
|
|
41
43
|
max_access_count: args.max_access_count,
|
|
42
44
|
});
|
|
45
|
+
const recipientLabel = args.recipient_type === "creator"
|
|
46
|
+
? "your creator (the human who registered this agent)"
|
|
47
|
+
: `${args.recipient_type}${args.recipient_id ? ` (${args.recipient_id})` : ""}`;
|
|
43
48
|
return (`Secret shared successfully.\n` +
|
|
44
49
|
` Share ID: ${share.id}\n` +
|
|
45
|
-
` Recipient: ${
|
|
50
|
+
` Recipient: ${recipientLabel}\n` +
|
|
46
51
|
` Expires: ${share.expires_at}\n` +
|
|
47
52
|
` Max accesses: ${share.max_access_count}\n` +
|
|
48
53
|
` URL: ${share.share_url}\n\n` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"share_secret.js","sourceRoot":"","sources":["../../src/tools/share_secret.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,UAAU,eAAe,CAAC,MAAqB;
|
|
1
|
+
{"version":3,"file":"share_secret.js","sourceRoot":"","sources":["../../src/tools/share_secret.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,UAAU,eAAe,CAAC,MAAqB;IACjD,OAAO;QACH,IAAI,EAAE,cAAuB;QAC7B,WAAW,EACP,8FAA8F;YAC9F,kFAAkF;YAClF,mEAAmE;YACnE,kDAAkD;QACtD,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;YACjB,SAAS,EAAE,CAAC;iBACP,MAAM,EAAE;iBACR,IAAI,EAAE;iBACN,QAAQ,CAAC,mCAAmC,CAAC;YAClD,cAAc,EAAE,CAAC;iBACZ,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,SAAS,CAAC,CAAC;iBACtD,QAAQ,CACL,+FAA+F;gBAC3F,4DAA4D,CACnE;YACL,YAAY,EAAE,CAAC;iBACV,MAAM,EAAE;iBACR,IAAI,EAAE;iBACN,QAAQ,EAAE;iBACV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,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { OneClawClient } from "../client.js";
|
|
3
|
+
export declare function simulateTransactionTool(client: OneClawClient): {
|
|
4
|
+
name: "simulate_transaction";
|
|
5
|
+
description: string;
|
|
6
|
+
parameters: z.ZodObject<{
|
|
7
|
+
to: z.ZodString;
|
|
8
|
+
value: z.ZodString;
|
|
9
|
+
chain: z.ZodString;
|
|
10
|
+
data: z.ZodOptional<z.ZodString>;
|
|
11
|
+
signing_key_path: z.ZodOptional<z.ZodString>;
|
|
12
|
+
gas_limit: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
value: string;
|
|
15
|
+
to: string;
|
|
16
|
+
chain: string;
|
|
17
|
+
data?: string | undefined;
|
|
18
|
+
signing_key_path?: string | undefined;
|
|
19
|
+
gas_limit?: number | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
value: string;
|
|
22
|
+
to: string;
|
|
23
|
+
chain: string;
|
|
24
|
+
data?: string | undefined;
|
|
25
|
+
signing_key_path?: string | undefined;
|
|
26
|
+
gas_limit?: number | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
execute: (args: {
|
|
29
|
+
to: string;
|
|
30
|
+
value: string;
|
|
31
|
+
chain: string;
|
|
32
|
+
data?: string;
|
|
33
|
+
signing_key_path?: string;
|
|
34
|
+
gas_limit?: number;
|
|
35
|
+
}, { log }: {
|
|
36
|
+
log: {
|
|
37
|
+
info: (msg: string) => void;
|
|
38
|
+
};
|
|
39
|
+
}) => Promise<string>;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=simulate_transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulate_transaction.d.ts","sourceRoot":"","sources":["../../src/tools/simulate_transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAmB,MAAM,cAAc,CAAC;AAE9D,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;oBAcjD;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,WACQ;QAAE,GAAG,EAAE;YAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;SAAE,CAAA;KAAE;EAgDtD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { UserError } from "fastmcp";
|
|
3
|
+
import { OneClawApiError } from "../client.js";
|
|
4
|
+
export function simulateTransactionTool(client) {
|
|
5
|
+
return {
|
|
6
|
+
name: "simulate_transaction",
|
|
7
|
+
description: "Simulate an EVM transaction via Tenderly without signing or broadcasting. Returns balance changes, gas estimates, and success/revert status. Use this to preview what a transaction will do before committing real funds.",
|
|
8
|
+
parameters: z.object({
|
|
9
|
+
to: z.string().describe("Destination address (0x-prefixed)"),
|
|
10
|
+
value: z.string().describe("Value in ETH as decimal string (e.g. '0.01')"),
|
|
11
|
+
chain: z.string().describe("Chain name ('base', 'ethereum', etc.) or numeric chain ID"),
|
|
12
|
+
data: z.string().optional().describe("Hex-encoded calldata for contract interactions"),
|
|
13
|
+
signing_key_path: z.string().optional().describe("Vault path to the signing key. Defaults to keys/{chain}-signer"),
|
|
14
|
+
gas_limit: z.number().int().optional().describe("Gas limit. Defaults to 21000"),
|
|
15
|
+
}),
|
|
16
|
+
execute: async (args, { log }) => {
|
|
17
|
+
const agentId = client.agentId;
|
|
18
|
+
if (!agentId) {
|
|
19
|
+
throw new UserError("simulate_transaction requires agent authentication (ONECLAW_AGENT_ID).");
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const result = await client.simulateTransaction(agentId, args);
|
|
23
|
+
log.info(`simulation: ${result.status} (gas: ${result.gas_used})`);
|
|
24
|
+
const lines = [
|
|
25
|
+
`Simulation ${result.status.toUpperCase()}`,
|
|
26
|
+
`Gas used: ${result.gas_used}`,
|
|
27
|
+
];
|
|
28
|
+
if (result.gas_estimate_usd) {
|
|
29
|
+
lines.push(`Gas estimate: ${result.gas_estimate_usd}`);
|
|
30
|
+
}
|
|
31
|
+
if (result.balance_changes.length > 0) {
|
|
32
|
+
lines.push("", "Balance changes:");
|
|
33
|
+
for (const bc of result.balance_changes) {
|
|
34
|
+
const token = bc.token_symbol ?? bc.token ?? "ETH";
|
|
35
|
+
lines.push(` ${bc.address}: ${bc.change ?? "?"} ${token}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (result.error) {
|
|
39
|
+
lines.push("", `Error: ${result.error}`);
|
|
40
|
+
}
|
|
41
|
+
if (result.error_human_readable) {
|
|
42
|
+
lines.push(`Reason: ${result.error_human_readable}`);
|
|
43
|
+
}
|
|
44
|
+
if (result.tenderly_dashboard_url) {
|
|
45
|
+
lines.push("", `Tenderly: ${result.tenderly_dashboard_url}`);
|
|
46
|
+
}
|
|
47
|
+
return lines.join("\n");
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
if (err instanceof OneClawApiError) {
|
|
51
|
+
if (err.status === 400)
|
|
52
|
+
throw new UserError(err.detail);
|
|
53
|
+
if (err.status === 403)
|
|
54
|
+
throw new UserError(`Access denied: ${err.detail}`);
|
|
55
|
+
}
|
|
56
|
+
throw err;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=simulate_transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulate_transaction.js","sourceRoot":"","sources":["../../src/tools/simulate_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1B,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,GAAG,YAAY,eAAe,EAAE,CAAC;oBACnC,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;wBAAE,MAAM,IAAI,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;oBACxD,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;wBAAE,MAAM,IAAI,SAAS,CAAC,kBAAkB,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;gBAC9E,CAAC;gBACD,MAAM,GAAG,CAAC;YACZ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { OneClawClient } from "../client.js";
|
|
3
|
+
export declare function submitTransactionTool(client: OneClawClient): {
|
|
4
|
+
name: "submit_transaction";
|
|
5
|
+
description: string;
|
|
6
|
+
parameters: z.ZodObject<{
|
|
7
|
+
to: z.ZodString;
|
|
8
|
+
value: z.ZodString;
|
|
9
|
+
chain: z.ZodString;
|
|
10
|
+
data: z.ZodOptional<z.ZodString>;
|
|
11
|
+
signing_key_path: z.ZodOptional<z.ZodString>;
|
|
12
|
+
nonce: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
gas_price: z.ZodOptional<z.ZodString>;
|
|
14
|
+
gas_limit: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
max_fee_per_gas: z.ZodOptional<z.ZodString>;
|
|
16
|
+
max_priority_fee_per_gas: z.ZodOptional<z.ZodString>;
|
|
17
|
+
simulate_first: z.ZodDefault<z.ZodBoolean>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
value: string;
|
|
20
|
+
to: string;
|
|
21
|
+
chain: string;
|
|
22
|
+
simulate_first: boolean;
|
|
23
|
+
data?: string | undefined;
|
|
24
|
+
signing_key_path?: string | undefined;
|
|
25
|
+
gas_limit?: number | undefined;
|
|
26
|
+
nonce?: number | undefined;
|
|
27
|
+
gas_price?: string | undefined;
|
|
28
|
+
max_fee_per_gas?: string | undefined;
|
|
29
|
+
max_priority_fee_per_gas?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
value: string;
|
|
32
|
+
to: string;
|
|
33
|
+
chain: string;
|
|
34
|
+
data?: string | undefined;
|
|
35
|
+
signing_key_path?: string | undefined;
|
|
36
|
+
gas_limit?: number | undefined;
|
|
37
|
+
nonce?: number | undefined;
|
|
38
|
+
gas_price?: string | undefined;
|
|
39
|
+
max_fee_per_gas?: string | undefined;
|
|
40
|
+
max_priority_fee_per_gas?: string | undefined;
|
|
41
|
+
simulate_first?: boolean | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
execute: (args: {
|
|
44
|
+
to: string;
|
|
45
|
+
value: string;
|
|
46
|
+
chain: string;
|
|
47
|
+
data?: string;
|
|
48
|
+
signing_key_path?: string;
|
|
49
|
+
nonce?: number;
|
|
50
|
+
gas_price?: string;
|
|
51
|
+
gas_limit?: number;
|
|
52
|
+
max_fee_per_gas?: string;
|
|
53
|
+
max_priority_fee_per_gas?: string;
|
|
54
|
+
simulate_first?: boolean;
|
|
55
|
+
}, { log }: {
|
|
56
|
+
log: {
|
|
57
|
+
info: (msg: string) => void;
|
|
58
|
+
};
|
|
59
|
+
}) => Promise<string>;
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=submit_transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submit_transaction.d.ts","sourceRoot":"","sources":["../../src/tools/submit_transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAmB,MAAM,cAAc,CAAC;AAE9D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAmB/C;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,wBAAwB,CAAC,EAAE,MAAM,CAAC;QAClC,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,WACQ;QAAE,GAAG,EAAE;YAAE,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;SAAE,CAAA;KAAE;EAkCtD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { UserError } from "fastmcp";
|
|
3
|
+
import { OneClawApiError } from "../client.js";
|
|
4
|
+
export function submitTransactionTool(client) {
|
|
5
|
+
return {
|
|
6
|
+
name: "submit_transaction",
|
|
7
|
+
description: "Submit an EVM transaction to be signed by 1claw's crypto proxy and optionally broadcast. Supports legacy and EIP-1559 fee modes. Set simulate_first=true to run a Tenderly simulation before signing (recommended).",
|
|
8
|
+
parameters: z.object({
|
|
9
|
+
to: z.string().describe("Destination address (0x-prefixed)"),
|
|
10
|
+
value: z.string().describe("Value in ETH as decimal string (e.g. '0.01')"),
|
|
11
|
+
chain: z.string().describe("Chain name ('base', 'ethereum', etc.) or numeric chain ID"),
|
|
12
|
+
data: z.string().optional().describe("Hex-encoded calldata for contract interactions"),
|
|
13
|
+
signing_key_path: z.string().optional().describe("Vault path to the signing key"),
|
|
14
|
+
nonce: z.number().int().optional().describe("Transaction nonce (auto-resolved if omitted)"),
|
|
15
|
+
gas_price: z.string().optional().describe("Gas price in wei (legacy mode)"),
|
|
16
|
+
gas_limit: z.number().int().optional().describe("Gas limit. Defaults to 21000"),
|
|
17
|
+
max_fee_per_gas: z.string().optional().describe("EIP-1559 max fee per gas in wei"),
|
|
18
|
+
max_priority_fee_per_gas: z.string().optional().describe("EIP-1559 max priority fee per gas in wei"),
|
|
19
|
+
simulate_first: z.boolean().default(true).describe("Run Tenderly simulation before signing. Defaults to true."),
|
|
20
|
+
}),
|
|
21
|
+
execute: async (args, { log }) => {
|
|
22
|
+
const agentId = client.agentId;
|
|
23
|
+
if (!agentId) {
|
|
24
|
+
throw new UserError("submit_transaction requires agent authentication (ONECLAW_AGENT_ID).");
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const result = await client.submitTransaction(agentId, args);
|
|
28
|
+
log.info(`transaction: ${result.status} (${result.id})`);
|
|
29
|
+
const lines = [
|
|
30
|
+
`Transaction ${result.status.toUpperCase()}`,
|
|
31
|
+
`ID: ${result.id}`,
|
|
32
|
+
`Chain: ${result.chain} (${result.chain_id})`,
|
|
33
|
+
`To: ${result.to}`,
|
|
34
|
+
`Value: ${result.value_wei} wei`,
|
|
35
|
+
];
|
|
36
|
+
if (result.tx_hash)
|
|
37
|
+
lines.push(`Tx hash: ${result.tx_hash}`);
|
|
38
|
+
if (result.simulation_id)
|
|
39
|
+
lines.push(`Simulation: ${result.simulation_id} (${result.simulation_status})`);
|
|
40
|
+
if (result.error_message)
|
|
41
|
+
lines.push(`Error: ${result.error_message}`);
|
|
42
|
+
return lines.join("\n");
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
if (err instanceof OneClawApiError) {
|
|
46
|
+
if (err.status === 400)
|
|
47
|
+
throw new UserError(err.detail);
|
|
48
|
+
if (err.status === 403)
|
|
49
|
+
throw new UserError(`Access denied: ${err.detail}`);
|
|
50
|
+
if (err.status === 422)
|
|
51
|
+
throw new UserError(`Transaction rejected: ${err.detail}`);
|
|
52
|
+
}
|
|
53
|
+
throw err;
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=submit_transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|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AAC;gBAEvE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1B,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,GAAG,YAAY,eAAe,EAAE,CAAC;oBACnC,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;wBAAE,MAAM,IAAI,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;oBACxD,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;wBAAE,MAAM,IAAI,SAAS,CAAC,kBAAkB,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;oBAC5E,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;wBAAE,MAAM,IAAI,SAAS,CAAC,yBAAyB,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;gBACrF,CAAC;gBACD,MAAM,GAAG,CAAC;YACZ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -47,6 +47,46 @@ export interface ShareLinkResponse {
|
|
|
47
47
|
expires_at: string;
|
|
48
48
|
max_access_count: number;
|
|
49
49
|
}
|
|
50
|
+
export interface BalanceChange {
|
|
51
|
+
address: string;
|
|
52
|
+
token?: string;
|
|
53
|
+
token_symbol?: string;
|
|
54
|
+
before?: string;
|
|
55
|
+
after?: string;
|
|
56
|
+
change?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface SimulationResponse {
|
|
59
|
+
simulation_id: string;
|
|
60
|
+
status: "success" | "reverted" | "error";
|
|
61
|
+
gas_used: number;
|
|
62
|
+
gas_estimate_usd?: string;
|
|
63
|
+
balance_changes: BalanceChange[];
|
|
64
|
+
error?: string;
|
|
65
|
+
error_code?: string;
|
|
66
|
+
error_human_readable?: string;
|
|
67
|
+
revert_reason?: string;
|
|
68
|
+
tenderly_dashboard_url?: string;
|
|
69
|
+
simulated_at: string;
|
|
70
|
+
}
|
|
71
|
+
export interface BundleSimulationResponse {
|
|
72
|
+
simulations: SimulationResponse[];
|
|
73
|
+
}
|
|
74
|
+
export interface TransactionResponse {
|
|
75
|
+
id: string;
|
|
76
|
+
agent_id: string;
|
|
77
|
+
chain: string;
|
|
78
|
+
chain_id: number;
|
|
79
|
+
to: string;
|
|
80
|
+
value_wei: string;
|
|
81
|
+
status: string;
|
|
82
|
+
signed_tx?: string;
|
|
83
|
+
tx_hash?: string;
|
|
84
|
+
error_message?: string;
|
|
85
|
+
created_at: string;
|
|
86
|
+
signed_at?: string;
|
|
87
|
+
simulation_id?: string;
|
|
88
|
+
simulation_status?: string;
|
|
89
|
+
}
|
|
50
90
|
export interface ApiErrorBody {
|
|
51
91
|
type: string;
|
|
52
92
|
title: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,yGASf,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,e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,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
package/package.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
2
|
+
"name": "@1claw/mcp",
|
|
3
|
+
"version": "0.2.5",
|
|
4
|
+
"description": "MCP server for the 1claw secrets vault — lets AI agents fetch, store, and manage secrets at runtime",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"1claw-mcp": "dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"prepublishOnly": "npm run build",
|
|
19
|
+
"dev": "npx fastmcp dev src/index.ts",
|
|
20
|
+
"inspect": "npx fastmcp inspect src/index.ts",
|
|
21
|
+
"start": "node dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"mcp",
|
|
25
|
+
"secrets",
|
|
26
|
+
"vault",
|
|
27
|
+
"ai-agents",
|
|
28
|
+
"hsm",
|
|
29
|
+
"1claw"
|
|
30
|
+
],
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/1clawAI/1claw-mcp.git"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://1claw.xyz",
|
|
36
|
+
"license": "PolyForm-Noncommercial-1.0.0",
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"fastmcp": "^3.33.0",
|
|
39
|
+
"zod": "^3.24.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^20.19.33",
|
|
43
|
+
"typescript": "^5.5.0"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=20.0.0"
|
|
47
|
+
}
|
|
48
48
|
}
|