Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

rohithtp/mcp-sse-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

2 Commits

Repository files navigation

MCP SSE Client

A JavaScript client implementation for interacting with the MCP (Model Context Protocol) Server with Server-Sent Events (SSE) support.

Overview

This client provides functionality to:

  • Connect to SSE stream for real-time updates
  • Execute tools (like adding numbers)
  • Fetch resources (like personalized greetings)

The server implementation can be found at mcp-python-sse.

Setup

  1. Include the client in your project:
import { addNumbers, getGreeting } from './sse_client.js';
  1. The SSE connection will be automatically established when the client is loaded.

Usage

Listening to SSE Events

The client automatically sets up an SSE connection and listens for messages:

// The connection is automatically established
// Messages will be logged to console

Using Tools

Add Numbers

const result = await addNumbers(5, 3);
console.log('Sum:', result); // Will output the sum

Using Resources

Get Greeting

const greeting = await getGreeting('Alice');
console.log('Greeting:', greeting); // Will output a personalized greeting

API Reference

Functions

addNumbers(a: number, b: number)

  • Parameters:
    • a: First number
    • b: Second number
  • Returns: Promise with the sum result

getGreeting(name: string)

  • Parameters:
    • name: Name to include in greeting
  • Returns: Promise with the greeting message

Server Configuration

By default, the client connects to http://localhost:8000. The server implementation should be running and accessible at this address.

For server setup and configuration, please refer to the mcp-python-sse repository.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /