Related MCP Server Resources

Explore more AI models, providers, and integration options:

  • Explore AI Models
  • Explore AI Providers
  • Explore MCP Servers
  • LangDB Pricing
  • Documentation
  • AI Industry Blog
  • Directus MCP Server
  • MCP Pokemon Server
  • Phrases MCP Server
  • MCP Server
  • Xano MCP Server for Smithery
Back to MCP Servers
MCP JSON-RPC Server

MCP JSON-RPC Server

Public
melvincarvalho/mcpjs

A beginner-friendly Model Context Protocol (MCP) JSON-RPC server implemented in Node.js that listens on TCP port 4000, providing initialize and echo methods to demonstrate basic client-server communication and extendable capabilities.

javascript
0 tools
May 30, 2025
Updated Jun 4, 2025

Supercharge Your AI with MCP JSON-RPC Server

MCP Server

Unlock the full potential of MCP JSON-RPC Server through LangDB's AI Gateway. Get enterprise-grade security, analytics, and seamless integration with zero configuration.

Unified API Access
Complete Tracing
Instant Setup
Get Started Now

Free tier available • No credit card required

Instant Setup
99.9% Uptime
10,000+Monthly Requests

MCP JSON-RPC Client and Server Example

This repository contains a simple, beginner-friendly example of an MCP-inspired JSON‑RPC client and server implemented in JavaScript. The project demonstrates a basic communication flow using Node.js's built‑in modules without any external dependencies.

Overview

  • Server (server.js):

    • Listens on TCP port 4000.
    • Implements two JSON‑RPC methods:
      • initialize: Returns a basic capabilities object (advertising an "echo" tool).
      • echo: Echoes back the parameters provided by the client.
  • Client (client.js):

    • Connects to the server on port 4000.
    • Sends an initialize request followed by an echo request.
    • Logs the responses received from the server.

Prerequisites

  • Node.js installed on your system (v10 or later is recommended).

Getting Started

Installing via Smithery

To install MCP JSON-RPC Client and Server Example for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @melvincarvalho/mcpjs --client claude

Manual Installation

  1. Clone the Repository:

    git clone https://github.com/sandy-mount/mcpjs.git cd mcp-jsonrpc-example
  2. Run the Server:

    Open a terminal window and run:

    node server.js

    You should see a message like:

    Server listening on port 4000
    
  3. Run the Client:

    Open another terminal window and run:

    node client.js

    The client will connect to the server, send the initialize and echo requests, and display the responses.

How It Works

  • The server listens for incoming TCP connections on port 4000. When it receives a JSON‑RPC message (each terminated by a newline), it processes the request:

    • For the initialize method, it returns a JSON‑RPC response with basic capabilities and server info.
    • For the echo method, it returns the parameters that were sent in the request.
    • If an unknown method is requested, it responds with a JSON‑RPC error.
  • The client connects to the server, sends a JSON‑RPC initialize request, waits a short time, and then sends an echo request. Responses from the server are printed to the console.

Files

  • server.js — The JSON‑RPC server implementation.
  • client.js — The JSON‑RPC client implementation.

Customization

You can extend this example by:

  • Adding more JSON‑RPC methods to the server.
  • Implementing additional error handling and logging.
  • Experimenting with different transport protocols or adding TLS support.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Feel free to open issues or submit pull requests with improvements or suggestions.


Happy coding!

Publicly Shared Threads0

Discover shared experiences

Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!

Share your threads to help others
Related MCPs5
  • Directus MCP Server
    Directus MCP Server

    Experimental Model Context Protocol server enabling AI tools to securely connect to and interact wit...

    Added May 30, 2025
  • MCP Pokemon Server
    MCP Pokemon Server

    An MCP server implementation enabling interaction with the PokeAPI to fetch dynamic Pokémon data and...

    Added May 30, 2025
  • Phrases MCP Server
    Phrases MCP Server

    Efficient MCP (Model Context Protocol) server for managing inspirational phrases with full CRUD capa...

    6 tools
    Added May 30, 2025
  • MCP Server
    MCP Server

    Provides greeting-related tools, resources, and prompts via Model Context Protocol (MCP), enabling p...

    Added May 30, 2025
  • Xano MCP Server for Smithery
    Xano MCP Server for Smithery

    Model Context Protocol server enabling seamless integration between Claude AI and Xano databases wit...

    Added May 30, 2025