MCP-Mirror

MCP Server-Client Example

Community MCP-Mirror
Updated

Mirror of https://github.com/joeBlockchain/mcp-server-client

MCP Server-Client Example

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.

Overview

The example includes:

  • An MCP server that provides access to resources
  • An MCP client that connects to the server and requests resources
  • Basic resource listing and reading functionality

Prerequisites

  • Node.js (v16 or higher)
  • npm

Installation

Clone the repository and install dependencies:

npm install

Project Structure

src/
  ├── index.ts    # Server implementation
  └── client.ts   # Client implementation

Running the Example

You'll need to run the server and client in separate terminal windows.

  1. Start the server:
npm run start:server
  1. In a new terminal, start the client:
npm run start:client

The client will:

  1. Connect to the server
  2. Request a list of available resources
  3. Read the content of an example resource

Server Capabilities

The server currently supports:

  • Resource listing
  • Resource reading
  • Basic error handling for unknown resources

Available Resources

The example server provides access to:

  • file:///example.txt: A simple text resource

Development

Scripts

  • npm run start:server: Starts the MCP server
  • npm run start:client: Starts the MCP client

Adding New Resources

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

server.setRequestHandler(ListResourcesRequestSchema, async () => {
  return {
    resources: [
      {
        uri: "file:///example.txt",
        name: "Example Resource",
      },
      // Add new resources here
    ],
  };
});

Dependencies

  • @modelcontextprotocol/sdk: MCP TypeScript SDK
  • ts-node: TypeScript execution environment
  • typescript: TypeScript compiler

License

ISC

MCP Server · Populars

MCP Server · New

    shanejonas

    OpenRPC MCP Server

    A Model Context Protocol (MCP) server that provides JSON-RPC functionality through OpenRPC.

    Community shanejonas
    stripe

    Stripe AI

    One-stop shop for building AI-powered products and businesses with Stripe.

    Community stripe
    rafiattrach

    M3: MIMIC-IV + MCP + Models 🏥🤖

    🏥🤖 Query MIMIC-IV medical data using natural language through Model Context Protocol (MCP). Transform healthcare research with AI-powered database interactions - supports both local MIMIC-IV SQLite demo dataset and full BigQuery datasets.

    Community rafiattrach
    StackOneHQ

    mcp-connectors

    mcp connectors for disco

    Community StackOneHQ
    RaheesAhmed

    WordPress MCP Server

    A WordPress MCP server that provides 190+ tools for complete WordPress site management through AI.

    Community RaheesAhmed