Offers a Node.js library for creating and managing MCP hosts, with support for registering tools dynamically and handling authentication.
Provides full TypeScript definitions and type safety through optional Zod schema validation for tool inputs and parameters.
Integrates with Zod for enhanced type safety and validation, automatically converting Zod schemas to JSON Schema for MCP tool definitions.
MCP Host RPC Bridge
A Node.js library that bridges MCP (Model Context Protocol) tool calls to JSON-RPC function calls. Supports both Unix socket connections (default) and HTTP transport for flexible integration with any application architecture.
Features
- 🚀 Dual Transport Modes: Unix sockets for local IPC, HTTP for web integration
- 🔐 JWT Authentication: Secure context passing with cryptographic signatures
- 🔧 Framework Agnostic: Works with Express, Fastify, Next.js, or raw Node.js
- 📝 TypeScript Support: Full type definitions included
- 🎯 Zod Integration: Automatic schema conversion for type-safe tools
Installation
Quick Start
Socket Mode (Default)
HTTP Mode
Documentation
- Socket Mode Guide - Detailed documentation for Unix socket transport
- HTTP Mode Guide - Complete guide for HTTP transport integration
Core Concepts
Transport Modes
- Socket Mode (default) - Uses Unix domain sockets for high-performance local IPC
- HTTP Mode - Uses HTTP POST requests for web integration and remote access
Context-Based Security
Every tool handler receives a verified context object extracted from JWT tokens:
Tool Registration
Tools can be registered with JSON Schema or Zod schemas:
API Reference
new McpHost(options)
Creates a new MCP host instance.
host.registerTool(name, config, handler)
Register a tool with the host.
host.getMCPServerConfig(name, tools, context, options?)
Get MCP server configuration for claude_desktop_config.json
.
host.handleHttpRequest(req, res)
Handle HTTP requests (HTTP mode only).
host.start()
/ host.stop()
Start or stop the host server.
Examples
Check out the examples/
directory for complete examples:
simple-example.js
- Basic socket mode usagezod-example.js
- Zod schema validationhttp-express-example.js
- Express.js HTTP integrationhttp-fastify-example.js
- Fastify HTTP integrationhttp-raw-example.js
- Raw Node.js HTTP server
Running Examples
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A server that bridges MCP tool calls to JSON-RPC function calls over socket connections, allowing external applications to expose functions as MCP tools.
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol (MCP) server that provides JSON-RPC functionality through OpenRPC.Last updated -21036JavaScriptApache 2.0
- -securityAlicense-qualityThis MCP server allows you to connect MCP clients with Toolhouse's tools.Last updated -13PythonMIT License
- -securityAlicense-qualityA beginner-friendly MCP-inspired JSON-RPC server built with Node.js, offering basic client-server interaction through an 'initialize' capabilities handshake and an 'echo' function.Last updated -4JavaScriptMIT License
- -securityAlicense-qualityAn MCP (Model Context Protocol) server that chains calls to other MCP tools, reducing token usage by allowing sequential tool execution with result passingLast updated -10947JavaScriptMIT License