AppMCP
AppMCP enables AI agents to build and publish self-contained HTML apps that query live data via a secure, read-only SQL proxy, with Azure AD authentication and role-based access.
README
AppMCP — publish self-contained HTML apps backed by live data
AppMCP lets an AI agent build a self-contained HTML app against live data and publish it to a permanent, authenticated catalog at a stable URL. It is a sibling of KPIMCP and reuses the same data-source layer, Azure AD auth, and role model.
The agent never sees database credentials. It discovers the data catalog, writes SQL, and the published app calls back to a server-side, validated, read-only SQL proxy that holds the credentials.
How it works
-
Discover —
list_datasources,list_schemas,list_tables,list_columnsexpose the full catalog the app is allowed to read. -
Design —
run_queryruns read-only SELECTs so the agent can validate its SQL and preview results before building anything. -
Author — the agent writes a complete HTML document. To read data at runtime, its JavaScript calls the injected client:
const { columns, rows } = await AppData.query( "SELECT rep, SUM(total) AS total FROM sales.invoice WHERE day > $1 GROUP BY rep", ["2025-01-01"] ); -
Publish —
create_app(draft) →publish_app(live in the catalog). Authors publish directly; there is no separate approval gate. -
View — users browse the catalog at
/and open apps at/a/{slug}. Viewing requires an Azure AD sign-in; any authenticated org user can open any published app.
Security model
- No credentials in the browser. Apps call
/a/{slug}/sql, which is pinned to the app's chosen datasource and runs on a read-only connection. - Every proxy request is validated regardless of what SQL arrives: single statement, SELECT-only (no DDL/DML), schema-qualified tables in the allowlist, forced row cap, statement timeout.
- The real boundary is the database account. Point each datasource at a
least-privilege, read-only user;
allowed_schemasfurther constrains what any app can read. The proxy is, by design, a read-only SQL gateway reachable by authenticated employees, so what that account can read is what apps can read. - Sandboxed serving. App HTML is served from an isolated origin with a strict
CSP and a per-render nonce on inline scripts;
connect-src 'self'means a compromised app can only talk to its own data proxy, not exfiltrate. Attach event listeners in<script>blocks (inlineon*=handlers are blocked by CSP). - Identity + audit. Browser session via Azure AD; every proxy query is logged against the signed-in user.
Roles (tool_access.json)
admin— all MCP tools; sees/manages all apps.author— explore data, create/publish/manage their own apps.viewer— no MCP tools; can browse and open published apps in the catalog.
Run locally
cp .env.example .env # fill in DATASOURCES_JSON (read-only DSNs)
cp .env.local.example .env.local
cp tool_access.example.json tool_access.json # map your users to roles (gitignored)
pip install -r requirements.txt
uvicorn server:app --reload --port 8000
With LOCAL_MODE=true and AUTH_ENABLED=false, a fixed local admin identity is
assumed, so the catalog/manage UI works without any Azure configuration.
App history (git audit trail)
With GIT_HISTORY_ENABLED=true, every app lifecycle change
(create / update / publish / unpublish / delete) is mirrored into a dedicated
git repo, giving a reviewable history of what the AI agent has built over time.
Each change writes to the clone and commits + pushes it:
<GIT_HISTORY_SUBDIR>/<slug>/index.html # the app HTML
<GIT_HISTORY_SUBDIR>/<slug>/app.json # title/datasource/status/who/when
Commit message: create app: <title> (<slug>) by <author>. With
GIT_HISTORY_PUSH=true it pushes to GIT_HISTORY_BRANCH on GIT_HISTORY_REMOTE.
Setup (GitHub, token-in-URL):
- Create a GitHub PAT with Contents: read & write on the history repo
(
https://github.com/your-org/AppMCP-History). - In
.env, setGIT_HISTORY_REPO_URL(already filled in.env.example) andGIT_HISTORY_TOKEN=<PAT>. - Run
./deploy.sh. On first deploy it clones the repo into./data/app-history(mounted into the container at/app/data/app-history) with the token baked into the remote URL, so the container can push.
AppMCP commits/pushes to app-history; the first push creates that branch.
Git failures are logged and swallowed — they can never block an app
create/publish. git is installed in the image, and data/ is gitignored so
the history clone is never tracked by the parent repo.
Deploy
./deploy.sh builds the image and runs it on 127.0.0.1:8016 behind your
reverse proxy. Serve it from the isolated subdomain (appmcp.example.com) and
register https://appmcp.example.com/auth/callback as a redirect URI on the
Azure app.
Layout
| Path | Purpose |
|---|---|
config.py |
Settings (datasources, auth, CSP, session). |
datasources.py / db.py |
Read-only data-source layer (Redshift/PG, MySQL, MSSQL). |
validation.py / appsql.py |
SQL guardrails + the shared validated runner. |
catalog.py |
information_schema introspection (allowlist-aware). |
registry.py |
SQLite store of apps (HTML + datasource + lifecycle). |
apphistory.py |
Optional git audit trail of app changes (best-effort). |
auth.py |
Azure AD OAuth proxy + bearer auth for /mcp. |
session_auth.py |
Browser session login for the web UI. |
tool_access.py |
Role-based access (MCP tools + author/admin gates). |
web/ |
Catalog, sandboxed app serving, SQL proxy, manage UI. |
tools/ |
MCP tools: data_explore + apps_admin. |
server.py |
FastMCP + FastAPI wiring. |
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。