MCP Server-Client Example

Created at 21 hours ago

by joeBlockchain

starstarstarstarstar

Categories

developer-tools

Tags

mcp

server-client

typescript

MCP Server-Client Example

What is MCP Server-Client Example?

The MCP Server-Client Example is a demonstration of a basic implementation of the Model Context Protocol (MCP) using the TypeScript SDK. It features a server that provides access to resources and a client that connects to the server to request and read these resources.

How to use MCP Server-Client Example?

To use this project, clone the repository and install the dependencies using npm. Run the server and client in separate terminal windows to see how they communicate and access resources.

Key features of MCP Server-Client Example:

  • Basic implementation of MCP using TypeScript
  • Functionality for resource listing and reading
  • Basic error handling for unknown resources

Use cases of MCP Server-Client Example:

  1. Demonstrating client-server communication using the Model Context Protocol.
  2. Testing resource management and access in a controlled environment.
  3. Developing applications that require simple resource sharing and retrieval.

FAQ from MCP Server-Client Example:

  • What are the prerequisites for this project?

You need Node.js (v16 or higher) and npm to run the project.

  • How do I start the server and client?

Start the server by running npm run start:server and the client with npm run start:client in separate terminal windows.

  • How can new resources be added to the server?

To add new resources, modify the ListResourcesRequestSchema handler in the src/index.ts file.

View More