mcp-json-receiver

bensons/mcp-json-receiver

3.2

If you are the rightful owner of mcp-json-receiver and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The JSON Receiver MCP Server is a Node.js application designed to handle JSON messages via HTTPS and distribute them to MCP clients.

Tools
  1. retrieve_message

    Get and remove a specific message by ID.

  2. retrieve_all_messages

    Get and remove all messages.

JSON Receiver MCP Server

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.

Features

  • 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

Setup

  1. Install dependencies:
npm install
  1. Generate self-signed certificates:
./generate-certs.sh

Alternatively, you can provide your own certificates and update the paths in config.json.

  1. Configure the server by editing config.json:
    • https.port: HTTPS server port (default: 8443)
    • https.authToken: Authentication token for PUT/POST requests
    • logging.logFilePath: Path to the log file

Usage

Start the HTTPS server

npm start
# or
npm run start:https

Configure your MCP client to connect to the MCP server

npm run start:mcp
# or
node mcp-server.js
# or
/full/path/to/mcp-server.js

Send JSON via HTTPS PUT or POST

# 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"}'

MCP Client Integration

The server exposes:

  • Resource: json://messages - Subscribe to view all messages
  • Tools:
    • retrieve_message - Get and remove a specific message by ID
    • retrieve_all_messages - Get and remove all messages

Architecture

  • Separate Executables: HTTPS and MCP servers run as independent processes
  • Shared Storage: Messages are stored in messages.json with 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

Development

Run HTTPS server in watch mode

npm run dev:https

Run MCP server in watch mode

npm run dev:mcp