@agimon-ai/model-proxy-mcp 0.2.0 → 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.
- package/dist/cli.mjs +32 -14
- package/dist/index.d.mts +7 -4
- 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
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
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/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import "@hono/node-server";
|
|
2
|
+
import { Hono } from "hono";
|
|
1
3
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
4
|
+
import * as hono_types0 from "hono/types";
|
|
2
5
|
|
|
3
6
|
//#region src/types/index.d.ts
|
|
4
7
|
interface LoggerLike {
|
|
@@ -150,7 +153,7 @@ declare class CodexAuth {
|
|
|
150
153
|
private readonly authFilePath;
|
|
151
154
|
private static readonly TOKEN_REFRESH_URL;
|
|
152
155
|
private static readonly CLIENT_ID;
|
|
153
|
-
constructor(logger?: LoggerLike, authFilePath?:
|
|
156
|
+
constructor(logger?: LoggerLike, authFilePath?: string);
|
|
154
157
|
getAuthFilePath(): string;
|
|
155
158
|
getAuthStatus(): Promise<{
|
|
156
159
|
configured: boolean;
|
|
@@ -194,7 +197,7 @@ declare class ConversationHistoryService {
|
|
|
194
197
|
* `retentionLimit` is enforced per scope after each insert batch.
|
|
195
198
|
* `logger` receives structured operational failures.
|
|
196
199
|
*/
|
|
197
|
-
constructor(dbPath?:
|
|
200
|
+
constructor(dbPath?: string, retentionLimit?: number, logger?: LoggerLike);
|
|
198
201
|
/**
|
|
199
202
|
* Eagerly initializes the SQLite database and schema.
|
|
200
203
|
*/
|
|
@@ -239,7 +242,7 @@ declare class ProfileStore {
|
|
|
239
242
|
private readonly modelListPath;
|
|
240
243
|
private readonly scopeSettingsDir;
|
|
241
244
|
private readonly logger;
|
|
242
|
-
constructor(providerConfigPath?:
|
|
245
|
+
constructor(providerConfigPath?: string, modelListPath?: string, scopeSettingsDir?: string, logger?: LoggerLike);
|
|
243
246
|
getConfigPath(scope?: string): string;
|
|
244
247
|
ensureConfig(scope?: string, seedConfigPath?: string): Promise<ProxyConfig>;
|
|
245
248
|
listScopes(): Promise<string[]>;
|
|
@@ -448,7 +451,7 @@ declare class GatewayService {
|
|
|
448
451
|
}
|
|
449
452
|
//#endregion
|
|
450
453
|
//#region src/server/http.d.ts
|
|
451
|
-
declare function createHttpServer(gatewayService?: GatewayService):
|
|
454
|
+
declare function createHttpServer(gatewayService?: GatewayService): Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
|
|
452
455
|
//#endregion
|
|
453
456
|
//#region src/server/index.d.ts
|
|
454
457
|
declare function createServer(gatewayService?: GatewayService, environment?: NodeJS.ProcessEnv): Server;
|