MCP Server-Client Example logo

MCP Server-Client Example

by MCP-Mirror

This project demonstrates a basic implementation of the Model Context Protocol (MCP) using the TypeScript SDK. It includes both a server and client implementation that communicate over stdio transport.

View on GitHub

Last updated: N/A

What is MCP Server-Client Example?

This is a basic example of an MCP server and client implemented in TypeScript. The server provides access to resources, and the client connects to the server to request and read those resources.

How to use MCP Server-Client Example?

To use this example, clone the repository, install dependencies with npm install, start the server with npm run start:server in one terminal, and start the client with npm run start:client in another terminal. The client will then connect to the server, list available resources, and read the content of an example resource.

Key features of MCP Server-Client Example

  • Resource listing

  • Resource reading

  • Basic error handling

  • Communication over stdio

Use cases of MCP Server-Client Example

  • Demonstrating MCP usage

  • Learning MCP concepts

  • Building a foundation for MCP implementations

  • Testing MCP SDK

FAQ from MCP Server-Client Example

What is MCP?

MCP stands for Model Context Protocol.

What is the purpose of this example?

To demonstrate a basic MCP server-client implementation using TypeScript.

What dependencies are required?

Node.js (v16 or higher) and npm are required.

How do I add new resources to the server?

Modify the ListResourcesRequestSchema handler in src/index.ts to include the new resource URI and name.

What license is this project under?

This project is licensed under the ISC license.