mcp-client-server

mcp-client-server

3.3

This repository contains a custom implementation of a Model Context Protocol (MCP) client and server, demonstrating interaction with Anthropic's Claude model.

Model Context Protocol (MCP) is an open standard designed to connect AI assistants with various data sources. This project provides a practical implementation of both a client and server for MCP, showcasing how to interact with AI models like Anthropic's Claude. The server is built using Express.js and supports both HTTP and WebSocket communication, allowing for real-time, interactive dialogues. The client is designed to be simple and versatile, supporting multiple communication methods. The project includes demo applications to illustrate basic HTTP communication, WebSocket streaming, and an interactive chat console.

Features

  • {'name': 'MCP Server', 'description': "RESTful API server using Express.js, integrated with Anthropic's API for AI processing, featuring messaging and context management."}
  • {'name': 'WebSocket Support', 'description': 'Enables real-time streaming responses and interactive dialogues through bidirectional communication and event-based asynchronous messaging.'}
  • {'name': 'MCP Client', 'description': 'Integrated client supporting both HTTP and WebSocket, offering a simple API for multiple communication methods.'}
  • {'name': 'Demo Applications', 'description': 'Includes basic HTTP demo, WebSocket streaming demo, and an interactive chat console.'}

Usage with Different Platforms

Node.js

bash
npm run start:server

HTTP Demo

bash
npm run demo:http

WebSocket Demo

bash
npm run demo:ws

Interactive Chat Demo

bash
npm run demo:chat