mock-mcp 0.2.2 → 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.
- package/dist/index.js +6 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
|
+
import { realpathSync } from "node:fs";
|
|
3
4
|
import process from "node:process";
|
|
4
5
|
import { TestMockMCPServer, } from "./server/test-mock-mcp-server.js";
|
|
5
6
|
import { BatchMockCollector, } from "./client/batch-mock-collector.js";
|
|
6
7
|
import { connect } from "./client/connect.js";
|
|
7
8
|
const DEFAULT_PORT = 3002;
|
|
8
|
-
console.error('mock-mcp running');
|
|
9
9
|
async function runCli() {
|
|
10
10
|
const cliArgs = process.argv.slice(2);
|
|
11
11
|
let port = Number.parseInt(process.env.MCP_SERVER_PORT ?? "", 10);
|
|
@@ -41,7 +41,11 @@ const isCliExecution = (() => {
|
|
|
41
41
|
if (typeof process === "undefined" || !process.argv?.[1]) {
|
|
42
42
|
return false;
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
// Resolve symlinks to ensure proper comparison between import.meta.url and argv[1]
|
|
45
|
+
// This is necessary because import.meta.url contains the real path,
|
|
46
|
+
// while process.argv[1] may contain symlinks (e.g., /tmp vs /private/tmp on macOS)
|
|
47
|
+
const scriptPath = realpathSync(process.argv[1]);
|
|
48
|
+
return import.meta.url === pathToFileURL(scriptPath).href;
|
|
45
49
|
})();
|
|
46
50
|
if (isCliExecution) {
|
|
47
51
|
runCli().catch((error) => {
|