@yawlabs/tailscale-mcp 0.6.3 → 0.6.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/dist/index.js +30 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21021,8 +21021,9 @@ function getConfig() {
|
|
|
21021
21021
|
const oauthClientSecret = process.env.TAILSCALE_OAUTH_CLIENT_SECRET;
|
|
21022
21022
|
const tailnet = process.env.TAILSCALE_TAILNET || "-";
|
|
21023
21023
|
if (!apiKey && !(oauthClientId && oauthClientSecret)) {
|
|
21024
|
+
const hint = process.platform === "win32" ? ' On Windows, env vars set in bash/WSL profiles are not visible to MCP servers launched via cmd. Either add "env": {"TAILSCALE_API_KEY": "tskey-api-..."} to your .mcp.json, or set it as a Windows user environment variable.' : "";
|
|
21024
21025
|
throw new Error(
|
|
21025
|
-
|
|
21026
|
+
`No Tailscale credentials configured. Set TAILSCALE_API_KEY, or set both TAILSCALE_OAUTH_CLIENT_ID and TAILSCALE_OAUTH_CLIENT_SECRET.${hint}`
|
|
21026
21027
|
);
|
|
21027
21028
|
}
|
|
21028
21029
|
if (apiKey && apiKey.trim() === "") {
|
|
@@ -21082,6 +21083,29 @@ function encPath(segment) {
|
|
|
21082
21083
|
function sanitizeDescription(value) {
|
|
21083
21084
|
return value.replace(/[/_]/g, "-").replace(/[^a-zA-Z0-9 -]/g, "").replace(/ {2,}/g, " ").trim().slice(0, 50);
|
|
21084
21085
|
}
|
|
21086
|
+
function formatAuthError(apiBody) {
|
|
21087
|
+
const usingOAuth = !process.env.TAILSCALE_API_KEY && process.env.TAILSCALE_OAUTH_CLIENT_ID;
|
|
21088
|
+
const lines = [
|
|
21089
|
+
"Authentication failed (HTTP 401).",
|
|
21090
|
+
"",
|
|
21091
|
+
"Possible causes:",
|
|
21092
|
+
usingOAuth ? " - OAuth client credentials are invalid or lack required scopes" : " - API key has expired or been revoked"
|
|
21093
|
+
];
|
|
21094
|
+
if (process.platform === "win32" && !usingOAuth) {
|
|
21095
|
+
lines.push(
|
|
21096
|
+
" - On Windows, env vars set in bash/WSL profiles are not visible to MCP servers launched via cmd",
|
|
21097
|
+
"",
|
|
21098
|
+
"Fix options:",
|
|
21099
|
+
' 1. Add "env": {"TAILSCALE_API_KEY": "tskey-api-..."} to your .mcp.json',
|
|
21100
|
+
" 2. Set TAILSCALE_API_KEY as a Windows user environment variable (System Properties > Environment Variables)"
|
|
21101
|
+
);
|
|
21102
|
+
}
|
|
21103
|
+
lines.push("", "Generate a new key at: https://login.tailscale.com/admin/settings/keys");
|
|
21104
|
+
if (apiBody) {
|
|
21105
|
+
lines.push("", `API response: ${apiBody}`);
|
|
21106
|
+
}
|
|
21107
|
+
return lines.join("\n");
|
|
21108
|
+
}
|
|
21085
21109
|
async function apiRequest(method, path, body, options) {
|
|
21086
21110
|
const auth = await getAuthHeader();
|
|
21087
21111
|
const headers = {
|
|
@@ -21112,13 +21136,15 @@ async function apiRequest(method, path, body, options) {
|
|
|
21112
21136
|
if (options?.acceptRaw) {
|
|
21113
21137
|
const rawBody = await res.text();
|
|
21114
21138
|
if (!res.ok) {
|
|
21115
|
-
|
|
21139
|
+
const error2 = res.status === 401 ? formatAuthError(rawBody) : rawBody;
|
|
21140
|
+
return { ok: false, status: res.status, error: error2, rawBody, etag };
|
|
21116
21141
|
}
|
|
21117
21142
|
return { ok: true, status: res.status, rawBody, etag };
|
|
21118
21143
|
}
|
|
21119
21144
|
if (!res.ok) {
|
|
21120
21145
|
const errorBody = await res.text();
|
|
21121
|
-
|
|
21146
|
+
const error2 = res.status === 401 ? formatAuthError(errorBody) : errorBody;
|
|
21147
|
+
return { ok: false, status: res.status, error: error2, etag };
|
|
21122
21148
|
}
|
|
21123
21149
|
if (res.status === 204 || res.headers.get("content-length") === "0") {
|
|
21124
21150
|
return { ok: true, status: res.status, etag };
|
|
@@ -23325,7 +23351,7 @@ var workloadIdentityTools = [
|
|
|
23325
23351
|
];
|
|
23326
23352
|
|
|
23327
23353
|
// src/index.ts
|
|
23328
|
-
var version2 = true ? "0.6.
|
|
23354
|
+
var version2 = true ? "0.6.4" : (await null).createRequire(import.meta.url)("../package.json").version;
|
|
23329
23355
|
var subcommand = process.argv[2];
|
|
23330
23356
|
if (subcommand === "deploy-acl") {
|
|
23331
23357
|
const filePath = process.argv[3];
|