About MCP Client Demo
A demo MCP client using Web Workers and Server-Sent Events for transport. Built with TypeScript and React, it provides an interactive UI for testing MCP server tools and connections.
Key features
- 01Web Worker-based client
- 02Server-Sent Events transport
- 03Interactive testing UI
- 04TypeScript type safety
- 05Vite and React
Use cases
- 01Learning MCP protocol implementation
- 02Testing MCP server functionality
- 03Building browser-based MCP applications
MCP support
A client that connects to MCP servers via Web Workers and SSE, exposing tool discovery and execution capabilities through an interactive testing interface.
Details
From the project READMEMCP Client Demo
Note: This project is currently a work in progress (WIP). Features and implementations may change significantly.
A demo implementation of a Model Context Protocol (MCP) client using Web Workers and Server-Sent Events (SSE).
Features
- Web Worker-based MCP client implementation
- Server-Sent Events (SSE) transport
- Interactive testing UI
- Type-safe implementation with TypeScript
- Built with Vite + React
Getting Started
Prerequisites
- Node.js 18.x or later
- An MCP-compatible server running on
localhost:3020
Installation
- Clone the repository
- Install dependencies:
npm install
Development
Start the development server:
npm run dev
Testing the Worker
- Open
test.htmlin your browser - Click "Connect" to establish connection with the MCP server
- Use "List Tools" to see available tools
- Select a tool and provide input in JSON format
- Click "Execute Tool" to run the selected tool
Project Structure
src/
├── worker.ts # MCP client worker implementation
├── worker-test.ts # Worker test interface
├── types.ts # Type definitions
└── App.tsx # Main React application
Key Components
- worker.ts: Main Web Worker implementation of the MCP client
- worker-test.ts: Testing interface for the worker
- types.ts: Shared type definitions for worker commands and responses
Implementation Details
Worker Commands
The worker accepts the following commands:
connect: Establish connection with MCP serverdisconnect: Close the connectionlistTools: Get list of available toolscallTool: Execute a specific tool
Worker Responses
The worker sends responses in the following format:
type WorkerResponse =
| {
type: "status";
status: WorkerStatus;
}
| {
type: "result";
result: ListToolsResult | CallToolResult;
}
| {
type: "error";
error: string;
details?: Record<string, unknown>;
};
Development
Building
Build the project:
npm run build
Linting
Run ESLint:
npm run lint
Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.