You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -25,6 +25,8 @@ The framework is written in TypeScript and can :
25
25
- Mock API error codes/messages for testing frontend error handling logic
26
26
- Log and store API requests in JSON format and display information on the localhost:8000/logs route
27
27
28
+
The project has a local MCP server (experimental) to connect to LLM Agents (such as Claude Desktop, Cursor etc.,) that use the MCP protocol. This allows the Local Mock API server to be managed using an LLM for easier interactions during development.
29
+
28
30
## Set-up
29
31
30
32
#### Requirements
@@ -63,7 +65,7 @@ A list of all endpoints can be viewed on http://localhost:8000/.
63
65
64
66
The project has been set-up with demo endpoints that can be removed or modified as needed.
65
67
66
-

68
+

67
69
68
70
### Useful Commands
69
71
@@ -311,7 +313,7 @@ API request information and sent data can be logged and stored as JSON in the /s
311
313
312
314
Logs can be viewed at **localhost:8000/logs**.
313
315
314
-

316
+

315
317
316
318
### Set-up
317
319
@@ -371,3 +373,76 @@ By default this is set to 8000 but can be changed by setting the SERVER_PORT in
371
373
```js
372
374
SERVER_PORT=1234;
373
375
```
376
+
377
+
# MCP Server (Experimental)
378
+
379
+
### Set-up
380
+
381
+
Connect the mcp server to the mock api server as described in your agents documentation. Note the MCP server.js file is in the src/mcp folder.
382
+
383
+
You can run the command below to build the mcp server.js file if needed.
384
+
385
+
```bash
386
+
npm run mcp:build
387
+
```
388
+
389
+
then use the path below to connect to the mcp server in the MCP config file
You can request the LLM agent to start, stop and rebuild the LOCAL MOCK API server and to check for available api endpoints using the manage_local_mock_api_server tool.
398
+
399
+
You can also request the agent build a new api endpoint using the create_new_api_endpoint tool.
400
+
401
+
Note: the mcp server will only work with a local mock api server <b>running in a Docker container.</b>
402
+
403
+

404
+
405
+

406
+
407
+
### Issues
408
+
409
+
#### Node version managers
410
+
411
+
If using a node version manager such as NVM or FNM in Windows, then you may need to either specify the entire path to the node binary in the mcp server config file or set the system NODE_PATH environment variable to direct the path of the fnm aliases directory (or create sym links in linux / mac) - see https://github.com/modelcontextprotocol/servers/issues/40#issuecomment-2588950176 or https://github.com/Schniz/fnm/issues/1366#issuecomment-2764510266
412
+
413
+
E.g with fnm aliases in PATH the config below works with fnm and node
If changing the PORT number from 8000 in the env of the Mock Server then manually update the mcp/server.ts file PORT variable to the match the updated port number and run
429
+
430
+
```bash
431
+
npm run mcp:build
432
+
```
433
+
434
+
then restart your mcp agents to update the connection.
435
+
436
+
### Debugging/Testing the MCP server
437
+
438
+
You can test the mcp server using the mcp inspector tool (@modelcontextprotocol/inspector) by running
439
+
440
+
```bash
441
+
npm run mcp:debug
442
+
```
443
+
444
+
This will open a browser window and connect to the mcp server to manually run tools for testing.
445
+
446
+
### New Issues
447
+
448
+
Note: The MCP Server feature is currently experimental - log any issues here https://github.com/piyook/mock-api-framework-template/issues.
0 commit comments