mcp-client-server

mcp-client-server

0

This project implements a basic Model Context Protocol (MCP) server and client to handle weather information using JSON-RPC 2.0 communication. It includes resources, tools, and prompts for accessing and advising based on weather data.

A Simple MCP Server and Client

This project features a basic implementation of a Model Context Protocol (MCP) server and client to demonstrate handling weather information.

Server

  • Provides resources like city://NewYork, city://London, and city://Tokyo for basic city information.
  • Tools available include get-weather for weather forecasts.
  • Prompts offer travel advice based on weather conditions.

Client

  • Demonstrates connectivity with the MCP server, listing resources, accessing city data, calling weather tools, and retrieving travel advice.

JSON-RPC Communication

  • Utilizes JSON-RPC 2.0 for client-server communication, including methods, parameters, request IDs, and results/errors.

Running the Server and Client

  • Starts with node client.js. The client can also start the server independently with node server.js.

Transport Mechanism

  • Utilizes stdio for communication between client and server with custom logging transports to show message exchanges.

Troubleshooting

  • Addresses possible timeouts in resource or prompt requests due to SDK limitations.