selvans
A framework that makes any web application natively operable by AI agents through the Model Context Protocol (MCP), replacing browser automation with structured UI semantic trees and typed backend operations.
README
selvans
selvans is a framework that makes any web application natively operable by AI agents through the Model Context Protocol (MCP).
Instead of using browser automation, AI agents connect directly to your application through a structured protocol — observing the UI semantic tree and calling typed tools to interact with it.
How It Works
External AI (Claude Desktop, Cursor…)
│ MCP / SSE
▼
┌──────────────────┐
│ selvans-core │ ← Hub service (WebSocket + MCP server + admin UI)
└──────┬─────┬─────┘
│ WS │ WS
┌────┘ └────┐
▼ ▼
Angular App Python Backend
(selvans- (selvans-
angular) python)
- selvans-core is the central hub. It exposes an MCP server (SSE) that external AI clients connect to, and a WebSocket endpoint that your frontend and backend connect to.
- selvans-angular integrates into your Angular app. It registers a semantic UI tree and built-in tools (
click_element,form_input,get_page_state…) with the Core. - selvans-python integrates into your Python/FastAPI backend. It registers typed service operations with the Core.
- The AI calls tools and operations through the Core, which routes them to the right app in real time.
Repository Structure
selvans/
├── packages/
│ ├── selvans-angular/ # Angular library (npm)
│ └── selvans-python/ # Python client library (PyPI)
├── services/
│ └── selvans-core/ # Hub service (Docker)
├── demos/
│ ├── selvans-angular-demo/ # Angular demo app
│ └── selvans-python-demo/ # FastAPI demo backend
└── docker-compose.yml
Quick Start
One command (recommended)
Dev (Node 18+ + pnpm + Docker):
pnpm run setup
This starts Core (:8080) + Python demo (:8001) + Angular demo (:4200) — all in Docker, including the Angular dev server with live-reload. Open http://localhost:4200 — the selvans-panel should show "connected".
Live-reload: the Angular source is bind-mounted into the container. Saving a file in
demos/selvans-angular-demo/orpackages/selvans-angular/triggers an automatic browser update (~1 s latency due to polling on Docker Desktop Windows).First startup: the Angular container build (esbuild + pnpm install inside the container) takes 1-3 minutes.
pnpm run setupwaits up to 180 s for:4200to respond.
Non-technical / profano (Docker only — no Node/pnpm needed):
# macOS / Linux
./scripts/setup.sh --docker
# Windows
scripts\setup.bat --docker
# Or directly:
docker compose --profile full up --build
Note: the
--docker/--profile fullpath uses the nginx container (selvans-angular-demo, profilefull) — a static production-like bundle on:4200. Do not run it together withpnpm run setup(both bind port 4200).
See [[Getting-started]] in the wiki for the full guide, prerequisites per persona, and troubleshooting.
Manual start
1. Start the Core
docker compose up selvans-core
# Admin UI → http://localhost:8080/ui
# MCP SSE → http://localhost:8080/mcp/sse
2. Integrate the Angular Frontend
npm install selvans-angular
// app.module.ts
import { SelvansModule } from 'selvans-angular';
@NgModule({
imports: [
SelvansModule.forRoot({
coreUrl: 'http://localhost:8080',
appId: 'my-app'
})
]
})
export class AppModule {}
Mark your components with semantic directives:
<main [SelvansNode]="{ id: 'main', template: 'layout', description: 'Main content area' }">
<form [SelvansNode]="{ id: 'login-form', template: 'form', description: 'User login form' }">
<input [SelvansTarget]="'email-input'" type="email" />
<button [SelvansTarget]="'submit-btn'">Login</button>
</form>
</main>
3. Integrate the Python Backend
pip install selvans
# main.py
from selvans import SelvansBeApp, SelvansBeConfig, SelvansService, operation
class TaskService(SelvansService):
name = "tasks"
description = "Task management"
@operation("list", description="List tasks, optionally filtered by status")
async def list_tasks(self, status: str = "") -> list[dict]:
return await db.list_tasks(status=status)
@operation("create", description="Create a new task")
async def create_task(self, title: str, priority: str = "medium") -> dict:
return await db.create_task(title, priority)
surface = SelvansBeApp(SelvansBeConfig(core_url="http://localhost:8080"))
surface.register(TaskService())
app = surface.create_app()
4. Connect an AI Client
Add the Core's MCP endpoint to your AI client (e.g. Claude Desktop claude_desktop_config.json):
{
"mcpServers": {
"selvans": {
"url": "http://localhost:8080/mcp/sse"
}
}
}
The AI can now observe your app's UI and call your backend operations directly.
Run the Full Demo
pnpm run setup
# → Core :8080 + Python demo :8001 + Angular dev container :4200 (live-reload)
Or all-in-Docker prod-like (no Node required):
docker compose --profile full up --build
# → Core :8080 + Python demo :8001 + Angular nginx :4200 (static bundle)
| Service | URL | Mode |
|---|---|---|
| selvans-core | http://localhost:8080 | both |
| Admin UI | http://localhost:8080/ui | both |
| MCP SSE endpoint | http://localhost:8080/mcp/sse | both |
| Python demo backend | http://localhost:8001 | both |
| Angular demo frontend | http://localhost:4200 | dev (live-reload) / prod-like (nginx) |
Note:
selvans-angular-dev(dev, live-reload) andselvans-angular-demo(profilefull, nginx) both bind port 4200 — do not start them together.
Packages
| Package | Description | Docs |
|---|---|---|
selvans-angular |
Angular library — semantic UI tree + built-in tools | docs |
selvans-python |
Python library — FastAPI integration + service operations | docs |
selvans-core |
Hub service — MCP server + WebSocket hub + admin UI | docs |
Built-in Frontend Tools
The Angular library registers these tools automatically:
| Tool | Description |
|---|---|
get_page_state |
Returns current URL, title, and visible text |
navigate |
Navigate to a route by path |
get_elements |
List all elements marked with [SelvansTarget] |
click_element |
Click an element by its target ID |
form_input |
Read or set the value of a form field by target ID |
License
Distributed under the Apache 2.0 license — see LICENSE and NOTICE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。