MCP cover image
See in Github
2024-12-05

Mirror ofhttps://github.com/joeBlockchain/mcp-server-client

0

Github Watches

1

Github Forks

0

Github Stars

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

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Andris Teikmanis
  • Latvian GPT assistant for developing GPT applications

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Jan Meindl
  • Builds new GPTs

  • https://jgadvisorycpa.com
  • This GPT assists in finding a top-rated business CPA - local or virtual. We account for their qualifications, experience, testimonials and reviews. Business operators provide a short description of your business, services wanted, and city or state.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Contraband Interactive
  • Emulating Dr. Jordan B. Peterson's style in providing life advice and insights.

  • rustassistant.com
  • Your go-to expert in the Rust ecosystem, specializing in precise code interpretation, up-to-date crate version checking, and in-depth source code analysis. I offer accurate, context-aware insights for all your Rust programming questions.

  • apappascs
  • Discover the most comprehensive and up-to-date collection of MCP servers in the market. This repository serves as a centralized hub, offering an extensive catalog of open-source and proprietary MCP servers, complete with features, documentation links, and contributors.

  • ShrimpingIt
  • Micropython I2C-based manipulation of the MCP series GPIO expander, derived from Adafruit_MCP230xx

  • modelcontextprotocol
  • Model Context Protocol Servers

  • OffchainLabs
  • Go implementation of Ethereum proof of stake

  • Mintplex-Labs
  • The all-in-one Desktop & Docker AI application with built-in RAG, AI agents, No-code agent builder, MCP compatibility, and more.

  • huahuayu
  • A unified API gateway for integrating multiple etherscan-like blockchain explorer APIs with Model Context Protocol (MCP) support for AI assistants.

    Reviews

    5 (1)
    Avatar
    user_xYLNnXdx
    2025-04-15

    I have been using the MCP-RAG application by kira1228 for a few weeks now, and it has significantly enhanced my workflow. The user-friendly interface and seamless integration make it a pleasure to use daily. I highly recommend this product to anyone in need of a reliable and efficient solution.