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

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 +32 -14
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -143,27 +143,45 @@ 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 distCliPath = path.resolve(currentDir, "..", "cli.mjs");
149
+ if (await this.fileExists(distCliPath)) return {
150
+ cliPath: distCliPath,
151
+ useLoader: false
152
+ };
153
+ const srcCliPath = path.resolve(currentDir, "..", "cli.ts");
154
+ if (await this.fileExists(srcCliPath)) return {
155
+ cliPath: srcCliPath,
156
+ useLoader: true
157
+ };
158
+ const repoDistCliPath = path.join(this.repositoryPath, "packages", "mcp", "model-proxy-mcp", "dist", "cli.mjs");
159
+ if (await this.fileExists(repoDistCliPath)) return {
160
+ cliPath: repoDistCliPath,
161
+ useLoader: false
162
+ };
163
+ const repoSrcCliPath = path.join(this.repositoryPath, "packages", "mcp", "model-proxy-mcp", "src", "cli.ts");
164
+ if (await this.fileExists(repoSrcCliPath)) return {
165
+ cliPath: repoSrcCliPath,
166
+ useLoader: true
167
+ };
168
+ throw new Error("Cannot find model-proxy-mcp CLI");
169
+ }
146
170
  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,
171
+ const { cliPath, useLoader } = await this.resolveCliPath();
172
+ const child = spawn("node", useLoader ? [
173
+ "--loader",
174
+ "ts-node/esm",
175
+ cliPath,
153
176
  "http-serve",
154
177
  "--port",
155
178
  String(port)
156
- ];
157
- else if (await this.fileExists(srcCliPath)) args = [
158
- "--loader",
159
- "ts-node/esm",
160
- srcCliPath,
179
+ ] : [
180
+ cliPath,
161
181
  "http-serve",
162
182
  "--port",
163
183
  String(port)
164
- ];
165
- else throw new Error("Cannot find model-proxy-mcp CLI");
166
- const child = spawn(command, args, {
184
+ ], {
167
185
  detached: true,
168
186
  stdio: "ignore",
169
187
  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.2",
5
5
  "license": "AGPL-3.0",
6
6
  "keywords": [
7
7
  "mcp",