webmcp-forge
by noahsh
README.md
# WebMCP Forge
> **Compile any website or localhost app into a verified WebMCP server, `llms.txt`, and prompt-injection-audited `SKILL.md` in one command.**
[](https://github.com/noahsh/webmcp-forge/actions/workflows/ci.yml)
[](https://github.com/noahsh/webmcp-forge/releases/tag/v0.1.0)
[](https://glama.ai/mcp/servers/@noahsh/webmcp-forge)
[](https://www.typescriptlang.org/)
[](https://nodejs.org/)
[](https://modelcontextprotocol.io/)
[](./src/security/rules.ts)
[](./LICENSE)
---

> Prefer GIF? View [`assets/demo.gif`](assets/demo.gif).

---
## Why `webmcp-forge`?
Vision loops burn thousands of screenshot & HTML tokens on every click, while static `SKILL.md` files go stale and carry supply-chain prompt-injection risks. **`webmcp-forge`** crawls your live app once with Playwright, compiles every workflow into strict JSON-Schema MCP tools, verifies the pack with **SkillGuard**, and serves live tools over `stdio` or `sse`.
| Capability | Raw Browser Scraping | Static `SKILL.md` | `webmcp-forge` |
| --- | --- | --- | --- |
| **Token Cost** | Raw `outerHTML` + `1280×800` screenshots (`1,366` vision tokens/page) on every turn | Prose instructions; agent still scrapes/guesses DOM | **Up to 94% token reduction** (`92.4%` verified on bundled 4-page demo store: `19,033 → 1,437` tokens) |
| **Execution Determinism** | Fragile LLM-guessed CSS/XPath selectors | Unverified natural-language hints | **Typed JSON Schema tools** + standalone `mcp-server.ts` with multi-strategy Playwright locators |
| **API & Form Discovery** | Blind to background XHR/fetch payloads | Manually authored & drifts fast | Auto-extracts forms, tables, buttons, routes, ARIA landmarks, and live JSON APIs |
| **Supply-Chain Security** | Unaudited DOM text exposed to prompt injection | Zero integrity or payload checks | **Built-in SkillGuard** (12 static/entropy/decode rules + SHA-256 `WEBMCP-MANIFEST` signing) |
| **Developer Debugging** | Trial-and-error in agent logs | Plain Markdown text | **Swiss Light-Mode Visual Inspector** (`localhost:4173`) with one-click **Test Tool Live** |
---
## 1-Line Quickstarts
Requires **Node.js 20+** and Playwright Chromium (`npx playwright install chromium`). Listed on the [Glama MCP Server Directory](https://glama.ai/mcp/servers/@noahsh/webmcp-forge) and testable with [MCP Inspector](https://glama.ai/mcp/inspector).
### Compile Any Site or Localhost Dev Server
```bash
npx webmcp-forge http://localhost:3000 --ui
```
That single command crawls your app, outputs `webmcp.json`, `mcp-server.ts`, `llms.txt`, `llms-full.txt`, and SHA-256-signed `SKILL.md` to `./agent-pack`, audits them with **SkillGuard**, and opens the Visual Inspector at `http://localhost:4173`.
### Plug Into Any Coding Agent in One Line
**Claude Code**
```bash
claude mcp add webmcp-forge -- npx -y webmcp-forge serve ./agent-pack/webmcp.json --transport stdio
```
**OpenCode**
```bash
node -e "const fs=require('fs'),p='opencode.json',c=fs.existsSync(p)?JSON.parse(fs.readFileSync(p,'utf8')):{$schema:'https://opencode.ai/config.json'};c.mcp=c.mcp||{};c.mcp['webmcp-forge']={type:'local',command:['npx','-y','webmcp-forge','serve','./agent-pack/webmcp.json','--transport','stdio'],enabled:true};fs.writeFileSync(p,JSON.stringify(c,null,2)+'\n');"
```
**Cursor**
```bash
node -e "const fs=require('fs');fs.mkdirSync('.cursor',{recursive:true});const p='.cursor/mcp.json',c=fs.existsSync(p)?JSON.parse(fs.readFileSync(p,'utf8')):{};c.mcpServers=c.mcpServers||{};c.mcpServers['webmcp-forge']={command:'npx',args:['-y','webmcp-forge','serve','./agent-pack/webmcp.json','--transport','stdio']};fs.writeFileSync(p,JSON.stringify(c,null,2)+'\n');"
```
**Gemini CLI**
```bash
gemini mcp add webmcp-forge npx -y webmcp-forge serve ./agent-pack/webmcp.json --transport stdio
```
**Antigravity**
```bash
node -e "const fs=require('fs'),os=require('os'),path=require('path'),p=path.join(os.homedir(),'.gemini','antigravity','mcp_config.json');fs.mkdirSync(path.dirname(p),{recursive:true});const c=fs.existsSync(p)?JSON.parse(fs.readFileSync(p,'utf8')):{};c.mcpServers=c.mcpServers||{};c.mcpServers['webmcp-forge']={command:'npx',args:['-y','webmcp-forge','serve','./agent-pack/webmcp.json','--transport','stdio']};fs.writeFileSync(p,JSON.stringify(c,null,2)+'\n');"
```
> Prefer HTTP/SSE transport? Run `npx webmcp-forge serve ./agent-pack/webmcp.json --transport sse --port 4174`.
---
## Gate Pull Requests with `webmcp-forge audit` (GitHub Action)
Drop this workflow into `.github/workflows/skillguard.yml` to block hidden prompt injections, Unicode smuggling, Base64 exfiltration payloads, and tampered `SKILL.md` manifests on every PR:
```yaml
name: SkillGuard Audit
on:
pull_request:
paths:
- '**/SKILL.md'
- 'agent-pack/**'
jobs:
audit-skills:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Run SkillGuard strict audit
run: npx -y webmcp-forge audit . --strict
```
---
## Compiled Pack Breakdown
Every `webmcp-forge scan <url>` outputs five deterministic artifacts into `--out <dir>` (default `./agent-pack`):
| Artifact | What It Contains |
| --- | --- |
| **`webmcp.json`** | Typed WebMCP manifest with crawled pages, ARIA landmarks, observed JSON APIs, token savings breakdown, SkillGuard audit summary, and executable tool definitions (`form`, `action`, `navigation`, `table`, `api`). |
| **`mcp-server.ts`** | Standalone TypeScript MCP server using `@modelcontextprotocol/sdk` (`Server`, `StdioServerTransport`, `SSEServerTransport`) and Playwright—ready to compile or customize. |
| **`llms.txt`** | Clean, spec-aligned agent discovery index summarizing routes, tools, APIs, and pack files. |
| **`llms-full.txt`** | Complete Markdown technical reference including full JSON Schemas and field specifications for every tool. |
| **`SKILL.md`** | Signed agent playbook carrying `integrity_sha256` in YAML frontmatter and an inline `<!-- WEBMCP-MANIFEST-START -->` / `<!-- WEBMCP-MANIFEST-END -->` table binding the Markdown body and every sibling file by SHA-256. |
---
## CLI Reference
### `webmcp-forge scan <url>`
Crawl a live URL (or pass `<url>` directly without `scan`), compile the WebMCP pack, audit `SKILL.md`, and optionally launch the Visual Inspector.
| Flag | Default | Description |
| --- | --- | --- |
| `-o, --out <dir>` | `./agent-pack` | Output directory for compiled agent pack |
| `--ui` | `false` | Launch the Swiss light-mode Visual Inspector after compilation |
| `-p, --port <number>` | `4173` | Port for the Visual Inspector HTTP server |
| `--max-pages <number>` | `8` | Maximum same-origin pages to crawl |
| `--max-depth <number>` | `2` | Maximum link crawl depth |
| `--timeout <number>` | `15000` | Per-page navigation timeout in ms |
| `--json` | `false` | Output scan result as JSON |
| `--no-open` | — | Do not attempt to open the browser automatically |
### `webmcp-forge audit <targetPath>`
Run SkillGuard static, Shannon-entropy, and SHA-256 manifest verification on a `SKILL.md` file or directory. Exits with code `1` on threats.
| Flag | Default | Description |
| --- | --- | --- |
| `--json` | `false` | Output SkillGuard audit report as JSON |
| `--strict` | `false` | Exit with code `1` on any finding (including warnings) |
### `webmcp-forge serve <manifestPath>`
Start a live Playwright-backed MCP server from a compiled `webmcp.json`.
| Flag | Default | Description |
| --- | --- | --- |
| `-t, --transport <mode>` | `stdio` | MCP transport mode: `stdio` or `sse` |
| `-p, --port <number>` | `4174` | Port for SSE transport |
### Visual Inspector API (`--ui`)
- `GET /api/health` — server readiness, target URL, and compiled tool count
- `GET /api/pack` — compiled `manifest`, `auditReport`, raw `artifacts`, and `artifactMeta` (`bytes`, `sha256`)
- `POST /api/test-tool` — executes a named tool live via `PlaywrightToolExecutor` (`{ toolName, args }`)
- `POST /api/audit` — runs SkillGuard on submitted `{ content, filename }` or re-audits the pack on disk
---
## SkillGuard Security Scanner
**SkillGuard** audits `SKILL.md` files and agent packs across 12 deterministic rules, pinpointing exact `file:line:column` coordinates, decoded obfuscated payloads, and remediation steps:
| Rule ID | Category | Severity | What It Catches |
| --- | --- | --- | --- |
| `SG-UNI-001` | `unicode-smuggling` | `critical` | Zero-width characters (`U+200B`–`U+200F`, `U+2060`–`U+2064`, non-BOM `U+FEFF`) & Unicode Tag ASCII smuggling (`U+E0000`–`U+E007F`) with decoded ASCII preview |
| `SG-UNI-002` | `unicode-smuggling` | `critical` | Bidirectional Trojan Source control characters (`U+202A`–`U+202E`, `U+2066`–`U+2069`) |
| `SG-INJ-001` | `prompt-injection` | `critical` | Direct prompt-override & jailbreak directives (`ignore all previous instructions`, `override safety`, `new system prompt:`) |
| `SG-INJ-002` | `prompt-injection` | `critical` | Suspicious agent, shell, or credential directives hidden inside HTML comments (`<!-- ... -->`) |
| `SG-INJ-003` | `prompt-injection` | `high` | Role or chat-template delimiter spoofing (`<\|im_start\|>`, `<\|system\|>`, `[INST]`, `<system>`, `### SYSTEM OVERRIDE`) |
| `SG-OBF-001` | `obfuscation` | `critical` / `high` | High-entropy (`>= 2.8`) Base64 payloads decoding to shell/network/injection commands (`critical`) or long hidden text (`high`), ignoring `data:image/*`, UUIDs, and SHA-256 digests |
| `SG-OBF-002` | `obfuscation` | `high` | Explicit decode/eval obfuscation (`base64 -d`, `atob(`, `Buffer.from(..., 'base64')`, `String.fromCharCode(...)`, `\x..` chains, PowerShell `-EncodedCommand`) |
| `SG-EXF-001` | `network-exfiltration` | `critical` | Exfiltration capture/tunnel domains (`webhook.site`, `requestbin`, `pipedream.net`, `burpcollaborator`, `oastify.com`, `interact.sh`, `ngrok`), raw non-localhost IP URLs, and parameterized image beacons |
| `SG-EXF-002` | `network-exfiltration` | `critical` | Remote script pipes (`curl \| bash`, `wget \| sh`, `Invoke-WebRequest \| iex`) and file/env HTTP upload flags |
| `SG-SHL-001` | `dangerous-shell` | `critical` | Reverse-shell primitives (`/dev/tcp/`, `nc -e`, `mkfifo /tmp`, `bash -i >&`) and destructive commands (`rm -rf /`, `chmod +s`) |
| `SG-SHL-002` | `dangerous-shell` | `high` | Credential & secret harvesting (`~/.ssh`, `id_rsa`, `~/.aws/credentials`, `/etc/shadow`, `/etc/passwd`, `cat .env`, `printenv`, `env \|`) |
| `SG-MAN-001` | `manifest-integrity` | `critical` | `WEBMCP-MANIFEST` verification failure: `SKILL.md` body SHA-256 mismatch, frontmatter `integrity_sha256` mismatch, or tampered/missing sibling artifact |
---
## Programmatic API
```ts
import {
scanAndCompile,
auditTarget,
startMcpServer,
startInspectorServer,
} from 'webmcp-forge';
const compiled = await scanAndCompile('http://127.0.0.1:3456', {
outDir: './agent-pack',
crawlOptions: { maxPages: 8, maxDepth: 2, timeoutMs: 15000 },
});
const audit = await auditTarget('./agent-pack/SKILL.md');
if (audit.status !== 'CLEAN') {
throw new Error(`SkillGuard failed (${audit.score}/100)`);
}
const inspector = await startInspectorServer({ packDir: compiled.outDir, port: 4173 });
const mcp = await startMcpServer(compiled.files.webmcpJson, { transport: 'sse', port: 4174 });
```
---
## Local Development & Testing
```bash
git clone https://github.com/noahsh/webmcp-forge.git
cd webmcp-forge
npm install
npx playwright install chromium
npm run typecheck # Strict TypeScript check
npm run build # Bundle CLI/library (tsup) and Visual Inspector UI (vite)
npm test # Run all 4 Vitest + Playwright integration test suites
npm run demo:server # Run bundled Atelier Hardware demo store on http://127.0.0.1:3456
npm run capture:demo # Re-run real scan + Playwright/ffmpeg asset capture
```
See [CONTRIBUTING.md](./CONTRIBUTING.md) and [CHANGELOG.md](./CHANGELOG.md).
## License
[MIT](./LICENSE) © 2026 WebMCP Forge Contributors
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues