@agimon-ai/model-proxy-mcp 0.2.1 → 0.2.3

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +36 -14
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -143,27 +143,49 @@ var HttpServerManager = class {
143
143
  return false;
144
144
  }
145
145
  }
146
+ async resolveCliPath() {
147
+ const currentDir = path.dirname(fileURLToPath(import.meta.url));
148
+ const sameDirCliPath = path.resolve(currentDir, "cli.mjs");
149
+ if (await this.fileExists(sameDirCliPath)) return {
150
+ cliPath: sameDirCliPath,
151
+ useLoader: false
152
+ };
153
+ const parentDirCliPath = path.resolve(currentDir, "..", "cli.mjs");
154
+ if (await this.fileExists(parentDirCliPath)) return {
155
+ cliPath: parentDirCliPath,
156
+ useLoader: false
157
+ };
158
+ for (const relPath of [path.resolve(currentDir, "cli.ts"), path.resolve(currentDir, "..", "cli.ts")]) if (await this.fileExists(relPath)) return {
159
+ cliPath: relPath,
160
+ useLoader: true
161
+ };
162
+ const repoDistCliPath = path.join(this.repositoryPath, "packages", "mcp", "model-proxy-mcp", "dist", "cli.mjs");
163
+ if (await this.fileExists(repoDistCliPath)) return {
164
+ cliPath: repoDistCliPath,
165
+ useLoader: false
166
+ };
167
+ const repoSrcCliPath = path.join(this.repositoryPath, "packages", "mcp", "model-proxy-mcp", "src", "cli.ts");
168
+ if (await this.fileExists(repoSrcCliPath)) return {
169
+ cliPath: repoSrcCliPath,
170
+ useLoader: true
171
+ };
172
+ throw new Error("Cannot find model-proxy-mcp CLI");
173
+ }
146
174
  async startHttpServer(port) {
147
- const distCliPath = path.join(this.repositoryPath, "packages", "mcp", "model-proxy-mcp", "dist", "cli.mjs");
148
- const srcCliPath = path.join(this.repositoryPath, "packages", "mcp", "model-proxy-mcp", "src", "cli.ts");
149
- const command = "node";
150
- let args;
151
- if (await this.fileExists(distCliPath)) args = [
152
- distCliPath,
175
+ const { cliPath, useLoader } = await this.resolveCliPath();
176
+ const child = spawn("node", useLoader ? [
177
+ "--loader",
178
+ "ts-node/esm",
179
+ cliPath,
153
180
  "http-serve",
154
181
  "--port",
155
182
  String(port)
156
- ];
157
- else if (await this.fileExists(srcCliPath)) args = [
158
- "--loader",
159
- "ts-node/esm",
160
- srcCliPath,
183
+ ] : [
184
+ cliPath,
161
185
  "http-serve",
162
186
  "--port",
163
187
  String(port)
164
- ];
165
- else throw new Error("Cannot find model-proxy-mcp CLI");
166
- const child = spawn(command, args, {
188
+ ], {
167
189
  detached: true,
168
190
  stdio: "ignore",
169
191
  env: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agimon-ai/model-proxy-mcp",
3
3
  "description": "Claude-compatible model proxy MCP with ChatGPT Codex upstream support",
4
- "version": "0.2.1",
4
+ "version": "0.2.3",
5
5
  "license": "AGPL-3.0",
6
6
  "keywords": [
7
7
  "mcp",