A Node.js application with two separate servers: an HTTPS server that receives JSON via PUT or POST requests and an MCP server that provides these messages to MCP clients via STDIO.
- HTTPS server with token-based authentication
- Persistent JSON message logging
- MCP server with STDIO transport
- File-based message storage with locking mechanism
- MCP resource subscription for messages
- MCP tools to retrieve messages
- Install dependencies:
npm install- Generate self-signed certificates:
./generate-certs.shAlternatively, you can provide your own certificates and update the paths in config.json.
- Configure the server by editing
config.json:https.port: HTTPS server port (default: 8443)https.authToken: Authentication token for PUT/POST requestslogging.logFilePath: Path to the log file
npm start
# or
npm run start:httpsnpm run start:mcp
# or
node mcp-server.js
# or
/full/path/to/mcp-server.js# Using PUT
curl -k -X PUT https://localhost:8443/json \
-H "Authorization: Bearer your-secret-auth-token-here" \
-H "Content-Type: application/json" \
-d '{"test": "data"}'
# Using POST
curl -k -X POST https://localhost:8443/json \
-H "Authorization: Bearer your-secret-auth-token-here" \
-H "Content-Type: application/json" \
-d '{"test": "data"}'The server exposes:
- Resource:
json://messages- Subscribe to view all messages - Tools:
retrieve_message- Get and remove a specific message by IDretrieve_all_messages- Get and remove all messages
- Separate Executables: HTTPS and MCP servers run as independent processes
- Shared Storage: Messages are stored in
messages.jsonwith file-based locking - STDERR Output: All console output goes to STDERR to avoid interfering with MCP STDIO protocol
- Persistent Storage: Messages persist across server restarts
- Log File: All received messages are logged to the configured log file
- Message Retrieval: Messages remain in storage until explicitly retrieved via MCP tools
npm run dev:httpsnpm run dev:mcp