mock-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/index.js CHANGED
@@ -5,6 +5,7 @@ import { TestMockMCPServer, } from "./server/test-mock-mcp-server.js";
5
5
  import { BatchMockCollector, } from "./client/batch-mock-collector.js";
6
6
  import { connect } from "./client/connect.js";
7
7
  const DEFAULT_PORT = 3002;
8
+ console.error('mock-mcp running');
8
9
  async function runCli() {
9
10
  const cliArgs = process.argv.slice(2);
10
11
  let port = Number.parseInt(process.env.MCP_SERVER_PORT ?? "", 10);
@@ -27,9 +28,9 @@ async function runCli() {
27
28
  enableMcpTransport,
28
29
  });
29
30
  await server.start();
30
- console.log(`🎯 Test Mock MCP server ready on ws://localhost:${server.port ?? port}`);
31
+ console.error(`🎯 Test Mock MCP server ready on ws://localhost:${server.port ?? port}`);
31
32
  const shutdown = async () => {
32
- console.log("👋 Shutting down Test Mock MCP server...");
33
+ console.error("👋 Shutting down Test Mock MCP server...");
33
34
  await server.stop();
34
35
  process.exit(0);
35
36
  };
@@ -130,7 +130,7 @@ export class TestMockMCPServer {
130
130
  };
131
131
  batch.ws.send(JSON.stringify(payload));
132
132
  this.pendingBatches.delete(batchId);
133
- this.logger.log(`✅ Delivered ${mocks.length} mock(s) to test process for ${batchId}`);
133
+ this.logger.error(`✅ Delivered ${mocks.length} mock(s) to test process for ${batchId}`);
134
134
  return this.buildToolResponse(JSON.stringify({
135
135
  success: true,
136
136
  message: `Provided mock data for ${batchId}`,
@@ -147,7 +147,7 @@ export class TestMockMCPServer {
147
147
  wss.once("listening", () => {
148
148
  const address = wss.address();
149
149
  this.actualPort = address?.port ?? desiredPort;
150
- this.logger.log(`🚀 WebSocket server listening on ws://localhost:${this.actualPort}`);
150
+ this.logger.error(`🚀 WebSocket server listening on ws://localhost:${this.actualPort}`);
151
151
  resolve();
152
152
  });
153
153
  wss.once("error", (error) => {
@@ -228,7 +228,7 @@ export class TestMockMCPServer {
228
228
  this.mcpServer.setRequestHandler(CallToolRequestSchema, async (request) => {
229
229
  const toolName = request.params.name;
230
230
  if (toolName === "get_pending_batches") {
231
- this.logger.log("📋 MCP client inspected pending batches");
231
+ this.logger.error("📋 MCP client inspected pending batches");
232
232
  return this.buildToolResponse(JSON.stringify(this.getPendingBatches(), null, 2));
233
233
  }
234
234
  if (toolName === "provide_batch_mock_data") {
@@ -243,14 +243,14 @@ export class TestMockMCPServer {
243
243
  this.transport =
244
244
  this.options.transportFactory?.() ?? new StdioServerTransport();
245
245
  await this.mcpServer.connect(this.transport);
246
- this.logger.log("✅ MCP server is ready (stdio transport)");
246
+ this.logger.error("✅ MCP server is ready (stdio transport)");
247
247
  }
248
248
  handleConnection(ws) {
249
- this.logger.log("🔌 Test process connected");
249
+ this.logger.error("🔌 Test process connected");
250
250
  this.clients.add(ws);
251
251
  ws.on("message", (data) => this.handleClientMessage(ws, data));
252
252
  ws.on("close", () => {
253
- this.logger.log("🔌 Test process disconnected");
253
+ this.logger.error("🔌 Test process disconnected");
254
254
  this.clients.delete(ws);
255
255
  this.dropBatchesForClient(ws);
256
256
  });
@@ -292,11 +292,11 @@ export class TestMockMCPServer {
292
292
  ws,
293
293
  expiresAt,
294
294
  });
295
- this.logger.log([
295
+ this.logger.error([
296
296
  `📥 Received ${requests.length} request(s) (${batchId})`,
297
297
  ...requests.map((req, index) => ` ${index + 1}. ${req.method} ${req.endpoint} (${req.requestId})`),
298
298
  ].join("\n"));
299
- this.logger.log("⏳ Awaiting mock data from MCP client...");
299
+ this.logger.error("⏳ Awaiting mock data from MCP client...");
300
300
  }
301
301
  dropBatchesForClient(ws) {
302
302
  for (const [batchId, batch] of this.pendingBatches) {
@@ -325,7 +325,7 @@ export class TestMockMCPServer {
325
325
  const entry = this.buildLogEntry(batch, mocks);
326
326
  const filePath = path.join(directory, `mock-${batch.batchId}.json`);
327
327
  await writeFile(filePath, JSON.stringify(entry, null, 2), "utf8");
328
- this.logger.log(`📝 Saved mock batch ${batch.batchId} to ${filePath}`);
328
+ this.logger.error(`📝 Saved mock batch ${batch.batchId} to ${filePath}`);
329
329
  }
330
330
  buildLogEntry(batch, mocks) {
331
331
  const mockMap = new Map(mocks.map((mock) => [mock.requestId, mock]));
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "mock-mcp",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "An MCP server enabling LLMs to write integration tests through live test environment interaction",
5
5
  "main": "./dist/connect.cjs",
6
6
  "type": "module",
7
7
  "bin": {
8
- "mock-mcp": "dist/index.js"
8
+ "mock-mcp": "./dist/index.js"
9
9
  },
10
10
  "files": [
11
11
  "dist"