@tempad-dev/mcp 0.7.1 → 0.8.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 +42 -5
- package/README.zh-Hans.md +36 -4
- package/dist/cli.mjs +11 -1
- package/dist/cli.mjs.map +1 -1
- package/dist/hub.mjs +3067 -711
- package/dist/hub.mjs.map +1 -1
- package/dist/shared--YD93aQ6.mjs +2491 -0
- package/dist/shared--YD93aQ6.mjs.map +1 -0
- package/package.json +14 -11
- package/dist/shared-Df79xZoB.mjs +0 -120
- package/dist/shared-Df79xZoB.mjs.map +0 -1
package/dist/shared-Df79xZoB.mjs
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { join } from "node:path";
|
|
2
|
-
import { closeSync, mkdirSync, openSync } from "node:fs";
|
|
3
|
-
import { tmpdir } from "node:os";
|
|
4
|
-
import pino from "pino";
|
|
5
|
-
//#region package.json
|
|
6
|
-
var package_default = {
|
|
7
|
-
name: "@tempad-dev/mcp",
|
|
8
|
-
version: "0.7.1",
|
|
9
|
-
description: "MCP server for TemPad Dev.",
|
|
10
|
-
repository: {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/ecomfe/tempad-dev.git",
|
|
13
|
-
"directory": "packages/mcp-server"
|
|
14
|
-
},
|
|
15
|
-
bin: "dist/cli.mjs",
|
|
16
|
-
files: ["README.md", "dist/**/*"],
|
|
17
|
-
type: "module",
|
|
18
|
-
main: "dist/cli.mjs",
|
|
19
|
-
publishConfig: { "access": "public" },
|
|
20
|
-
scripts: {
|
|
21
|
-
"build": "tsdown",
|
|
22
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
23
|
-
"test": "vitest --config vitest.config.ts",
|
|
24
|
-
"test:run": "vitest run --config vitest.config.ts",
|
|
25
|
-
"test:coverage": "vitest run --config vitest.config.ts --coverage",
|
|
26
|
-
"lint": "eslint . --ext .ts,.mts,.cts,.js,.mjs,.cjs",
|
|
27
|
-
"lint:fix": "eslint . --fix --ext .ts,.mts,.cts,.js,.mjs,.cjs",
|
|
28
|
-
"format": "oxfmt -c ../../.oxfmtrc.json --ignore-path ../../.gitignore",
|
|
29
|
-
"format:check": "oxfmt -c ../../.oxfmtrc.json --ignore-path ../../.gitignore --check",
|
|
30
|
-
"prepublishOnly": "pnpm run build"
|
|
31
|
-
},
|
|
32
|
-
dependencies: {
|
|
33
|
-
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
34
|
-
"nanoid": "^5.1.16",
|
|
35
|
-
"pino": "^10.3.1",
|
|
36
|
-
"pino-pretty": "^13.1.3",
|
|
37
|
-
"proper-lockfile": "^4.1.2",
|
|
38
|
-
"ws": "^8.21.0",
|
|
39
|
-
"zod": "^4.4.3"
|
|
40
|
-
},
|
|
41
|
-
devDependencies: {
|
|
42
|
-
"@tempad-dev/shared": "workspace:^0.1.0",
|
|
43
|
-
"@types/node": "^24.13.2",
|
|
44
|
-
"@types/proper-lockfile": "^4.1.4",
|
|
45
|
-
"@types/ws": "^8.18.1",
|
|
46
|
-
"tsdown": "^0.22.3",
|
|
47
|
-
"typescript": "^6.0.3",
|
|
48
|
-
"unplugin-raw": "^0.7.0",
|
|
49
|
-
"vitest": "4.1.10"
|
|
50
|
-
},
|
|
51
|
-
engines: { "node": ">=18.20.0" }
|
|
52
|
-
};
|
|
53
|
-
//#endregion
|
|
54
|
-
//#region src/shared.ts
|
|
55
|
-
function normalizePackageVersion(version) {
|
|
56
|
-
return typeof version === "string" ? version : "0.0.0";
|
|
57
|
-
}
|
|
58
|
-
function ensureDir(dirPath) {
|
|
59
|
-
mkdirSync(dirPath, {
|
|
60
|
-
recursive: true,
|
|
61
|
-
mode: 448
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
function getRecordProperty(record, key) {
|
|
65
|
-
if (!record || typeof record !== "object") return;
|
|
66
|
-
return Reflect.get(record, key);
|
|
67
|
-
}
|
|
68
|
-
const PACKAGE_VERSION = normalizePackageVersion(getRecordProperty(package_default, "version"));
|
|
69
|
-
function resolveRuntimeDir(env = process.env, systemTmpDir = tmpdir()) {
|
|
70
|
-
if (env.TEMPAD_MCP_RUNTIME_DIR) return env.TEMPAD_MCP_RUNTIME_DIR;
|
|
71
|
-
return join(systemTmpDir, "tempad-dev", "run");
|
|
72
|
-
}
|
|
73
|
-
function resolveLogDir(env = process.env, systemTmpDir = tmpdir()) {
|
|
74
|
-
if (env.TEMPAD_MCP_LOG_DIR) return env.TEMPAD_MCP_LOG_DIR;
|
|
75
|
-
return join(systemTmpDir, "tempad-dev", "log");
|
|
76
|
-
}
|
|
77
|
-
function resolveAssetDir(env = process.env, systemTmpDir = tmpdir()) {
|
|
78
|
-
if (env.TEMPAD_MCP_ASSET_DIR) return env.TEMPAD_MCP_ASSET_DIR;
|
|
79
|
-
return join(systemTmpDir, "tempad-dev", "assets");
|
|
80
|
-
}
|
|
81
|
-
function resolveLogLevel(debugValue = process.env.DEBUG) {
|
|
82
|
-
return debugValue ? "debug" : "info";
|
|
83
|
-
}
|
|
84
|
-
function resolveSockPath(platform = process.platform, runtimeDir = RUNTIME_DIR) {
|
|
85
|
-
return platform === "win32" ? "\\\\.\\pipe\\tempad-mcp" : join(runtimeDir, "mcp.sock");
|
|
86
|
-
}
|
|
87
|
-
const RUNTIME_DIR = resolveRuntimeDir();
|
|
88
|
-
const LOG_DIR = resolveLogDir();
|
|
89
|
-
const ASSET_DIR = resolveAssetDir();
|
|
90
|
-
ensureDir(RUNTIME_DIR);
|
|
91
|
-
ensureDir(LOG_DIR);
|
|
92
|
-
ensureDir(ASSET_DIR);
|
|
93
|
-
function ensureFile(filePath) {
|
|
94
|
-
closeSync(openSync(filePath, "a"));
|
|
95
|
-
}
|
|
96
|
-
const LOCK_PATH = join(RUNTIME_DIR, "mcp.lock");
|
|
97
|
-
const HUB_LOCK_PATH = join(RUNTIME_DIR, "hub.lock");
|
|
98
|
-
ensureFile(LOCK_PATH);
|
|
99
|
-
ensureFile(HUB_LOCK_PATH);
|
|
100
|
-
const HUB_LOCK_STALE_MS = 6e4;
|
|
101
|
-
const HUB_LOCK_UPDATE_MS = 1e4;
|
|
102
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-").replaceAll(".", "-");
|
|
103
|
-
const pid = process.pid;
|
|
104
|
-
const LOG_FILE = join(LOG_DIR, `mcp-${timestamp}-${pid}.log`);
|
|
105
|
-
const prettyTransport = pino.transport({
|
|
106
|
-
target: "pino-pretty",
|
|
107
|
-
options: {
|
|
108
|
-
translateTime: "SYS:HH:MM:ss",
|
|
109
|
-
destination: LOG_FILE
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
const log = pino({
|
|
113
|
-
level: resolveLogLevel(),
|
|
114
|
-
msgPrefix: "[tempad-dev/mcp] "
|
|
115
|
-
}, prettyTransport);
|
|
116
|
-
const SOCK_PATH = resolveSockPath();
|
|
117
|
-
//#endregion
|
|
118
|
-
export { LOCK_PATH as a, SOCK_PATH as c, log as d, HUB_LOCK_UPDATE_MS as i, ensureDir as l, HUB_LOCK_PATH as n, PACKAGE_VERSION as o, HUB_LOCK_STALE_MS as r, RUNTIME_DIR as s, ASSET_DIR as t, ensureFile as u };
|
|
119
|
-
|
|
120
|
-
//# sourceMappingURL=shared-Df79xZoB.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shared-Df79xZoB.mjs","names":["packageJson"],"sources":["../package.json","../src/shared.ts"],"sourcesContent":["","import { closeSync, mkdirSync, openSync } from 'node:fs'\nimport { tmpdir } from 'node:os'\nimport { join } from 'node:path'\nimport pino from 'pino'\n\nimport packageJson from '../package.json' with { type: 'json' }\n\nexport function normalizePackageVersion(version: unknown): string {\n return typeof version === 'string' ? version : '0.0.0'\n}\n\nexport function ensureDir(dirPath: string): void {\n mkdirSync(dirPath, { recursive: true, mode: 0o700 })\n}\n\nfunction getRecordProperty(record: unknown, key: string): unknown {\n if (!record || typeof record !== 'object') {\n return undefined\n }\n return Reflect.get(record, key)\n}\n\nexport const PACKAGE_VERSION = normalizePackageVersion(getRecordProperty(packageJson, 'version'))\n\nexport function resolveRuntimeDir(\n env: NodeJS.ProcessEnv = process.env,\n systemTmpDir: string = tmpdir()\n): string {\n if (env.TEMPAD_MCP_RUNTIME_DIR) return env.TEMPAD_MCP_RUNTIME_DIR\n return join(systemTmpDir, 'tempad-dev', 'run')\n}\n\nexport function resolveLogDir(\n env: NodeJS.ProcessEnv = process.env,\n systemTmpDir: string = tmpdir()\n): string {\n if (env.TEMPAD_MCP_LOG_DIR) return env.TEMPAD_MCP_LOG_DIR\n return join(systemTmpDir, 'tempad-dev', 'log')\n}\n\nexport function resolveAssetDir(\n env: NodeJS.ProcessEnv = process.env,\n systemTmpDir: string = tmpdir()\n): string {\n if (env.TEMPAD_MCP_ASSET_DIR) return env.TEMPAD_MCP_ASSET_DIR\n return join(systemTmpDir, 'tempad-dev', 'assets')\n}\n\nexport function resolveLogLevel(\n debugValue: string | undefined = process.env.DEBUG\n): 'debug' | 'info' {\n return debugValue ? 'debug' : 'info'\n}\n\nexport function resolveSockPath(\n platform: NodeJS.Platform = process.platform,\n runtimeDir: string = RUNTIME_DIR\n): string {\n return platform === 'win32' ? '\\\\\\\\.\\\\pipe\\\\tempad-mcp' : join(runtimeDir, 'mcp.sock')\n}\n\nexport const RUNTIME_DIR = resolveRuntimeDir()\nexport const LOG_DIR = resolveLogDir()\nexport const ASSET_DIR = resolveAssetDir()\n\nensureDir(RUNTIME_DIR)\nensureDir(LOG_DIR)\nensureDir(ASSET_DIR)\n\nexport function ensureFile(filePath: string): void {\n const fd = openSync(filePath, 'a')\n closeSync(fd)\n}\n\nexport const LOCK_PATH = join(RUNTIME_DIR, 'mcp.lock')\nexport const HUB_LOCK_PATH = join(RUNTIME_DIR, 'hub.lock')\nensureFile(LOCK_PATH)\nensureFile(HUB_LOCK_PATH)\n\nexport const HUB_BUSY_EXIT_CODE = 75\nexport const HUB_LOCK_STALE_MS = 60000\nexport const HUB_LOCK_UPDATE_MS = 10000\n\nconst timestamp = new Date().toISOString().replaceAll(':', '-').replaceAll('.', '-')\nconst pid = process.pid\nconst LOG_FILE = join(LOG_DIR, `mcp-${timestamp}-${pid}.log`)\n\nconst prettyTransport = pino.transport({\n target: 'pino-pretty',\n options: {\n translateTime: 'SYS:HH:MM:ss',\n destination: LOG_FILE\n }\n})\n\nexport const log = pino(\n {\n level: resolveLogLevel(),\n msgPrefix: '[tempad-dev/mcp] '\n },\n prettyTransport\n)\n\nexport const SOCK_PATH = resolveSockPath()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACOA,SAAgB,wBAAwB,SAA0B;CAChE,OAAO,OAAO,YAAY,WAAW,UAAU;AACjD;AAEA,SAAgB,UAAU,SAAuB;CAC/C,UAAU,SAAS;EAAE,WAAW;EAAM,MAAM;CAAM,CAAC;AACrD;AAEA,SAAS,kBAAkB,QAAiB,KAAsB;CAChE,IAAI,CAAC,UAAU,OAAO,WAAW,UAC/B;CAEF,OAAO,QAAQ,IAAI,QAAQ,GAAG;AAChC;AAEA,MAAa,kBAAkB,wBAAwB,kBAAkBA,iBAAa,SAAS,CAAC;AAEhG,SAAgB,kBACd,MAAyB,QAAQ,KACjC,eAAuB,OAAO,GACtB;CACR,IAAI,IAAI,wBAAwB,OAAO,IAAI;CAC3C,OAAO,KAAK,cAAc,cAAc,KAAK;AAC/C;AAEA,SAAgB,cACd,MAAyB,QAAQ,KACjC,eAAuB,OAAO,GACtB;CACR,IAAI,IAAI,oBAAoB,OAAO,IAAI;CACvC,OAAO,KAAK,cAAc,cAAc,KAAK;AAC/C;AAEA,SAAgB,gBACd,MAAyB,QAAQ,KACjC,eAAuB,OAAO,GACtB;CACR,IAAI,IAAI,sBAAsB,OAAO,IAAI;CACzC,OAAO,KAAK,cAAc,cAAc,QAAQ;AAClD;AAEA,SAAgB,gBACd,aAAiC,QAAQ,IAAI,OAC3B;CAClB,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