zerno-mcp 0.1.2 → 0.1.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 +1 -1
- package/dist/setup.js +29 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ if (process.argv[2] === "setup") {
|
|
|
22
22
|
process.exit(0);
|
|
23
23
|
}
|
|
24
24
|
const client = await import("./zerno-client.js");
|
|
25
|
-
const server = new Server({ name: "zerno-mcp", version: "0.1.
|
|
25
|
+
const server = new Server({ name: "zerno-mcp", version: "0.1.4" }, { capabilities: { tools: {} } });
|
|
26
26
|
function asRecord(value) {
|
|
27
27
|
if (value && typeof value === "object") {
|
|
28
28
|
return value;
|
package/dist/setup.js
CHANGED
|
@@ -5,7 +5,7 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
|
5
5
|
import { homedir, platform } from "node:os";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
7
7
|
const DEFAULT_API_URL = "https://zerno.one";
|
|
8
|
-
const PACKAGE_SPEC = "zerno-mcp@0.1.
|
|
8
|
+
const PACKAGE_SPEC = "zerno-mcp@0.1.4";
|
|
9
9
|
const MANAGED_START = "# ZERNO MCP:START";
|
|
10
10
|
const MANAGED_END = "# ZERNO MCP:END";
|
|
11
11
|
function argValue(args, name) {
|
|
@@ -130,10 +130,26 @@ async function oauthConnect(apiUrl) {
|
|
|
130
130
|
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
131
131
|
body: form.toString(),
|
|
132
132
|
});
|
|
133
|
+
if (!token.access_token) {
|
|
134
|
+
throw new Error("OAuth token response missing access_token");
|
|
135
|
+
}
|
|
136
|
+
if (!token.project_id) {
|
|
137
|
+
throw new Error("OAuth token response missing project_id — backend likely on an old build. Re-run setup against the updated server.");
|
|
138
|
+
}
|
|
133
139
|
return { token: token.access_token, projectId: token.project_id };
|
|
134
140
|
}
|
|
135
141
|
function runtimeEnv(apiUrl, rawToken, projectId) {
|
|
136
|
-
|
|
142
|
+
const env = {
|
|
143
|
+
ZERNO_API_URL: apiUrl,
|
|
144
|
+
ZERNO_API_TOKEN: rawToken,
|
|
145
|
+
ZERNO_PROJECT_ID: projectId,
|
|
146
|
+
};
|
|
147
|
+
for (const [key, value] of Object.entries(env)) {
|
|
148
|
+
if (!value || typeof value !== "string") {
|
|
149
|
+
throw new Error(`Refusing to write config: env value for ${key} is empty`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return env;
|
|
137
153
|
}
|
|
138
154
|
function writeJson(filePath, value) {
|
|
139
155
|
mkdirSync(dirname(filePath), { recursive: true });
|
|
@@ -155,6 +171,9 @@ function readJson(filePath) {
|
|
|
155
171
|
return JSON.parse(stripJsonComments(readFileSync(filePath, "utf8")));
|
|
156
172
|
}
|
|
157
173
|
function quoteToml(value) {
|
|
174
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
175
|
+
throw new Error(`Cannot serialise empty value to TOML string`);
|
|
176
|
+
}
|
|
158
177
|
return JSON.stringify(value);
|
|
159
178
|
}
|
|
160
179
|
function codexConfigPath() {
|
|
@@ -221,17 +240,22 @@ function writeClaudeCode(env) {
|
|
|
221
240
|
export async function runSetup(args) {
|
|
222
241
|
if (args.includes("--help") || args.includes("-h")) {
|
|
223
242
|
console.log([
|
|
224
|
-
"Usage: npx -y zerno-mcp@0.1.
|
|
243
|
+
"Usage: npx -y zerno-mcp@0.1.4 setup [--api-url https://zerno.one]",
|
|
225
244
|
"",
|
|
226
245
|
"Opens the hosted ZERNO OAuth consent screen, lets the user choose a project,",
|
|
227
|
-
"and writes local Codex, Claude Desktop, and OpenCode MCP configs.",
|
|
246
|
+
"and writes local Codex, Claude Desktop, Claude Code, and OpenCode MCP configs.",
|
|
228
247
|
].join("\n"));
|
|
229
248
|
return;
|
|
230
249
|
}
|
|
231
250
|
const apiUrl = argValue(args, "--api-url") || DEFAULT_API_URL;
|
|
232
251
|
const auth = await oauthConnect(apiUrl);
|
|
233
252
|
const env = runtimeEnv(apiUrl, auth.token, auth.projectId);
|
|
234
|
-
const written = [
|
|
253
|
+
const written = [
|
|
254
|
+
["Codex", writeCodex(env)],
|
|
255
|
+
["Claude Desktop", writeClaude(env)],
|
|
256
|
+
["Claude Code", writeClaudeCode(env)],
|
|
257
|
+
["OpenCode", writeOpenCode(env)],
|
|
258
|
+
];
|
|
235
259
|
console.log("\nZERNO MCP is configured.");
|
|
236
260
|
for (const [client, filePath] of written)
|
|
237
261
|
console.log(`- ${client}: ${filePath}`);
|