@web-interact-mcp/client
Version:
A production-ready TypeScript library that transforms web applications into MCP (Model Context Protocol) servers with robust two-way communication via SignalR
219 lines (164 loc) ⢠8.08 kB
Markdown
# WebInteractMCP
> Transform any web application into an MCP server with real-time two-way communication
[](LICENSE)
[](https://github.com/Vijay-Nirmal/WebInteractMCP)
[](https://github.com/Vijay-Nirmal/WebInteractMCP)
WebInteractMCP is an innovative MCP (Model Context Protocol) ecosystem that enables any web application to become an MCP server, allowing chatbots and other MCP clients to control client sessions and complete intended actions on behalf of users.
> **š¢ Check out the preview version available now!** This project is in active development. Expect breaking changes in future releases as we evolve toward version 1.0.
## š Overview
WebInteractMCP consists of two tightly integrated components that work together to create a seamless MCP experience:
- **š [@web-interact-mcp/client](lib/web-interact-mcp)** - TypeScript library for client-side integration
- **š„ļø [WebInteractMCPServer](server/WebInteractMCPServer)** - Ready to deploy Docker MCP server image for protocol handling
## ⨠Key Features
- **š§ Support full MCP Tool protocol** - including tool discovery, invocation, and all type of response Text, Image, Audio others
- **š Real-time Communication** - Robust bidirectional communication using SignalR which support WebSockets, ServerSentEvents, LongPolling
- **š ļø Dynamic Tool Registration** - Configure tools with simple JSON files
- **šÆ Session-based Control** - Per-user session management for secure isolation
- **š Framework Agnostic** - Works with any JavaScript framework (React, Angular, Vue, etc.)
- **ā” Production Ready** - Comprehensive error handling and performance optimization
- **š§ Simple Configuration** - Easy setup with JSON-based tool definitions
- **š¦ Docker Support** - Ready-to-use Docker image for easy deployment
- **š Page-specific Tools** - Define tools that can interact with specific pages or elements
- **šØ Visual Feedback** - Provides visual feedback for tool execution and user actions
## š¬ Demo
https://github.com/user-attachments/assets/bf9d15a6-fa4a-40a0-8543-cb0fd92bffac
*Click to view the demonstration of WebInteractMCP transforming a web application into an MCP server*
## šļø Architecture
```mermaid
sequenceDiagram
participant U as š¤ User
participant W as š Website
participant C as š¦ @web-interact-mcp/client
participant CB as š¤ MCP Client<br/>(ChatBot Server)
participant MS as š„ļø WebInteractMCPServer
%% Styling
Note over U,MS: WebInteractMCP Communication Flow
rect rgba(135, 206, 235, 0.1)
Note over U,MS: š Session Initialization Phase
U->>+W: š¬ Opens chat session
W->>+C: š§ Initialize MCP session
C->>+MS: š Establish 2-way connection<br/>(SignalR WebSocket)
MS-->>-C: ā
Connection established
C->>+MS: š ļø Send tools configuration
MS-->>-C: š Return session ID
C-->>-W: š Provide session ID
W-->>-U: š¢ Session ready
end
rect rgba(144, 238, 144, 0.1)
Note over U,MS: š Task Processing Phase
U->>+W: āØļø Enters task/query
W->>+CB: š¤ Send request with session ID
CB->>+MS: š Connect & register tools
MS-->>-CB: š ļø Return available tools
CB->>CB: š§ LLM processes task<br/>& selects tools
end
rect rgba(255, 182, 193, 0.1)
Note over U,MS: ā” Tool Execution Phase
CB->>+MS: šÆ Invoke tool with parameters
MS->>+C: šØ Forward tool invocation
C->>+W: š±ļø Execute actions<br/>(DOM manipulation, clicks)
W-->>-C: š Return execution result
C-->>-MS: š¤ Send tool response
MS-->>-CB: š„ Forward response to LLM
CB->>+W: šØ Return processed result
W-->>-U: šŗ Display response
end
```
## š Quick Start
### 1. Install the Client Library
```bash
# Install the stable version (Not available yet)
npm install @web-interact-mcp/client
# Or install the latest preview version
npm install @web-interact-mcp/client@preview
```
### 2. Configure Your Tools
Create a `mcp-tools.json` file:
```json
[
{
"toolId": "click-button",
"title": "Click Button",
"description": "Clicks a specific button on the page",
"mode": "silent",
"steps": [
{
"targetElement": "#submit-btn",
"action": { "type": "click", "element": "#submit-btn" }
}
]
}
]
```
### 3. Initialize in Your Web App
```typescript
import { createWebInteractMCPController } from '@web-interact-mcp/client';
const controller = createWebInteractMCPController();
await controller.loadTools('/mcp-tools.json');
await controller.createSession('http://localhost:8080');
```
### 4. Run the MCP Server
```bash
# Using Docker
docker run -p 8080:8080 webinteract-mcp-server
# Or build from source
cd server/WebInteractMCPServer
dotnet run
```
## š Project Structure
```
WebInteractMCP/
āāā lib/web-interact-mcp/ # TypeScript MCP Library
ā āāā src/ # Source code
ā āāā README.md # Library documentation
āāā server/WebInteractMCPServer/ # .NET MCP Server
ā āāā Program.cs # Server entry point
ā āāā README.md # Server documentation
āāā sample/ # Reference implementations
ā āāā angular-dotnetnet-semantic-kernel/
```
## šÆ Use Cases
- **Automated Testing** - Control web applications for E2E testing
- **User Onboarding** - Create guided tours and tutorials
- **Process Automation** - Automate repetitive web-based tasks
- **Accessibility** - Provide AI-powered navigation assistance
- **Data Entry** - Automate form filling and data collection
## š§ Technology Stack
| Component | Technologies |
|-----------|-------------|
| **Client Library** | TypeScript 5.8+, SignalR, Shepherd.js |
| **MCP Server** | .NET 9, ASP.NET Core, SignalR |
| **Sample App** | Angular 20, Semantic Kernel |
## ā ļø Development Status
**Initial preview version will be published soon. This project is in active development and has not yet reached version 1.0.**
- ā
Core functionality is working
- ā
Production-ready components available
- š Check out the preview version available now
- ā ļø Breaking changes expected in future releases
- ā ļø API is subject to change before 1.0 release
Feel free to use it in your projects, but be prepared for potential breaking changes as we approach the initial preview release.
## š Documentation
- [Client Library Guide](lib/web-interact-mcp/README.md) - Complete TypeScript library documentation
- [Server Setup Guide](server/README.md) - MCP server configuration and deployment
- [Sample Implementation](sample/angular-dotnetnet-semantic-kernel/README.md) - Working example with Angular and .NET
## š¤ Contributing
We welcome contributions! Please see our [contributing guidelines](.github/copilot-instructions.md) for development standards and workflow.
### Development Workflow
```bash
# Setup
npm install
cd lib/web-interact-mcp && npm install
cd sample/angular-dotnetnet-semantic-kernel && npm install
# Start development environment with sample app
cd sample/angular-dotnetnet-semantic-kernel
npm run start:server # Web Interact MCP server
npm run start:client # .NET client backend sample app
npm run start # Angular frontend sample app
```
## š License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## š Links
- [GitHub Issues](https://github.com/Vijay-Nirmal/WebInteractMCP/issues) - Report bugs or request features
- [Discussions](https://github.com/Vijay-Nirmal/WebInteractMCP/discussions) - Community discussions
---
**Built with ā¤ļø for the MCP ecosystem**