tyfeng1997
MCP Servertyfeng1997public

mcp client

一个使用 Server-Sent Events (SSE) 传输协议的 TypeScript 客户端,用于与 MCP 服务器交互。

Repository Info

0
Stars
0
Forks
0
Watchers
0
Issues
TypeScript
Language
-
License

About This Server

一个使用 Server-Sent Events (SSE) 传输协议的 TypeScript 客户端,用于与 MCP 服务器交互。

Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.

Documentation

MCP Client

A TypeScript client implementation for the Model Context Protocol (MCP) using Server-Sent Events (SSE) transport.

Overview

This client connects to MCP servers over HTTP using Server-Sent Events (SSE) and allows AI assistants like Claude to interact with custom tools exposed by the server. Unlike the standard examples that typically use stdio for local server communication, this client demonstrates how to implement remote server connections via SSE.

Features

  • Connect to MCP servers over HTTP using SSE transport
  • Discover and execute tools exposed by the server
  • Integrate with Claude or other AI assistants via the Anthropic API
  • Maintain interactive chat sessions with tool execution

Prerequisites

  • Node.js (v16 or newer)
  • npm or yarn
  • An Anthropic API key

Installation

# Clone the repository
git clone https://github.com/tyfeng1997/mcp-client.git
cd mcp-client

# Install dependencies
npm install

# Build the TypeScript code
npm run build

Configuration

Create a .env file in the root directory with your Anthropic API key:

ANTHROPIC_API_KEY=your_api_key_here

Usage

To start the client and connect to an MCP server:

node build/index.js http://localhost:3001/sse

Replace http://localhost:3001/sse with the SSE endpoint URL of your MCP server.

Interactive Chat

Once connected, the client will start an interactive chat session where you can:

  1. Type natural language queries
  2. The client will send these to Claude
  3. If Claude decides to use tools, the client will execute them through the MCP server
  4. Results will be displayed in the conversation
  5. Type 'quit' to exit

Common Issues

  • "Not connected" error: Make sure the server is running and the SSE endpoint is accessible. Also verify that your client code properly awaits the connection promise.
  • Timeout errors: The server might be taking too long to respond. Check server logs for any issues.
  • Tool execution errors: Ensure the tool parameters being passed match what the server expects.

Companion Server

This client is designed to work with the MCP server available at tyfeng1997/mcp-server, which provides a weather information service over SSE. You can also connect it to any other MCP-compliant server that supports SSE transport.

Development

To modify the client:

  1. Make changes to the TypeScript files
  2. Rebuild with npm run build
  3. Run the client to test your changes

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Quick Start

1

Clone the repository

git clone https://github.com/tyfeng1997/mcp-client
2

Install dependencies

cd mcp-client
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownertyfeng1997
Repomcp-client
LanguageTypeScript
License-
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation