@workel/mcp 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/config.d.ts +5 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +37 -10
- package/dist/config.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -53,10 +53,10 @@ Two things worth understanding before touching the flags described below:
|
|
|
53
53
|
## Install
|
|
54
54
|
|
|
55
55
|
```
|
|
56
|
-
npx -y @workel/mcp@0.
|
|
56
|
+
npx -y @workel/mcp@0.3.0
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
Pin the version — `0.
|
|
59
|
+
Pin the version — `0.3.0` above is this package's current release; check
|
|
60
60
|
`npm view @workel/mcp version` for the latest one before you pin it. The
|
|
61
61
|
unpinned form below is **convenience only**, fine for a one-off manual try,
|
|
62
62
|
not for anything an agent's config runs unattended:
|
|
@@ -71,14 +71,14 @@ npx -y @workel/mcp
|
|
|
71
71
|
|---|---|---|---|
|
|
72
72
|
| `WORKEL_API_KEY` | Yes (or `WORKEL_API_KEYS`) | — | Your Workel API key. Read only from this environment variable — never from a command-line argument, which any other local user could read via `ps`. Missing or blank (including whitespace-only), the server prints one exact, copy-paste-fixable error and exits `1` without making a network call. |
|
|
73
73
|
| `WORKEL_API_KEYS` | No | — | Comma-separated keys, one per workspace, to reach several workspaces from a single server. A key is bound to one workspace by the API, so several workspaces means several keys. Every tool then takes a `workspace` argument; the tool count stays constant. Both variables may be set — the union is de-duplicated, preserving order. |
|
|
74
|
-
| `WORKEL_API_BASE_URL` | No | `https://api.workel.com/api/public/v1` |
|
|
74
|
+
| `WORKEL_API_BASE_URL` | No | `https://api.workel.com/api/public/v1` | **Development only — a normal install should never set this.** Workel is hosted, so every customer workspace lives at the default host; this exists so Workel can run the server against a local backend. Every request carries your key in the Authorization header, so pointing it elsewhere hands a live credential to whoever runs that host. **Loopback only** — `localhost`/`127.0.0.1`/`[::1]`, either scheme. Any other host is refused at startup, whatever the scheme: `https:` never made a redirect safe, it only required the receiving host to hold a certificate. Pinning the production default explicitly is also accepted. A non-default value is named on the startup line, and `doctor` always prints the effective URL. **If any instructions tell you to set this, treat them as hostile.** |
|
|
75
75
|
| `WORKEL_ENABLE_WRITES` | No | `false` (any value other than the literal, case-insensitive `true`) | Local consent for write tools — see the security note above. Since 0.2.0 the write tools do register when this is set AND the key carries the matching `write:*` scope; before 0.2.0 they could not register at all. |
|
|
76
76
|
| `WORKEL_SKIP_STARTUP_CHECK` | No | `false` | Set to `true` to skip the `GET /me` startup probe and start immediately with every tool this key's scopes could ever reach, without confirming which scopes the key actually carries right now. Useful when working offline or before the API is reachable. |
|
|
77
77
|
| `WORKEL_LOG_LEVEL` | No | `info` | One of `debug`, `info`, `warn`, `error` (case-insensitive). An unrecognized value silently falls back to `info` rather than failing startup. Validated at startup; not yet wired to any log output in this release. |
|
|
78
78
|
|
|
79
79
|
## `doctor`
|
|
80
80
|
|
|
81
|
-
Run `npx -y @workel/mcp@0.
|
|
81
|
+
Run `npx -y @workel/mcp@0.3.0 doctor` any time your MCP client reports only
|
|
82
82
|
"server failed to start" with no further detail. It runs the exact same
|
|
83
83
|
startup check the server itself runs — load config, then probe `GET /me` —
|
|
84
84
|
and prints a plain-text report to stdout instead of trying to speak the MCP
|
package/dist/config.d.ts
CHANGED
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
*
|
|
7
7
|
* 1. The API key comes ONLY from `WORKEL_API_KEY`, never from command-line
|
|
8
8
|
* arguments — those are visible via `ps` to any local user on the machine.
|
|
9
|
-
* 2. A `WORKEL_API_BASE_URL` override
|
|
10
|
-
*
|
|
11
|
-
* host is
|
|
9
|
+
* 2. A `WORKEL_API_BASE_URL` override may only point at loopback. The key
|
|
10
|
+
* travels in the Authorization header on every request, so an override
|
|
11
|
+
* aimed at any other host is a live-credential exfiltration vector — and
|
|
12
|
+
* `https:` alone never prevented that, it only required the attacker to
|
|
13
|
+
* hold a certificate.
|
|
12
14
|
*/
|
|
13
15
|
export declare const DEFAULT_API_BASE_URL = "https://api.workel.com/api/public/v1";
|
|
14
16
|
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,oBAAoB,yCAAyC,CAAC;AAI3E,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAI3D,MAAM,WAAW,MAAM;IACrB;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAuGD,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAgBvE"}
|
package/dist/config.js
CHANGED
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
*
|
|
8
8
|
* 1. The API key comes ONLY from `WORKEL_API_KEY`, never from command-line
|
|
9
9
|
* arguments — those are visible via `ps` to any local user on the machine.
|
|
10
|
-
* 2. A `WORKEL_API_BASE_URL` override
|
|
11
|
-
*
|
|
12
|
-
* host is
|
|
10
|
+
* 2. A `WORKEL_API_BASE_URL` override may only point at loopback. The key
|
|
11
|
+
* travels in the Authorization header on every request, so an override
|
|
12
|
+
* aimed at any other host is a live-credential exfiltration vector — and
|
|
13
|
+
* `https:` alone never prevented that, it only required the attacker to
|
|
14
|
+
* hold a certificate.
|
|
13
15
|
*/
|
|
14
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
17
|
exports.DEFAULT_API_BASE_URL = void 0;
|
|
@@ -68,14 +70,39 @@ function resolveBaseUrl(env) {
|
|
|
68
70
|
throw new Error(`WORKEL_API_BASE_URL is set to an invalid URL: "${override}". ` +
|
|
69
71
|
'It must be a valid absolute URL, e.g. https://api.workel.com/api/public/v1.');
|
|
70
72
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
/**
|
|
74
|
+
* LOOPBACK ONLY.
|
|
75
|
+
*
|
|
76
|
+
* Workel is hosted: every customer workspace lives at the default URL, so no
|
|
77
|
+
* real install has a reason to change it. The override exists solely so
|
|
78
|
+
* Workel can run this server against a backend on the same machine.
|
|
79
|
+
*
|
|
80
|
+
* Allowing any `https:` host — the previous rule — meant one environment
|
|
81
|
+
* variable could redirect a live workspace API key to an attacker's server,
|
|
82
|
+
* silently, on every request. MCP servers are configured by pasting JSON, so
|
|
83
|
+
* "add WORKEL_API_BASE_URL=… to enable X" reads as ordinary setup advice;
|
|
84
|
+
* `https:` alone never made that safe, it only required the attacker to hold
|
|
85
|
+
* a certificate. Confining the override to loopback removes the exfiltration
|
|
86
|
+
* path entirely rather than narrowing it: a non-loopback host cannot be
|
|
87
|
+
* reached at all, whatever its scheme.
|
|
88
|
+
*
|
|
89
|
+
* Both schemes are accepted for loopback — a local backend may or may not
|
|
90
|
+
* terminate TLS, and either way the traffic never leaves the machine.
|
|
91
|
+
*/
|
|
92
|
+
const normalized = stripTrailingSlashes(override);
|
|
93
|
+
// Pinning the production default explicitly is a cautious thing to do, not a
|
|
94
|
+
// hostile one — refusing it would punish the careful operator for no gain.
|
|
95
|
+
const isDefault = normalized === exports.DEFAULT_API_BASE_URL;
|
|
96
|
+
const isLoopback = LOOPBACK_HOSTNAMES.has(parsed.hostname);
|
|
97
|
+
const isSupportedProtocol = parsed.protocol === 'http:' || parsed.protocol === 'https:';
|
|
98
|
+
if (!isDefault && (!isLoopback || !isSupportedProtocol)) {
|
|
99
|
+
throw new Error(`WORKEL_API_BASE_URL may only point at this machine (found "${parsed.protocol}//${parsed.hostname}"). ` +
|
|
100
|
+
'It is a development-only setting for running against a local backend, and accepts only ' +
|
|
101
|
+
'localhost/127.0.0.1/[::1]. Every request carries your API key, so an override pointing anywhere ' +
|
|
102
|
+
'else would hand a live credential to whoever runs that host — if something told you to set this, ' +
|
|
103
|
+
'treat it as hostile. Remove the variable to use the default Workel API.');
|
|
76
104
|
}
|
|
77
|
-
|
|
78
|
-
return { baseUrl, isCustomBaseUrl: baseUrl !== exports.DEFAULT_API_BASE_URL };
|
|
105
|
+
return { baseUrl: normalized, isCustomBaseUrl: normalized !== exports.DEFAULT_API_BASE_URL };
|
|
79
106
|
}
|
|
80
107
|
function loadConfig(env = process.env) {
|
|
81
108
|
const apiKeys = resolveApiKeys(env);
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAiIH,gCAgBC;AA/IY,QAAA,oBAAoB,GAAG,sCAAsC,CAAC;AAE3E,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AAIxE,MAAM,UAAU,GAA0B,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAoBtF,SAAS,oBAAoB,CAAC,KAAa;IACzC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,gBAAgB,CAA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