豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 00e3560

Browse files
committed
build: update verify server.json
1 parent 8f3fcf6 commit 00e3560

File tree

4 files changed

+55
-26
lines changed

4 files changed

+55
-26
lines changed

.github/workflows/pre-release.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Pre-release
33
permissions: read-all
44

55
on:
6+
workflow_dispatch:
67
push:
78
branches:
89
- release-please-*
@@ -23,10 +24,6 @@ jobs:
2324
cache: npm
2425
node-version-file: '.nvmrc'
2526

26-
- name: Install MCP Publisher
27-
run: |
28-
export OS=$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
29-
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_${OS}.tar.gz" | tar xz mcp-publisher
3027

3128
- name: Verify server.json
3229
run: npm run verify-server-json-version

GEMINI.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Instructions
22

3-
- use `npm run build` to run tsc and test build
4-
- use `npm run test` to run tests, run all tests to verify correctness
3+
- use `npm run build` to run tsc and test build.
4+
- use `npm run test` to run tests, run all tests to verify correctness.
5+
- use only scripts from `package.json` to run commands.

scripts/verify-server-json-version.ts

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,62 @@
66

77
import {execSync} from 'node:child_process';
88
import fs from 'node:fs';
9+
import path from 'node:path';
10+
import os from 'node:os';
911

10-
const serverJsonFilePath = './server.json';
12+
const serverJsonFilePath = path.join(process.cwd(), 'server.json');
1113
const serverJson = JSON.parse(fs.readFileSync(serverJsonFilePath, 'utf-8'));
12-
fs.unlinkSync(serverJsonFilePath);
1314

14-
// Create the new server.json
15-
execSync('./mcp-publisher init');
15+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mcp-verify-'));
1616

17-
const newServerJson = JSON.parse(fs.readFileSync(serverJsonFilePath, 'utf-8'));
17+
try {
18+
const osName = os.platform();
19+
const arch = os.arch();
20+
let platform = '';
21+
if (osName === 'darwin') platform = 'darwin';
22+
else if (osName === 'linux') platform = 'linux';
23+
// mcp-publisher does not support windows
24+
else throw new Error(`Unsupported platform: ${osName}`);
1825

19-
const propertyToVerify = ['$schema'];
20-
const diffProps = [];
26+
let archName = '';
27+
if (arch === 'x64') archName = 'amd64';
28+
else if (arch === 'arm64') archName = 'arm64';
29+
else throw new Error(`Unsupported architecture: ${arch}`);
2130

22-
for (const prop of propertyToVerify) {
23-
if (serverJson[prop] !== newServerJson[prop]) {
24-
diffProps.push(prop);
25-
}
26-
}
31+
const osArch = `${platform}_${archName}`;
32+
const binName = 'mcp-publisher';
33+
const downloadUrl = `https://github.com/modelcontextprotocol/registry/releases/latest/download/${binName}_${osArch}.tar.gz`;
34+
35+
console.log(`Downloading ${binName} from ${downloadUrl}`);
36+
const downloadCmd = `curl -L "${downloadUrl}" | tar xz -C "${tmpDir}" ${binName}`;
37+
execSync(downloadCmd, { stdio: 'inherit' });
38+
39+
const publisherPath = path.join(tmpDir, binName);
40+
fs.chmodSync(publisherPath, 0o755);
41+
console.log(`Downloaded to ${publisherPath}`);
42+
43+
// Create the new server.json in the temporary directory
44+
execSync(`${publisherPath} init`, { cwd: tmpDir, stdio: 'inherit' });
2745

28-
fs.writeFileSync('./server.json', JSON.stringify(serverJson, null, 2));
46+
const newServerJsonPath = path.join(tmpDir, 'server.json');
47+
const newServerJson = JSON.parse(fs.readFileSync(newServerJsonPath, 'utf-8'));
2948

30-
if (diffProps.length) {
31-
throw new Error(
32-
`The following props did not match the latest init value:\n${diffProps.map(
33-
prop => `- "${prop}": "${newServerJson[prop]}"`,
34-
)}`,
35-
);
49+
const propertyToVerify = ['$schema'];
50+
const diffProps = [];
51+
52+
for (const prop of propertyToVerify) {
53+
if (serverJson[prop] !== newServerJson[prop]) {
54+
diffProps.push(prop);
55+
}
56+
}
57+
58+
if (diffProps.length) {
59+
throw new Error(
60+
`The following props in ${serverJsonFilePath} did not match the latest init value:\n${diffProps.map(
61+
prop => `- "${prop}": expected "${newServerJson[prop]}", got "${serverJson[prop]}"`,
62+
)}`,
63+
);
64+
}
65+
} finally {
66+
fs.rmSync(tmpDir, { recursive: true, force: true });
3667
}

server.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-10-17/server.schema.json",
2+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
33
"name": "io.github.ChromeDevTools/chrome-devtools-mcp",
44
"title": "Chrome DevTools MCP",
55
"description": "MCP server for Chrome DevTools",

0 commit comments

Comments
 (0)