
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
mcp-mock-server
Advanced tools
Comprehensive Model Context Protocol (MCP) mock server with Postman compatibility and 17+ tools for testing and development
A comprehensive Model Context Protocol (MCP) mock server for testing and development. This is the most feature-rich MCP mock server available, designed to help developers test MCP integrations with realistic data and comprehensive tooling.
npx mcp-mock-servernpx mcp-mock-server
npm install -g mcp-mock-server
mcp-mock-server
npm install mcp-mock-server
npx mcp-mock-server
get_users - Retrieve mock users with filtering optionscreate_user - Create new mock usersupdate_user - Update existing user datadelete_user - Delete users by IDget_posts - Retrieve blog posts with filterscreate_post - Create new blog postsget_products - Browse product catalogprocess_order - Process mock ordersget_analytics - Generate analytics datagenerate_report - Create business reportsvalidate_email - Email validationgenerate_uuid - UUID generationformat_date - Date formattinganalyze_sentiment - Mock sentiment analysisclassify_text - Mock text classificationstart_stream - Start real-time data streamsget_streaming_info - Get streaming capabilities infomcp-mock-server tools
mcp-mock-server streaming
mcp-mock-server --port 8080 --log-level debug
mcp-mock-server --data ./my-data.json
When running, the server provides several endpoints:
GET / - Health check and server infoGET /health - Detailed health informationGET /tools - List all available toolsPOST /tools/call - Execute a toolGET /streaming/info - Get streaming capabilitiesGET /streaming/stats - Get streaming statisticsWS /stream - WebSocket streaming endpointGET /mcp - Open SSE stream for server-to-client communicationPOST /mcp - Send JSON-RPC requests (initialize, tools/list, tools/call)OPTIONS /mcp - CORS preflight supportDELETE /mcp - Session terminationPOST /mcp/initialize - MCP protocol initializationGET /mcp/tools/list - MCP tools listPOST /mcp/tools/call - MCP tool executionThis server is fully compatible with Postman's new MCP client feature:
http://localhost:7988/mcpThe server supports all official MCP headers:
MCP-Protocol-Version: 2024-11-05Accept: application/json, text/event-streamMCP-Session-Id (for session management)curl -X POST http://localhost:7988/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "MCP-Protocol-Version: 2024-11-05" \
-d '{
"jsonrpc": "2.0",
"method": "initialize",
"id": 1,
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {}
}
}'
curl -X POST http://localhost:7988/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "MCP-Protocol-Version: 2024-11-05" \
-d '{
"jsonrpc": "2.0",
"method": "tools/list",
"id": 2
}'
curl -X POST http://localhost:7988/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "MCP-Protocol-Version: 2024-11-05" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"id": 3,
"params": {
"name": "get_users",
"arguments": {
"limit": 2,
"role": "admin"
}
}
}'
curl -N -H "Accept: text/event-stream" \
-H "MCP-Protocol-Version: 2024-11-05" \
http://localhost:7988/mcp
http://localhost:7988/mcpAdd to your Claude Desktop configuration:
{
"mcpServers": {
"mock-server": {
"command": "node",
"args": ["/path/to/mcp-server/index.js"],
"env": {
"PORT": "7988"
}
}
}
}
async function testMCPClient() {
// Initialize connection
const initResponse = await fetch('http://localhost:7988/mcp', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json, text/event-stream',
'MCP-Protocol-Version': '2024-11-05'
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'initialize',
id: 1,
params: { protocolVersion: '2024-11-05', capabilities: {} }
})
});
const initResult = await initResponse.json();
console.log('Initialized:', initResult);
// List tools
const toolsResponse = await fetch('http://localhost:7988/mcp', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'MCP-Protocol-Version': '2024-11-05'
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'tools/list',
id: 2
})
});
const tools = await toolsResponse.json();
console.log('Available tools:', tools.result.tools.length);
}
## 📋 Tool Examples
### Get Users
```bash
curl -X POST http://localhost:7988/tools/call \
-H "Content-Type: application/json" \
-d '{
"tool": "get_users",
"arguments": {
"limit": 2,
"role": "admin"
}
}'
curl -X POST http://localhost:7988/tools/call \
-H "Content-Type: application/json" \
-d '{
"tool": "create_user",
"arguments": {
"name": "Alice Johnson",
"email": "alice@example.com",
"role": "user"
}
}'
curl -X POST http://localhost:7988/tools/call \
-H "Content-Type: application/json" \
-d '{
"tool": "analyze_sentiment",
"arguments": {
"text": "This MCP server is absolutely amazing!"
}
}'
The MCP Mock Server includes comprehensive WebSocket-based streaming capabilities for testing real-time applications.
const ws = new WebSocket('ws://localhost:7988/stream');
ws.onopen = () => {
console.log('Connected to MCP Mock Server streaming');
};
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log('Received:', data);
};
ws.send(JSON.stringify({
type: 'start_stream',
streamType: 'user_activity',
config: { interval: 1000 }
}));
Provides: User logins, page views, clicks, purchases, etc.
ws.send(JSON.stringify({
type: 'start_stream',
streamType: 'analytics',
config: { interval: 5000 }
}));
Provides: Active users, page views, revenue, server metrics
ws.send(JSON.stringify({
type: 'start_stream',
streamType: 'chat_simulation',
config: { interval: 7988, channel: 'general' }
}));
Provides: Realistic chat messages from mock users
ws.send(JSON.stringify({
type: 'start_stream',
streamType: 'sensor_data',
config: { interval: 1000 }
}));
Provides: Temperature, humidity, pressure, motion, battery levels
ws.send(JSON.stringify({
type: 'start_stream',
streamType: 'log_events',
config: { interval: 2000 }
}));
Provides: System logs from various services with different levels
ws.send(JSON.stringify({
type: 'start_stream',
streamType: 'stock_prices',
config: { interval: 1500 }
}));
Provides: Real-time stock price updates for major symbols
// Start a stream
ws.send(JSON.stringify({
type: 'start_stream',
streamType: 'user_activity',
config: { interval: 1000 }
}));
// Stop a stream
ws.send(JSON.stringify({
type: 'stop_stream',
streamId: 'stream-id-here'
}));
// Subscribe to broadcasts
ws.send(JSON.stringify({
type: 'subscribe',
stream: 'notifications'
}));
// Ping/Pong
ws.send(JSON.stringify({ type: 'ping' }));
Install websocat for easy WebSocket testing:
# Install websocat
cargo install websocat
# Connect and test
websocat ws://localhost:7988/stream
# Send commands interactively
{"type": "start_stream", "streamType": "user_activity"}
import websocket
import json
def on_message(ws, message):
data = json.loads(message)
print(f"Received: {data}")
def on_open(ws):
# Start multiple streams
ws.send(json.dumps({
'type': 'start_stream',
'streamType': 'analytics',
'config': {'interval': 2000}
}))
ws = websocket.WebSocketApp('ws://localhost:7988/stream',
on_open=on_open,
on_message=on_message)
ws.run_forever()
mcp-mock-server [options]
Options:
-p, --port <port> Port to run server on (default: 7988)
-h, --host <host> Host to bind to (default: localhost)
-l, --log-level <level> Logging level (default: info)
-c, --config <file> Configuration file path
-d, --data <file> Custom mock data file
--no-colors Disable colored output
--quiet Suppress non-essential output
The server includes comprehensive mock data:
{
"users": [
{
"id": 1,
"name": "John Doe",
"email": "john.doe@example.com",
"role": "admin",
"avatar": "https://api.dicebear.com/7.x/avataaars/svg?seed=John",
"createdAt": "2024-01-15T08:30:00Z",
"preferences": {
"theme": "dark",
"notifications": true
}
}
],
"posts": [...],
"products": [...],
"analytics": {...}
}
Winston-powered logging with multiple levels and transports:
logs/ directoryLog levels: error, warn, info, debug
# Clone repository
git clone https://github.com/anuragarwalkar/ai-mcp-server.git
cd ai-mcp-server
# Install dependencies
npm install
# Start in development mode
npm run dev
# Start normally
npm start
This server implements the MCP Streamable HTTP Transport specification (2024-11-05):
tools/listtools/call with proper error handlinginitialize - Initialize MCP connection and negotiate capabilitiestools/list - List all available tools with schemastools/call - Execute tools with parameter validationClient (Postman, Claude, etc.)
↓ POST /mcp (JSON-RPC)
↓ GET /mcp (SSE stream)
MCP Mock Server
↓ Tool execution
↓ Mock data generation
Response (JSON-RPC 2.0)
This implementation is fully compatible with:
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details.
🔗 Connect with the project:
Made with ❤️ by Anurag Arwalkar
FAQs
Comprehensive Model Context Protocol (MCP) mock server with Postman compatibility and 17+ tools for testing and development
We found that mcp-mock-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.