mcp-simulator
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-simulatorcalculate the sum of 20 and 30"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Simulator (Node.js MCP Server)
mcp simulator is a lightweight MCP server (Model Context Protocol Server) built on Node.js. This project adopts a zero-external-dependency design (using only the native http module), and provides dynamic tool registration and HTTP remote procedure call (RPC) capabilities through the modular McpServer and McpRegistry.
š Core Features
Zero external dependencies: Relies entirely on Node.js's native
httpmodule; no frameworks such asexpressare needed.Brand-new MCP core architecture:
McpRegistry: responsible for maintaining the tool list and execution logic (supports both synchronous and asynchronousasyncmethods).McpServer: provides an HTTP POST-based execution entry point and unified JSON response wrapping.
Clean API registration design: Provides a chainable
register()interface; you only need to supply two parameters, the "tool definition" and the "execution callback", to register easily.Built-in tools and reflection mechanism:
Built-in
tool/listdynamically queries all registered tools.Provides complete demonstrations including synchronous calculation, text processing, and asynchronous (
async) simulated API requests (fetch-posts).
Related MCP server: Swagger/Postman MCP Server
š File Structure
mcp-simulator/
āāā mcp.core.js # ä¼ŗęåØę øåæå¼ęļ¼å®ē¾© McpServer č McpRegistry é”å„ļ¼
āāā index.js # å°ę”äø»å
„å£ļ¼č¼å
„ę øåæå¼ę並註åå
·é«å·„å
·ļ¼
āāā index.http # HTTP API 測試č
³ę¬ļ¼ęé
VS Code REST Client 使ēØļ¼
āāā package.json # å°ę”é
ē½®ęä»¶
āāā README.md # ę¬å°ę”čŖŖęęä»¶āļø Quick Start
Starting the Server
Run the following command in the project root directory:
node index.jsThe server listens on port 8889 by default (or reads the PORT environment variable). After startup, the console will display:
Server running at 8889š API Protocol Specification
All API calls go through a single entry point.
Request method:
POSTServer address:
http://localhost:8889Request header:
Content-Type: application/jsonRequest body format (Payload):
{ "name": "č¦čŖæēØēå·„å ·å稱", "args": { "åęøéµ": "åęøå¼" } }
Unified Response Structure (Response)
After all requests are processed successfully, the server returns a uniformly wrapped JSON structure:
{
"code": 200,
"message": "success",
"data": {
/* å·„å
·åå³ēåå§ēµę */
}
}Server Error Status Overview
HTTP Status Code | Scenario Description | Response Content (JSON) |
200 | Header error (application/json not specified) |
|
200 | JSON format error (cannot be parsed) |
|
200 | Tool name not provided (missing name field) |
|
200 | Calling an unregistered tool |
|
š ļø Built-in Method Call Examples
The following are actual call data using localhost:8889 as an example:
1. Get the List of Available Tools (tool/list)
Lists all tool definitions registered in the server.
Request Payload:
{"name": "tool/list", "args": {}}Response Example:
{ "code": 200, "message": "success", "data": [ { "name": "info", "description": "..." }, { "name": "hello", "description": "just say hello to someone", "args": { "username": "string" } }, { "name": "calculate", "description": "calculate sum of two numbers", "args": { "a": "number", "b": "number" } }, { "name": "fetch-posts", "description": "fetch posts from https://jsonplaceholder.typicode.com/posts" } ] }
2. Calculate the Sum of Two Numbers (calculate)
Request Payload:
{"name": "calculate", "args": {"a": 20, "b": 30}}Response Example:
{ "code": 200, "message": "success", "data": { "result": 50 } }
3. Asynchronous Request Test (fetch-posts)
Demonstrates the use of an async callback function, returning a set of fake user data (an array).
Request Payload:
{"name": "fetch-posts"}Response Example:
{ "code": 200, "message": "success", "data": [ { "id": 1, "name": "Leanne Graham", "username": "Bret", "email": "Sincere@april.biz" // ... (å ¶ä»č³ęē„) } ] }
š Developing and Extending Custom Tools
You can modify index.js and add your tools through chainable .register() calls.
API Signature
server.register(toolDefinition, callback);toolDefinition(Object): must containname, and may optionally providedescriptionandargs(parameter definitions).callback(Function / Async Function): the callback executed when a request is received. It receives a single object parameter fromreq.params.args.
Registration Example
const { McpServer } = require("./mcp.core");
new McpServer(8889)
// 註åäøåéč¦åęøēéåę„å·„å
·
.register(
{
name: "get_user",
description: "ē²åē¹å®ä½æēØč
č³ę",
args: { userId: "number" },
},
async ({ userId }) => {
// ā ļø åæ
é 使ēØē©ä»¶č§£ę§č®ååęø
const user = await database.find(userId);
return { result: user };
},
)
.start();š” Key Development Reminders:
Parameter reception: Because the
argssent by the client are passed to the callback function as a single object, if your tool defines multiple parameters, be sure to use object destructuring with{ param1, param2 }in the callback function.Asynchronous support:
McpRegistryinternally usesawaitto execute tools, so you can safely useasync/awaitin your callback functions for database queries or network requests.
š License
This project is open-sourced under the terms of the MIT License.
This server cannot be deployed
Maintenance
Related MCP Connectors
AI-callable tools for API mocking, testing, monitoring, security, and automation.
Build, validate, deploy ā HTTP APIs, cron jobs, webhooks and MCP tools ā from your AI client.
Deterministic AI agent microtools, no accounts/API keys. fetch_extract: 98% token cut. 38 tools.
500+ deterministic tools for AI agents: math, conversion, validation, hashing, encoding, date/time.
Related MCP Servers
- AlicenseBqualityDmaintenanceA lightweight, modular API service that provides useful tools like weather, date/time, calculator, search, email, and task management through a RESTful interface, designed for integration with AI agents and automated workflows.51MIT
- FlicenseNot gradedqualityDmaintenanceServer that ingests Swagger/OpenAPI specifications and Postman collections, providing just 4 strategic tools that allow AI agents to dynamically discover and interact with APIs instead of generating hundreds of individual tools.3-
- AlicenseNot gradedqualityDmaintenanceA lightweight Node.js-based MCP server that exposes custom tools via HTTP and Server-Sent Events (SSE) for clients like Postman. It allows users to register tools with type-safe validation to establish bidirectional communication with MCP clients.1,026 npm1MIT
- FlicenseNot gradedqualityDmaintenanceA modular server for managing and registering tools, enabling extensible functionality through tool registration and configuration.-