@1claw/mcp 0.1.0 → 0.2.4
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 +10 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +41 -3
- package/dist/client.js.map +1 -1
- package/dist/index.js +15 -6
- 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/package.json +3 -3
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
|
@@ -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;
|
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,EACV,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EAElB,MAAM,YAAY,CAAC;AAEpB,qBAAa,eAAgB,SAAQ,KAAK;IAE/B,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;gBADd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM;CAKxB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,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;IAOzC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAOvE,UAAU,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAIxC,WAAW,CACf,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;QACP,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,GACA,OAAO,CAAC,iBAAiB,CAAC;IAOvB,YAAY,CAChB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EAAE,EACrB,iBAAiB,SAAO,GACvB,OAAO,CAAC,cAAc,CAAC;CAc3B"}
|
package/dist/client.js
CHANGED
|
@@ -14,16 +14,53 @@ 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 = { agentId: config.agentId, apiKey: config.apiKey };
|
|
29
|
+
this.token = "";
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
this.token = config.token;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async ensureToken() {
|
|
36
|
+
if (!this.agentCredentials)
|
|
37
|
+
return;
|
|
38
|
+
if (this.token && Date.now() < this.tokenExpiresAt - REFRESH_BUFFER_MS)
|
|
39
|
+
return;
|
|
40
|
+
const res = await fetch(`${this.baseUrl}/v1/auth/agent-token`, {
|
|
41
|
+
method: "POST",
|
|
42
|
+
headers: { "Content-Type": "application/json" },
|
|
43
|
+
body: JSON.stringify({
|
|
44
|
+
agent_id: this.agentCredentials.agentId,
|
|
45
|
+
api_key: this.agentCredentials.apiKey,
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
if (!res.ok) {
|
|
49
|
+
let detail = `HTTP ${res.status}`;
|
|
50
|
+
try {
|
|
51
|
+
const body = (await res.json());
|
|
52
|
+
if (body.detail)
|
|
53
|
+
detail = body.detail;
|
|
54
|
+
}
|
|
55
|
+
catch { /* use default */ }
|
|
56
|
+
throw new OneClawApiError(res.status, `Agent auth failed: ${detail}`);
|
|
57
|
+
}
|
|
58
|
+
const data = (await res.json());
|
|
59
|
+
this.token = data.access_token;
|
|
60
|
+
this.tokenExpiresAt = Date.now() + data.expires_in * 1000;
|
|
25
61
|
}
|
|
26
|
-
headers() {
|
|
62
|
+
async headers() {
|
|
63
|
+
await this.ensureToken();
|
|
27
64
|
return {
|
|
28
65
|
Authorization: `Bearer ${this.token}`,
|
|
29
66
|
"Content-Type": "application/json",
|
|
@@ -33,9 +70,10 @@ export class OneClawClient {
|
|
|
33
70
|
return `${this.baseUrl}/v1/vaults/${this.vaultId}${suffix}`;
|
|
34
71
|
}
|
|
35
72
|
async request(url, init) {
|
|
73
|
+
const hdrs = await this.headers();
|
|
36
74
|
const res = await fetch(url, {
|
|
37
75
|
...init,
|
|
38
|
-
headers: { ...
|
|
76
|
+
headers: { ...hdrs, ...init?.headers },
|
|
39
77
|
});
|
|
40
78
|
if (!res.ok) {
|
|
41
79
|
if (res.status === 402) {
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],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AoB,GAAG,IAAI,CAAC,OAAO,YAAY,CAAC,CAAC;IACtE,CAAC;IAED,KAAK,CAAC,WAAW,CACf,QAAgB,EAChB,OAMC;QAED,OAAO,IAAI,CAAC,OAAO,CACjB,GAAG,IAAI,CAAC,OAAO,eAAe,QAAQ,QAAQ,EAC9C,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAClD,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,OAAe,EACf,aAAqB,EACrB,WAAmB,EACnB,WAAqB,EACrB,iBAAiB,GAAG,IAAI;QAExB,OAAO,IAAI,CAAC,OAAO,CACjB,GAAG,IAAI,CAAC,OAAO,cAAc,OAAO,WAAW,EAC/C;YACE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,mBAAmB,EAAE,iBAAiB;gBACtC,cAAc,EAAE,aAAa;gBAC7B,YAAY,EAAE,WAAW;gBACzB,WAAW;aACZ,CAAC;SACH,CACF,CAAC;IACJ,CAAC;CACF"}
|
package/dist/index.js
CHANGED
|
@@ -17,17 +17,26 @@ const port = parseInt(process.env.PORT ?? "8080", 10);
|
|
|
17
17
|
// ── Shared client (stdio mode) ──────────────────────
|
|
18
18
|
let sharedClient;
|
|
19
19
|
if (transport === "stdio") {
|
|
20
|
-
const token = process.env.ONECLAW_AGENT_TOKEN;
|
|
21
20
|
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
21
|
if (!vaultId) {
|
|
27
22
|
console.error("ONECLAW_VAULT_ID is required. Set it as an environment variable.");
|
|
28
23
|
process.exit(1);
|
|
29
24
|
}
|
|
30
|
-
|
|
25
|
+
const agentId = process.env.ONECLAW_AGENT_ID;
|
|
26
|
+
const agentApiKey = process.env.ONECLAW_AGENT_API_KEY;
|
|
27
|
+
const token = process.env.ONECLAW_AGENT_TOKEN;
|
|
28
|
+
if (agentId && agentApiKey) {
|
|
29
|
+
sharedClient = new OneClawClient({ baseUrl, agentId, apiKey: agentApiKey, vaultId });
|
|
30
|
+
}
|
|
31
|
+
else if (token) {
|
|
32
|
+
sharedClient = new OneClawClient({ baseUrl, token, vaultId });
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
console.error("Authentication required. Set either:\n" +
|
|
36
|
+
" ONECLAW_AGENT_ID + ONECLAW_AGENT_API_KEY (recommended, auto-refreshes)\n" +
|
|
37
|
+
" ONECLAW_AGENT_TOKEN (static JWT, expires)");
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
31
40
|
}
|
|
32
41
|
function resolveClient(session) {
|
|
33
42
|
if (session) {
|
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;AA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AAM,MAAM,CAAC,WAAW,EAAE,CAAC;QACxC,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACvB,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,OAAO,EAAE,CAAC,CAAC,OAAO;gBAClB,UAAU,EAAE,CAAC,CAAC,UAAU;aACzB,CAAC,CAAC,EACH,IAAI,EACJ,CAAC,CACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,wDAAwD;AAExD,IAAI,SAAS,KAAK,YAAY,EAAE,CAAC;IAC/B,MAAM,CAAC,KAAK,CAAC;QACX,aAAa,EAAE,YAAY;QAC3B,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;KACtC,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,sCAAsC,IAAI,mBAAmB,CAAC,CAAC;AAC7E,CAAC;KAAM,CAAC;IACN,MAAM,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC;AAC3C,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,c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CACH,+BAA+B;gBAC/B,eAAe,KAAK,CAAC,EAAE,IAAI;gBAC3B,gBAAgB,cAAc,IAAI;gBAClC,cAAc,KAAK,CAAC,UAAU,IAAI;gBAClC,mBAAmB,KAAK,CAAC,gBAAgB,IAAI;gBAC7C,UAAU,KAAK,CAAC,SAAS,MAAM;gBAC/B,wEAAwE,CAC3E,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1claw/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "MCP server for the 1claw secrets vault — lets AI agents fetch, store, and manage secrets at runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"url": "https://github.com/1clawAI/1claw-mcp.git"
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://1claw.xyz",
|
|
36
|
-
"license": "
|
|
36
|
+
"license": "PolyForm-Noncommercial-1.0.0",
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"fastmcp": "^3.33.0",
|
|
39
39
|
"zod": "^3.24.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/node": "^20.
|
|
42
|
+
"@types/node": "^20.19.33",
|
|
43
43
|
"typescript": "^5.5.0"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|