Web Viewer MCP Server

Web Viewer MCP Server

Allows AI agents to control and interact with VS Code webviews by providing tools for navigation, element interaction, and state retrieval. It facilitates automated tasks like clicking elements, inputting text, and reading the DOM structure within a VS Code tab.

Category
Visit Server

README

Web Viewer - VS Code Extension Template

VS Code extension template để hiển thị webview với tích hợp MCP Server cho AI agent.

Tính năng

  • 📱 Web Viewer: Hiển thị HTML/SPA trong VS Code tab
  • 🤖 MCP Server: Standalone server cho AI agent (Claude, Cursor, Gemini)
  • 🔧 Tools: Open, close, navigate, click, input, get state
  • 📦 Resources: State, DOM structure

Cài đặt

npm install
npm run build

Scripts

Script Mô tả
npm run build Build tất cả (webview + extension)
npm run build:webview Build webview bằng Vite
npm run dev:webview Watch mode cho webview
npm run compile Compile TypeScript extension

Chạy Extension

  1. Mở project trong VS Code
  2. Nhấn F5 để chạy Extension Development Host
  3. Chạy command Open Web viewer từ Command Palette

MCP Server

Tools

Tool Mô tả
web_open Mở tab Web viewer
web_close Đóng tab Web viewer
web_navigate Navigate đến route
web_click Click element theo CSS selector
web_input Nhập text vào input field
web_get_state Lấy state hiện tại

Resources

URI Mô tả
spa://state Current state (URL, title, forms, links)
spa://dom DOM structure

Sử dụng với AI Agent

Cấu hình MCP

Thêm vào MCP config (ví dụ mcp_config.json):

{
  "mcpServers": {
    "web-viewer": {
      "command": "node",
      "args": ["<path-to-project>/out/mcp/mcp-server.js"]
    }
  }
}

Kiến trúc

AI Agent <--stdio--> MCP Server (node) <--HTTP:54321--> VS Code Extension <--postMessage--> Webview

Cấu trúc Project

├── media/                    # Build output (Vite)
│   ├── index.html
│   ├── styles.css
│   └── bundle.js
├── src/
│   ├── extension.ts          # Entry point + business logic
│   ├── core/                 # Generic modules
│   │   ├── ViewerProvider.ts # Configurable webview
│   │   └── HttpBridge.ts     # HTTP command router
│   ├── mcp/
│   │   └── mcp-server.ts     # Standalone MCP server
│   ├── spa/
│   │   └── tools/
│   │       └── index.ts      # Tool definitions
│   └── webview/              # Webview source (Vite)
│       ├── index.html
│       ├── styles.scss
│       ├── bridge.ts
│       └── main.ts
├── vite.config.ts
├── tsconfig.json
└── package.json

Customization

Thay đổi UI

Sửa files trong src/webview/, sau đó chạy npm run build:webview

Thêm MCP Tools

Sửa src/spa/tools/index.tssrc/mcp/mcp-server.ts

Thay đổi Config

Sửa src/extension.ts:

const webviewProvider = new WebviewProvider(context.extensionUri, {
    viewType: 'your.viewType',
    title: 'Your Title',
    mediaFolder: 'media',
});

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured