@tenkicloud/mcp 0.4.2 → 0.4.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/CHANGELOG.md +9 -0
- package/README.md +41 -40
- package/SECURITY.md +1 -1
- package/dist/client.js +1 -1
- package/dist/env.d.ts +4 -4
- package/dist/env.js +18 -16
- package/dist/index.js +5 -4
- package/dist/oauth.d.ts +1 -0
- package/dist/oauth.js +16 -9
- package/dist/server.d.ts +1 -1
- package/dist/server.js +2 -2
- package/dist/tools/auth_status.d.ts +2 -2
- package/dist/tools/auth_status.js +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@luxorai/mcp` (also published as `@tenkicloud/mcp`). This project follows semantic versioning.
|
|
4
4
|
|
|
5
|
+
## [0.4.4] - 2026-11-17
|
|
6
|
+
|
|
7
|
+
- Environment variables now use the `LUXOR_` prefix (for example `LUXOR_API_KEY`). `LUXORAI_*` variables are no longer read; `TENKI_*` still works as a fallback. `LUXOR_API_KEY` is only used when it starts with `lx_` or `tk_`.
|
|
8
|
+
|
|
9
|
+
## [0.4.3] - 2026-11-16
|
|
10
|
+
|
|
11
|
+
- The 401 challenge and protected-resource metadata match the request host even when it carries an explicit default port (`:443`); malformed Host headers fall back to the first resource.
|
|
12
|
+
- Protected-resource metadata `resource_name` is now `Luxor MCP`, configurable with `LUXORAI_MCP_RESOURCE_NAME` (or `TENKI_MCP_RESOURCE_NAME`).
|
|
13
|
+
|
|
5
14
|
## [0.4.2] - 2026-11-16
|
|
6
15
|
|
|
7
16
|
- The Docker image builds and runs on Node 22.23.5, from the Node.js 2026-11-11 security release, pinned by digest.
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ The old `@tenkicloud/mcp` name keeps working and publishes the same code.
|
|
|
16
16
|
## Quickstart
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
export
|
|
19
|
+
export LUXOR_API_KEY=lx_your_key_here
|
|
20
20
|
npx -y @luxorai/mcp # speaks MCP over stdio
|
|
21
21
|
```
|
|
22
22
|
|
|
@@ -36,7 +36,7 @@ Claude Code's `mcp add` command stores the server configuration; `mcp login` per
|
|
|
36
36
|
Alternatively, run the MCP server locally with an API key:
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
|
-
claude mcp add luxor --env
|
|
39
|
+
claude mcp add luxor --env LUXOR_API_KEY=lx_your_key_here -- npx -y @luxorai/mcp
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
### Or install it as a Claude Code plugin
|
|
@@ -45,10 +45,10 @@ The repo doubles as a plugin marketplace. This prompts for your API key on insta
|
|
|
45
45
|
|
|
46
46
|
```
|
|
47
47
|
/plugin marketplace add LuxorLabs/tenki-mcp
|
|
48
|
-
/plugin install luxor@
|
|
48
|
+
/plugin install luxor@luxor
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
If you added this marketplace before it was named `luxor`, your installs keep working as `luxor@tenki` and `tenki@tenki`. To switch to the new name, run `/plugin marketplace remove tenki` (this uninstalls its plugins and their saved API key), then add the marketplace again.
|
|
52
52
|
|
|
53
53
|
### Use it in Claude Desktop
|
|
54
54
|
|
|
@@ -60,7 +60,7 @@ Add to `claude_desktop_config.json`:
|
|
|
60
60
|
"luxor": {
|
|
61
61
|
"command": "npx",
|
|
62
62
|
"args": ["-y", "@luxorai/mcp"],
|
|
63
|
-
"env": { "
|
|
63
|
+
"env": { "LUXOR_API_KEY": "lx_your_key_here" }
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -76,7 +76,7 @@ Add the same block to `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (glob
|
|
|
76
76
|
"luxor": {
|
|
77
77
|
"command": "npx",
|
|
78
78
|
"args": ["-y", "@luxorai/mcp"],
|
|
79
|
-
"env": { "
|
|
79
|
+
"env": { "LUXOR_API_KEY": "lx_your_key_here" }
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -90,14 +90,14 @@ The OpenAI Codex CLI reads MCP servers from `~/.codex/config.toml`. Add:
|
|
|
90
90
|
[mcp_servers.luxor]
|
|
91
91
|
command = "npx"
|
|
92
92
|
args = ["-y", "@luxorai/mcp"]
|
|
93
|
-
env = {
|
|
93
|
+
env = { LUXOR_API_KEY = "lx_your_key_here" }
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
### Confirm it's working
|
|
97
97
|
|
|
98
98
|
After adding the server, **start a fresh session** so the client loads it, then ask your agent one of:
|
|
99
99
|
|
|
100
|
-
- _"Check
|
|
100
|
+
- _"Check Luxor auth status."_: confirms your credential was picked up.
|
|
101
101
|
- _"Run `print(2+2)` in a fresh Luxor sandbox."_: a full boot → run → teardown round-trip.
|
|
102
102
|
|
|
103
103
|
If the `tenki_*` tools don't show up, restart the client so it re-reads its config.
|
|
@@ -111,33 +111,34 @@ For development, or to run an unreleased change:
|
|
|
111
111
|
```bash
|
|
112
112
|
git clone https://github.com/LuxorLabs/tenki-mcp.git && cd tenki-mcp
|
|
113
113
|
npm install && npm run build
|
|
114
|
-
|
|
114
|
+
LUXOR_API_KEY=lx_your_key_here node dist/index.js
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
Substitute `node /absolute/path/to/tenki-mcp/dist/index.js` for the `npx` command in any of the configs above. See [CONTRIBUTING.md](CONTRIBUTING.md) for the full development loop.
|
|
118
118
|
|
|
119
119
|
### Environment variables
|
|
120
120
|
|
|
121
|
-
| Variable
|
|
122
|
-
|
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `PORT`
|
|
131
|
-
| `
|
|
132
|
-
| `
|
|
133
|
-
| `
|
|
134
|
-
| `
|
|
135
|
-
| `
|
|
136
|
-
| `
|
|
137
|
-
| `
|
|
138
|
-
| `
|
|
139
|
-
|
|
140
|
-
|
|
121
|
+
| Variable | Default | Purpose |
|
|
122
|
+
| ---------------------------------- | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
123
|
+
| `LUXOR_API_KEY` | - | API key (`lx_…`, or `tk_…`). One of this or `LUXOR_AUTH_TOKEN` is required. |
|
|
124
|
+
| `LUXOR_AUTH_TOKEN` | - | Session token (`ory_st_…` or cookie value). **Takes precedence over `LUXOR_API_KEY`** when both are set. |
|
|
125
|
+
| `LUXOR_API_ENDPOINT` | `https://api.luxor.ai` (the same API as `https://api.tenki.cloud`) | Control-plane base URL (`LUXOR_API_URL` is an alias). |
|
|
126
|
+
| `LUXOR_MCP_READONLY` | off | `1` registers only read tools (no create/run/delete/spend). |
|
|
127
|
+
| `LUXOR_MCP_DISABLED_TOOLS` | - | Comma-separated tool names to skip registering. |
|
|
128
|
+
| `LUXOR_MCP_AUDIT` | off | `1` logs each tool call name + arg keys to stderr. |
|
|
129
|
+
| `LUXOR_MCP_TRANSPORT` | `stdio` | `http` serves Streamable HTTP instead (see below). |
|
|
130
|
+
| `PORT` | `3000` | HTTP transport port. |
|
|
131
|
+
| `LUXOR_MCP_HTTP_HOST` | `127.0.0.1` | HTTP bind host; non-loopback requires `LUXOR_MCP_HTTP_TOKEN`. |
|
|
132
|
+
| `LUXOR_MCP_HTTP_TOKEN` | - | Bearer token for the HTTP endpoint; optional on loopback, required on a non-loopback host. |
|
|
133
|
+
| `LUXOR_MCP_PUBLIC_URL` | - | Public base URL for an OAuth-protected hosted server. |
|
|
134
|
+
| `LUXOR_MCP_OAUTH_ISSUER` | - | OAuth authorization-server issuer. Enables delegated OAuth HTTP mode. |
|
|
135
|
+
| `LUXOR_MCP_OAUTH_RESOURCE` | `<public URL>/mcp` | RFC 8707 resource identifier accepted in access-token audiences. A comma-separated list serves one resource per domain; metadata and the 401 `resource_metadata` follow the request host, else the first. |
|
|
136
|
+
| `LUXOR_MCP_OAUTH_SCOPE` | `mcp` | Required delegated scope. |
|
|
137
|
+
| `LUXOR_MCP_RESOURCE_NAME` | `Luxor MCP` | `resource_name` in the protected-resource metadata. |
|
|
138
|
+
| `LUXOR_MCP_IDENTITY_URL` | - | Internal Luxor Identity service endpoint used to exchange OAuth access tokens. |
|
|
139
|
+
| `LUXOR_MCP_IDENTITY_SERVICE_TOKEN` | - | Service credential for the private Identity token-exchange RPC. |
|
|
140
|
+
|
|
141
|
+
Every `LUXOR_*` variable above is still accepted under its `TENKI_*` name (for example `TENKI_API_KEY`, `TENKI_MCP_TRANSPORT`). All `LUXOR_*` credentials are read before any `TENKI_*` one. Keys start with `lx_`; `tk_…` keys are still accepted. `LUXOR_API_KEY` is only used when it starts with `lx_` or `tk_`; any other value is ignored.
|
|
141
142
|
|
|
142
143
|
## Tools
|
|
143
144
|
|
|
@@ -168,32 +169,32 @@ Full per-release breakdown in [CHANGELOG.md](CHANGELOG.md).
|
|
|
168
169
|
|
|
169
170
|
## Auth
|
|
170
171
|
|
|
171
|
-
Set one of `
|
|
172
|
+
Set one of `LUXOR_API_KEY` or `LUXOR_AUTH_TOKEN` (`TENKI_API_KEY` / `TENKI_AUTH_TOKEN` are still accepted). When both are set, the auth token wins. The header is chosen by token prefix: `lx_…` or `tk_…` → `Authorization: Bearer`, `ory_st_…` → `X-Session-Token`, otherwise a session cookie. Override the endpoint with `LUXOR_API_ENDPOINT` (default `https://api.luxor.ai`, the same API as `https://api.tenki.cloud`).
|
|
172
173
|
|
|
173
|
-
**Without a credential the server still starts**, registering only `tenki_auth_status`, so instead of an MCP client reporting an opaque "server failed to start", the agent can call that tool and get told what to set. Ask it "check
|
|
174
|
+
**Without a credential the server still starts**, registering only `tenki_auth_status`, so instead of an MCP client reporting an opaque "server failed to start", the agent can call that tool and get told what to set. Ask it "check Luxor auth status" any time other tools return auth errors: it reports the credential kind (API key vs session token), the endpoint, and whether a live identity probe succeeded, never the token itself. It reports status only; get a credential from the Luxor dashboard.
|
|
174
175
|
|
|
175
176
|
## Host it over HTTP (v2.0-beta)
|
|
176
177
|
|
|
177
178
|
Besides stdio, the server speaks **Streamable HTTP** so it can be hosted for remote MCP clients:
|
|
178
179
|
|
|
179
180
|
```bash
|
|
180
|
-
|
|
181
|
+
LUXOR_MCP_TRANSPORT=http PORT=3000 LUXOR_API_KEY=… npx -y @luxorai/mcp
|
|
181
182
|
# → tenki-mcp running on http://127.0.0.1:3000/mcp (Streamable HTTP) [loopback only, no auth]
|
|
182
183
|
```
|
|
183
184
|
|
|
184
|
-
For a single-user deployment, HTTP mode can hold one shared `
|
|
185
|
+
For a single-user deployment, HTTP mode can hold one shared `LUXOR_API_KEY` and therefore exposes a powerful capability. By default it:
|
|
185
186
|
|
|
186
|
-
- **binds to loopback (`127.0.0.1`) only**: set `
|
|
187
|
-
- it **requires a bearer token**: set `
|
|
187
|
+
- **binds to loopback (`127.0.0.1`) only**: set `LUXOR_MCP_HTTP_HOST=0.0.0.0` to expose it, but then
|
|
188
|
+
- it **requires a bearer token**: set `LUXOR_MCP_HTTP_TOKEN` and send `Authorization: Bearer <token>`. It **refuses to start** on a non-loopback host without one.
|
|
188
189
|
- **DNS-rebinding protection** is on (Host-header allowlist), so a malicious web page can't drive your local server.
|
|
189
190
|
|
|
190
191
|
```bash
|
|
191
192
|
# expose to a network safely:
|
|
192
|
-
|
|
193
|
-
|
|
193
|
+
LUXOR_MCP_TRANSPORT=http LUXOR_MCP_HTTP_HOST=0.0.0.0 PORT=3000 \
|
|
194
|
+
LUXOR_MCP_HTTP_TOKEN=$(openssl rand -hex 32) LUXOR_API_KEY=… npx -y @luxorai/mcp
|
|
194
195
|
```
|
|
195
196
|
|
|
196
|
-
Point an HTTP-capable MCP client at `/mcp`. Static-key mode uses one shared `
|
|
197
|
+
Point an HTTP-capable MCP client at `/mcp`. Static-key mode uses one shared `LUXOR_API_KEY` for all sessions. Verified end-to-end (`test/http-transport.test.mjs`: auth gate, DNS-rebinding rejection, connect → tools/list → tool call over HTTP).
|
|
197
198
|
|
|
198
199
|
Hosted multi-tenant deployments instead use Luxor Identity's OAuth facade. The MCP server publishes RFC 9728 protected-resource metadata and exchanges each caller's access token through the private Identity service. Identity owns Hydra, validates the requested audience and scope, and issues a short-lived API delegation bound to the user, client, and workspace selected on the Luxor consent page. `tenki-mcp` has no Hydra Admin access and does not hold the delegation-signing secret.
|
|
199
200
|
|
|
@@ -209,9 +210,9 @@ The wire details are ported from the live-verified [n8n community node](https://
|
|
|
209
210
|
|
|
210
211
|
This server holds a Luxor API key and can run code + spend credits, so treat it as a capability. Full model + [CSA MCP Server Top-10](https://modelcontextprotocol-security.io/top10/server/) mapping in **[SECURITY.md](SECURITY.md)**. Quick controls:
|
|
211
212
|
|
|
212
|
-
- **Least privilege:** every tool carries a title and MCP annotations: `readOnlyHint` on reads, and `destructiveHint` on every tool that can overwrite, modify, interrupt or delete existing state (only tools that create, resume, extend, attach or keep alive without changing existing state are non-destructive). Run `
|
|
213
|
+
- **Least privilege:** every tool carries a title and MCP annotations: `readOnlyHint` on reads, and `destructiveHint` on every tool that can overwrite, modify, interrupt or delete existing state (only tools that create, resume, extend, attach or keep alive without changing existing state are non-destructive). Run `LUXOR_MCP_READONLY=1` for an inspection-only server (read tools only), or `LUXOR_MCP_DISABLED_TOOLS=tenki_run_code,…` to drop specific tools.
|
|
213
214
|
- **HTTP transport** is loopback-only by default and requires a bearer token to expose to a network (see [Host it over HTTP](#host-it-over-http-v20-beta)).
|
|
214
|
-
- **Audit:** `
|
|
215
|
+
- **Audit:** `LUXOR_MCP_AUDIT=1` logs each tool call's name to stderr.
|
|
215
216
|
- **Untrusted output:** `tenki_run_code`/`tenki_exec`/`tenki_read_file` return output from untrusted code; clients should treat tool results as data, not instructions.
|
|
216
217
|
|
|
217
218
|
Report vulnerabilities via a private [security advisory](https://github.com/LuxorLabs/tenki-mcp/security/advisories/new), not a public issue.
|
package/SECURITY.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
Please **do not** open a public issue for security reports. Open a private [GitHub security advisory](https://github.com/LuxorLabs/tenki-mcp/security/advisories/new), or email **hello@luxor.tech**. We'll acknowledge within a few business days.
|
|
7
7
|
|
|
8
8
|
## Trust boundaries (read this first)
|
|
9
|
-
- **Credentials are capabilities.** Local and single-user modes authenticate with a `TENKI_API_KEY` or session token. Hosted OAuth mode exchanges each caller's token through Tenki Identity and receives only a short-lived, workspace-bound internal delegation to the Tenki API. Never commit credentials (`.env` is gitignored).
|
|
9
|
+
- **Credentials are capabilities.** Local and single-user modes authenticate with a `LUXOR_API_KEY` (or the legacy `TENKI_API_KEY`) or session token. Hosted OAuth mode exchanges each caller's token through Tenki Identity and receives only a short-lived, workspace-bound internal delegation to the Tenki API. Never commit credentials (`.env` is gitignored).
|
|
10
10
|
- **Sandbox output is untrusted.** `tenki_run_code` / `tenki_exec` / `tenki_read_file` return output produced by *untrusted, AI-generated code running in the sandbox*. That output flows back to the calling model as a tool result — a classic **indirect / output prompt-injection** vector. The microVM is the isolation boundary; the model should treat tool results as **data, not instructions**. (MCP clients are responsible for not executing instructions found in tool output.)
|
|
11
11
|
- **The HTTP endpoint is a capability.** In static-key HTTP mode, access to `/mcp` is equivalent to access to the configured key. Hosted mode requires a valid OAuth bearer on every request and binds the MCP session to its user, client, and workspace.
|
|
12
12
|
|
package/dist/client.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import { isApiKey } from "./env.js";
|
|
16
16
|
const CONTROL_SERVICE = "tenki.sandbox.v1.SandboxService";
|
|
17
17
|
const DATA_SERVICE = "tenki.sandbox.v1.SandboxSessionDataPlaneService";
|
|
18
|
-
const DEFAULT_BASE_URL = "https://api.
|
|
18
|
+
const DEFAULT_BASE_URL = "https://api.luxor.ai";
|
|
19
19
|
const MAX_RETRIES = 3;
|
|
20
20
|
const BACKOFF_BASE_MS = 500;
|
|
21
21
|
const BACKOFF_CAP_MS = 8000;
|
package/dist/env.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** Every `LUXORAI_<suffix>` is tried (in order) before any legacy `TENKI_<suffix>`. Empty or blank values fall through. */
|
|
2
|
-
export declare function readEnv(...suffixes: string[]): string | undefined;
|
|
3
|
-
/** The env var name {@link readEnv} resolved, for diagnostics. */
|
|
4
|
-
export declare function resolvedEnvName(env: NodeJS.ProcessEnv, ...suffixes: string[]): string | undefined;
|
|
5
1
|
/** API keys carry `lx_` (Luxor AI) or the legacy `tk_` prefix. */
|
|
6
2
|
export declare function isApiKey(token: string): boolean;
|
|
3
|
+
/** The env var name {@link readEnv} resolved, for diagnostics. */
|
|
4
|
+
export declare function resolvedEnvName(env: NodeJS.ProcessEnv, ...suffixes: string[]): string | undefined;
|
|
5
|
+
/** Every `LUXOR_<suffix>` is tried (in order) before any legacy `TENKI_<suffix>`. Empty or blank values fall through. */
|
|
6
|
+
export declare function readEnv(...suffixes: string[]): string | undefined;
|
package/dist/env.js
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
/**
|
|
2
|
-
export function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return
|
|
1
|
+
/** API keys carry `lx_` (Luxor AI) or the legacy `tk_` prefix. */
|
|
2
|
+
export function isApiKey(token) {
|
|
3
|
+
return token.startsWith("lx_") || token.startsWith("tk_");
|
|
4
|
+
}
|
|
5
|
+
/** `LUXOR_API_KEY` is also the Luxor Mining Pool key name, so it only counts with an `lx_`/`tk_` value. */
|
|
6
|
+
function usable(name, value) {
|
|
7
|
+
const trimmed = value?.trim();
|
|
8
|
+
if (!trimmed)
|
|
9
|
+
return false;
|
|
10
|
+
return name !== "LUXOR_API_KEY" || isApiKey(trimmed);
|
|
11
11
|
}
|
|
12
12
|
/** The env var name {@link readEnv} resolved, for diagnostics. */
|
|
13
13
|
export function resolvedEnvName(env, ...suffixes) {
|
|
14
|
-
for (const prefix of ["
|
|
14
|
+
for (const prefix of ["LUXOR_", "TENKI_"]) {
|
|
15
15
|
for (const suffix of suffixes) {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const name = `${prefix}${suffix}`;
|
|
17
|
+
if (usable(name, env[name]))
|
|
18
|
+
return name;
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
return undefined;
|
|
21
22
|
}
|
|
22
|
-
/**
|
|
23
|
-
export function
|
|
24
|
-
|
|
23
|
+
/** Every `LUXOR_<suffix>` is tried (in order) before any legacy `TENKI_<suffix>`. Empty or blank values fall through. */
|
|
24
|
+
export function readEnv(...suffixes) {
|
|
25
|
+
const name = resolvedEnvName(process.env, ...suffixes);
|
|
26
|
+
return name ? process.env[name] : undefined;
|
|
25
27
|
}
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - HTTP/SSE — set TENKI_MCP_TRANSPORT=http (+ PORT, default 3000) to host it.
|
|
12
12
|
*
|
|
13
13
|
* Tools live in self-registering modules under ./tools; the server factory is in
|
|
14
|
-
* ./server.ts. Auth: set
|
|
14
|
+
* ./server.ts. Auth: set LUXOR_API_KEY (or LUXOR_AUTH_TOKEN) in the environment; TENKI_* is the legacy fallback.
|
|
15
15
|
*/
|
|
16
16
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
17
17
|
import { TenkiClient } from "./client.js";
|
|
@@ -26,9 +26,10 @@ import { readEnv } from "./env.js";
|
|
|
26
26
|
const token = readEnv("AUTH_TOKEN", "API_KEY");
|
|
27
27
|
const oauthHttp = Boolean(readEnv("MCP_OAUTH_ISSUER"));
|
|
28
28
|
if (!token && !oauthHttp) {
|
|
29
|
-
console.error("tenki-mcp: no credential
|
|
30
|
-
"Set
|
|
31
|
-
"
|
|
29
|
+
console.error("tenki-mcp: no credential, starting in unauthenticated mode (only tenki_auth_status is available). " +
|
|
30
|
+
"Set LUXOR_API_KEY (lx_…) or LUXOR_AUTH_TOKEN (ory_st_…) in the server's env and restart " +
|
|
31
|
+
"(TENKI_API_KEY / TENKI_AUTH_TOKEN still work as the legacy fallback), " +
|
|
32
|
+
"e.g. claude mcp add tenki --env LUXOR_API_KEY=lx_… -- npx -y @tenkicloud/mcp");
|
|
32
33
|
}
|
|
33
34
|
const baseUrl = readEnv("API_ENDPOINT", "API_URL") || undefined;
|
|
34
35
|
/** Positive integer from env, or undefined so the client keeps its own default. */
|
package/dist/oauth.d.ts
CHANGED
package/dist/oauth.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { readEnv } from "./env.js";
|
|
3
3
|
const DEFAULT_SCOPE = "mcp";
|
|
4
|
+
const DEFAULT_RESOURCE_NAME = "Luxor MCP";
|
|
4
5
|
const FETCH_TIMEOUT_MS = 8_000;
|
|
5
6
|
const TOKEN_CACHE_MS = 15_000;
|
|
6
7
|
const EXCHANGE_PROCEDURE = "/tenki.cloud.identity.private.v1beta1.IdentityPrivateService/ExchangeMcpOAuthToken";
|
|
@@ -28,6 +29,7 @@ export function loadOAuthConfig() {
|
|
|
28
29
|
identityUrl,
|
|
29
30
|
identityServiceToken,
|
|
30
31
|
scope: (readEnv("MCP_OAUTH_SCOPE") || DEFAULT_SCOPE).trim(),
|
|
32
|
+
resourceName: (readEnv("MCP_RESOURCE_NAME") || DEFAULT_RESOURCE_NAME).trim(),
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
function tokenDigest(token) {
|
|
@@ -127,7 +129,7 @@ export class OAuthResourceRoutes {
|
|
|
127
129
|
authorization_servers: [this.config.issuer],
|
|
128
130
|
scopes_supported: [this.config.scope, "offline_access"],
|
|
129
131
|
bearer_methods_supported: ["header"],
|
|
130
|
-
resource_name:
|
|
132
|
+
resource_name: this.config.resourceName,
|
|
131
133
|
});
|
|
132
134
|
return true;
|
|
133
135
|
}
|
|
@@ -140,20 +142,25 @@ export class OAuthResourceRoutes {
|
|
|
140
142
|
}
|
|
141
143
|
/** The configured resource whose host matches the request (RFC 9728 requires an exact match), else the first. */
|
|
142
144
|
export function resourceForHost(config, host) {
|
|
143
|
-
|
|
144
|
-
return config.resources.find((resource) => urlHost(resource) === wanted) ?? config.resource;
|
|
145
|
+
return matchResource(config.resources, host) ?? config.resource;
|
|
145
146
|
}
|
|
146
147
|
/** Protected-resource metadata URL to advertise in a challenge, on the same host as the matched resource. */
|
|
147
148
|
export function metadataUrlForHost(config, host) {
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
if (!matched || wanted === urlHost(config.publicUrl))
|
|
149
|
+
const matched = matchResource(config.resources, host);
|
|
150
|
+
if (!matched || sameHost(config.publicUrl, host))
|
|
151
151
|
return config.metadataUrl;
|
|
152
152
|
return `${new URL(matched).origin}/.well-known/oauth-protected-resource/mcp`;
|
|
153
153
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
154
|
+
function matchResource(resources, host) {
|
|
155
|
+
return resources.find((resource) => sameHost(resource, host));
|
|
156
|
+
}
|
|
157
|
+
/** Whether a Host header names the URL's host; an explicit default port (`:443` for https) still matches. */
|
|
158
|
+
function sameHost(value, host) {
|
|
159
|
+
if (!host || /[\s/?#@\\]/.test(host) || !URL.canParse(value))
|
|
160
|
+
return false;
|
|
161
|
+
const url = new URL(value);
|
|
162
|
+
const candidate = `${url.protocol}//${host}`;
|
|
163
|
+
return URL.canParse(candidate) && new URL(candidate).host === url.host;
|
|
157
164
|
}
|
|
158
165
|
export function bearerToken(header) {
|
|
159
166
|
const match = /^Bearer (.+)$/.exec(header ?? "");
|
package/dist/server.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
17
17
|
import type { TenkiClient } from "./client.js";
|
|
18
|
-
export declare const VERSION = "0.4.
|
|
18
|
+
export declare const VERSION = "0.4.4";
|
|
19
19
|
/**
|
|
20
20
|
* Tool classes, mapped to MCP annotations by annotationsFor():
|
|
21
21
|
* read → readOnlyHint: true. Pure inspection: no state change, no spend.
|
package/dist/server.js
CHANGED
|
@@ -34,7 +34,7 @@ import { registerEgress } from "./tools/egress.js";
|
|
|
34
34
|
import { registerAuthStatus } from "./tools/auth_status.js";
|
|
35
35
|
import { readEnv } from "./env.js";
|
|
36
36
|
import { TOOL_TITLES } from "./tools/titles.js";
|
|
37
|
-
export const VERSION = "0.4.
|
|
37
|
+
export const VERSION = "0.4.4";
|
|
38
38
|
const modules = [
|
|
39
39
|
registerIdentity,
|
|
40
40
|
registerRun,
|
|
@@ -229,7 +229,7 @@ export function createServer(client) {
|
|
|
229
229
|
// TENKI_MCP_DISABLED_TOOLS can still drop it.
|
|
230
230
|
registerAuthStatus(guarded, client, opts.registered.count + 1);
|
|
231
231
|
if (!client)
|
|
232
|
-
console.error("tenki-mcp: no credential
|
|
232
|
+
console.error("tenki-mcp: no credential, only tenki_auth_status registered. Set LUXOR_API_KEY or LUXOR_AUTH_TOKEN (or the legacy TENKI_API_KEY / TENKI_AUTH_TOKEN) and restart.");
|
|
233
233
|
if (opts.readonly)
|
|
234
234
|
console.error("tenki-mcp: TENKI_MCP_READONLY — only read-only tools registered.");
|
|
235
235
|
else if (opts.disabled.size)
|
|
@@ -18,13 +18,13 @@ export type CredentialKind = "none" | "api_key" | "oauth_session_token" | "sessi
|
|
|
18
18
|
export interface CredentialInfo {
|
|
19
19
|
kind: CredentialKind;
|
|
20
20
|
/** Env var the token came from, or undefined when there is none. */
|
|
21
|
-
source?: "
|
|
21
|
+
source?: "LUXOR_AUTH_TOKEN" | "LUXOR_API_KEY" | "TENKI_AUTH_TOKEN" | "TENKI_API_KEY";
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
24
|
* Classify the ambient credential WITHOUT returning any of its material.
|
|
25
25
|
* Mirrors the header selection in client.ts (`lx_`/`tk_` → Bearer API key,
|
|
26
26
|
* `ory_st_` → OAuth/Ory session token, anything else → session cookie) and
|
|
27
|
-
* index.ts's precedence (
|
|
27
|
+
* index.ts's precedence (LUXOR_AUTH_TOKEN, LUXOR_API_KEY, TENKI_AUTH_TOKEN, TENKI_API_KEY).
|
|
28
28
|
*/
|
|
29
29
|
export declare function describeCredential(env?: NodeJS.ProcessEnv): CredentialInfo;
|
|
30
30
|
/**
|
|
@@ -4,7 +4,7 @@ import { isApiKey, readEnv, resolvedEnvName } from "../env.js";
|
|
|
4
4
|
* Classify the ambient credential WITHOUT returning any of its material.
|
|
5
5
|
* Mirrors the header selection in client.ts (`lx_`/`tk_` → Bearer API key,
|
|
6
6
|
* `ory_st_` → OAuth/Ory session token, anything else → session cookie) and
|
|
7
|
-
* index.ts's precedence (
|
|
7
|
+
* index.ts's precedence (LUXOR_AUTH_TOKEN, LUXOR_API_KEY, TENKI_AUTH_TOKEN, TENKI_API_KEY).
|
|
8
8
|
*/
|
|
9
9
|
export function describeCredential(env = process.env) {
|
|
10
10
|
const source = resolvedEnvName(env, "AUTH_TOKEN", "API_KEY");
|
|
@@ -20,7 +20,7 @@ export function describeCredential(env = process.env) {
|
|
|
20
20
|
return { kind: "session_cookie", source };
|
|
21
21
|
}
|
|
22
22
|
const CREDENTIAL_HELP = {
|
|
23
|
-
none: "No credential found. Set
|
|
23
|
+
none: "No credential found. Set LUXOR_API_KEY (an lx_… API key) or LUXOR_AUTH_TOKEN (an ory_st_… session token) in the server's environment (TENKI_API_KEY / TENKI_AUTH_TOKEN still work as the legacy fallback), then restart it. MCP clients pass env through their server config, e.g. `claude mcp add tenki --env LUXOR_API_KEY=lx_… -- npx -y @tenkicloud/mcp`, or the \"env\" block in claude_desktop_config.json / .cursor/mcp.json.",
|
|
24
24
|
api_key: "Authenticated with a tk_… API key (Authorization: Bearer).",
|
|
25
25
|
oauth_session_token: "Authenticated with an ory_st_… session token (X-Session-Token). Session tokens expire; an API key is the stabler choice for a long-running server.",
|
|
26
26
|
session_cookie: "Authenticated with a session cookie (the token matched neither the tk_ nor ory_st_ prefix, so it is sent as a tenki_session cookie). If that is not what you intended, check the value.",
|
|
@@ -34,7 +34,7 @@ const authOutputSchema = {
|
|
|
34
34
|
source: z
|
|
35
35
|
.string()
|
|
36
36
|
.optional()
|
|
37
|
-
.describe("Environment variable the credential came from (
|
|
37
|
+
.describe("Environment variable the credential came from (precedence: LUXOR_AUTH_TOKEN, LUXOR_API_KEY, TENKI_AUTH_TOKEN, TENKI_API_KEY)."),
|
|
38
38
|
endpoint: z.string().describe("Control-plane base URL the server is pointed at."),
|
|
39
39
|
toolsRegistered: z
|
|
40
40
|
.number()
|
|
@@ -63,7 +63,7 @@ export function registerAuthStatus(server, client, toolsRegistered) {
|
|
|
63
63
|
outputSchema: authOutputSchema,
|
|
64
64
|
}, async () => {
|
|
65
65
|
const cred = describeCredential();
|
|
66
|
-
const endpoint = readEnv("API_ENDPOINT", "API_URL") || "https://api.
|
|
66
|
+
const endpoint = readEnv("API_ENDPOINT", "API_URL") || "https://api.luxor.ai";
|
|
67
67
|
const base = {
|
|
68
68
|
credential: cred.kind,
|
|
69
69
|
...(cred.source ? { source: cred.source } : {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenkicloud/mcp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"mcpName": "io.github.LuxorLabs/tenki-mcp",
|
|
5
5
|
"description": "Model Context Protocol server for Luxor Sandbox (Luxor Agent Cloud): disposable microVM sandboxes for AI agents. Create sandboxes, run code, read/write files, run git, expose preview URLs, from any MCP client.",
|
|
6
6
|
"type": "module",
|