옵션

대상 URL과 원하는 도구 기능을 기반으로 사이트별 WebMCP 초기화 스크립트를 생성, 컴파일 및 유효성 검사합니다.

...모든 것을 확장하십시오
0
업데이트 된 시간 2026년 9월 30일

WebMCP Gen

매니페스트를 작성하고, 이를 init 스크립트로 컴파일한 다음, Chrome이 해당 도구를 등록하고 호출하는지 검증하여 웹사이트 전용 WebMCP 도구를 제작합니다.

이 스킬은 중첩된 에이전트를 호출하지 않습니다. 페이지 탐색, manifest.json 작성, 그리고 유효성 검사 결과에 따른 반복 작업은 사용자가 직접 수행해야 합니다.

설정 확인

스킬 디렉터리에서 아직 설치되지 않은 종속성이 있다면 다음 명령을 실행하여 설치하십시오:

cd skills/webmcp-gen
pnpm install

이렇게 하면 고정된 Stagehand 패키지와 생성된 stagehand-example.ts를 실행하는 데 사용되는 TypeScript 툴체인(tsx, typescript, @types/node)이 설치됩니다.

워크플로

  1. 슬래시가 정확히 하나만 포함된 아티팩트 슬러그를 선택하십시오:
/

예시:

example.com/page-context
  1. 아티팩트 스캐폴딩:
node scripts/scaffold.mjs example.com/page-context --url https://example.com
  1. browse CLI를 사용하여 대상 페이지를 탐색:
browse open https://example.com --local
browse snapshot
browse get title
browse get url
browse get text body
browse get html body

시각적 레이아웃이 중요하지 않은 한, 스크린샷보다는 browse snapshot, 페이지 텍스트, DOM 검사를 우선적으로 사용하십시오. 탐색이 완료되면 browse stop을 사용하십시오.

  1. artifacts///manifest.json 파일을 편집하세요. 매니페스트가 가장 신뢰할 수 있는 정보원입니다.

  2. 컴파일:

node scripts/compile.mjs artifacts/example.com/page-context
  1. 실행 가능한 Stagehand 예제(stagehand-example.ts)를 생성하고 tsx로 실행합니다:
node scripts/generate-stagehand-example.mjs artifacts/example.com/page-context
npx tsx artifacts/example.com/page-context/stagehand-example.ts
  1. 검증:
node scripts/validate.mjs artifacts/example.com/page-context
  1. 검증이 실패하면 eval.json 및 eval-report.md를 확인하고, manifest.json을 수정한 후 다시 컴파일하고 검증합니다.

매니페스트 계약

{
  "domain": "example.com",
  "task": "page-context",
  "url": "https://example.com",
  "generatedAt": "2026-06-04T00:00:00.000Z",
  "tools": [
    {
      "name": "example_com_page_context",
      "description": "페이지 컨텍스트를 반환합니다.",
      "inputSchema": {
        "type": "object",
        "properties": {},
        "required": []
      },
      "implementation": {
        "kind": "dom",
        "source": "return { success: true, title: document.title, url: location.href };"
      },
      "fixtureInput": {}
    }
  ]
}

작성 규칙

  • implementation.source는 async (input) => { ... }; 내부에 삽입되며, 전체 함수 래퍼가 아닌 JavaScript 문장을 작성해야 합니다.
  • JSON으로 직렬화 가능한 객체를 반환해야 합니다.
  • WebMCP 코드는 브라우저 페이지 내에서 실행됩니다. document, location, navigator 및 동일 출처(same-origin) fetch와 같은 브라우저 기본 API를 사용하십시오.
  • implementation.source 내부에서는 Playwright, Puppeteer, Stagehand, XPath 헬퍼 또는 에이전트/브라우저 명령어를 사용하지 마십시오 .
  • document.querySelector 및 querySelectorAll에는 유효한 브라우저 CSS 선택자만 전달해야 합니다.
  • 표시된 텍스트를 찾으려면 Array.from(document.querySelectorAll(...)).find((el) => (el.textContent || "").includes("...")).를 사용하십시오.
  • API 키, 베어러 토큰, 쿠키, localStorage 비밀 정보 또는 사용자 자격 증명을 포함하지 마십시오.
  • eval 이나 new Function을 사용하지 마십시오.
  • 사용자가 명시적으로 요청하지 않는 한 파괴적인 작업은 피하십시오.
  • 구현은 방어적으로 하십시오. 누락된 요소를 확인하고 구조화된 { success: false, error: "..." } 응답을 반환하십시오.
  • 생성된 초기화 스크립트는 최상위 프레임에만 WebMCP 도구를 등록합니다.

출력 레이아웃

artifacts///
  manifest.json
  webmcp.init.js
  stagehand-example.ts
  eval.json
  eval-report.md

이 예제를 독립형 프로젝트로 만들려면, npx create-browser-app을 사용하여 Stagehand 앱을 생성하고, 생성된 webmcp.init.js 파일을 해당 앱에 추가하십시오( page.addInitScript({ path: "webmcp.init.js" })를 사용하여 불러오세요).

GitHub에서 보기
---
name: webmcp-gen
description: Create, compile, and validate site-specific WebMCP init scripts from a target URL and desired tool capability.
license: MIT
---

# WebMCP Gen

Author website-specific WebMCP tools by writing a manifest, compiling it to an init script, and validating that Chrome registers and invokes the tools.

This skill does not call a nested agent. You are responsible for exploring the page, writing `manifest.json`, and iterating based on validation output.

## Setup check

From the skill directory, install dependencies if they are not already installed:

```bash
cd skills/webmcp-gen
pnpm install
```

This installs the pinned Stagehand package plus the TypeScript toolchain (`tsx`,
`typescript`, `@types/node`) used to run the generated `stagehand-example.ts`.

## Workflow

1. Pick an artifact slug with exactly one slash:

```text
<domain>/<task>
```

Example:

```text
example.com/page-context
```

2. Scaffold the artifact:

```bash
node scripts/scaffold.mjs example.com/page-context --url https://example.com
```

3. Explore the target page with the `browse` CLI:

```bash
browse open https://example.com --local
browse snapshot
browse get title
browse get url
browse get text body
browse get html body
```

Prefer `browse snapshot`, page text, and DOM inspection over screenshots unless visual layout matters. Use `browse stop` when exploration is complete.

4. Edit `artifacts/<domain>/<task>/manifest.json`. The manifest is the source of truth.

5. Compile:

```bash
node scripts/compile.mjs artifacts/example.com/page-context
```

6. Generate a runnable Stagehand example (`stagehand-example.ts`) and run it with `tsx`:

```bash
node scripts/generate-stagehand-example.mjs artifacts/example.com/page-context
npx tsx artifacts/example.com/page-context/stagehand-example.ts
```

7. Validate:

```bash
node scripts/validate.mjs artifacts/example.com/page-context
```

8. If validation fails, inspect `eval.json` and `eval-report.md`, patch `manifest.json`, then compile and validate again.

## Manifest contract

```json
{
  "domain": "example.com",
  "task": "page-context",
  "url": "https://example.com",
  "generatedAt": "2026-06-04T00:00:00.000Z",
  "tools": [
    {
      "name": "example_com_page_context",
      "description": "Returns page context.",
      "inputSchema": {
        "type": "object",
        "properties": {},
        "required": []
      },
      "implementation": {
        "kind": "dom",
        "source": "return { success: true, title: document.title, url: location.href };"
      },
      "fixtureInput": {}
    }
  ]
}
```

## Authoring rules

- `implementation.source` is inserted inside `async (input) => { ... }`; write JavaScript statements, not a full function wrapper.
- Return a JSON-serializable object.
- WebMCP code runs inside the browser page. Use browser-native APIs: `document`, `location`, `navigator`, and same-origin `fetch`.
- Do not use Playwright, Puppeteer, Stagehand, XPath helpers, or agent/browser commands inside `implementation.source`.
- `document.querySelector` and `querySelectorAll` must receive valid browser CSS selectors only.
- To find visible text, use `Array.from(document.querySelectorAll(...)).find((el) => (el.textContent || "").includes("..."))`.
- Do not include API keys, bearer tokens, cookies, localStorage secrets, or user credentials.
- Do not use `eval` or `new Function`.
- Avoid destructive actions unless the user explicitly asked for them.
- Make implementations defensive: check for missing elements and return structured `{ success: false, error: "..." }` responses.
- Generated init scripts register WebMCP tools only in the top frame.

## Output layout

```text
artifacts/<domain>/<task>/
  manifest.json
  webmcp.init.js
  stagehand-example.ts
  eval.json
  eval-report.md
```

To turn the example into a standalone project, scaffold a Stagehand app with
`npx create-browser-app` and drop the generated `webmcp.init.js` into it (load it
with `page.addInitScript({ path: "webmcp.init.js" })`).

webmcp-gen 설치

스킬 파일을 다운로드하여 .claude/skills/ 디렉터리에 압축을 풀어주세요.

ZIP 다운로드

저장소를 클론하고 스킬 파일을 프로젝트에 복사하세요.

git clone https://github.com/browserbase/skills/tree/main/skills/webmcp-gen # Copy SKILL.md to your .claude/skills/ directory

복사 복사
빠른 설정: 스킬 폴더를 .claude/skills/로 복사하세요. Claude가 해당 스킬을 자동으로 감지하여 사용할 것입니다.
저장소 browserbase/skills

관련 스킬

algorithmic-art
업데이트 된 시간 2026년 8월 27일
systematic-debugging
업데이트 된 시간 2026년 9월 3일
tech-debt-tracker
업데이트 된 시간 2026년 8월 29일
continual-learning
업데이트 된 시간 2026년 9월 10일
OR