> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowstep.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP 예제

> 일반적인 Flowstep MCP 작업을 위한 엔드투엔드 워크플로.

## 1. 화면 생성하고 미리보기

가장 흔한 워크플로입니다. 같은 단계에서 파일을 만들며 화면을 생성한 다음 결과를 확인합니다.

```
1. list-files         {}
                      → { "files": [ ... ] }          // check for an existing file first

2. ai-design-screens  { "message": "Mobile sign-in screen for a developer tool.
                                    Email/password fields, Google SSO button, dark theme." }
                      → { "status": "generated", "fileId": "FILE_ID", "screenIds": ["SCREEN_ID"] }

3. get-screen-image   { "fileId": "FILE_ID", "screenId": "SCREEN_ID" }
                      → [inline PNG]
```

`fileId`를 생략하면 새 파일이 자동으로 만들어집니다. 기존 파일에 화면을 추가하려면 해당 `fileId`를 전달하세요.

**AI 어시스턴트에게 보내는 프롬프트:**

> Generate a Flowstep design: a mobile sign-in screen for a developer tool with email/password and a Google SSO button in dark theme, then show me the image.

***

## 2. React 컴포넌트 시각화하기

`.jsx` 또는 `.tsx` 파일을 첨부 파일로 업로드하고, 이에 맞는 디자인을 생성해 달라고 Flowstep에 요청하세요. Flowstep이 소스를 읽고 화면을 만들어 줍니다. 앱을 실행할 필요는 없습니다.

```
1. upload-attachment  { "text": "<UTF-8 contents of ApiKeys.tsx>",
                        "mimeType": "text/javascript" }
                      → { "id": "ATT_ID", "path": "...", "assetUrl": "...", "type": "document",
                          "mimeType": "text/javascript" }

2. ai-design-screens  { "message": "Generate a desktop screen that matches this React component.",
                        "attachments": [{ "id": "ATT_ID", "path": "...", "type": "document" }] }
                      → { "status": "generated", "fileId": "FILE_ID", "screenIds": ["SCREEN_ID"], ... }

3. get-screen-image   { "fileId": "FILE_ID", "screenId": "SCREEN_ID" }
                      → [inline PNG]
```

소스 파일이 64,000자보다 길다면 대신 `mimeType`과 `fileName`을 사용해 `upload-attachment`를 호출하고, 반환된 `uploadCommand`를 실행하세요. [`upload-attachment`](https://docs.flowstep.ai/ko/mcp/tools#upload-attachment)를 참조하세요.

**AI 어시스턴트에게 보내는 프롬프트:**

> Read `src/components/settings/ApiKeys.tsx`, upload it as an attachment, and generate a Flowstep screen that matches the component layout. Show me the rendered image.

***

## 3. 화면 반복 수정하기

자유 형식의 지시로 기존 화면을 제자리에서 변경하고, 같은 호출에서 그 화면과 어울리는 새 화면을 추가할 수도 있습니다.

```
1. list-screens       { "fileId": "FILE_ID" }
                      → { "screens": [{ "screenId": "SCREEN_ID", "name": "Sign-in", ... }] }

2. ai-design-screens  { "fileId": "FILE_ID",
                        "message": "Edit this sign-in screen: switch it to dark mode and add a
                                    'Remember me' checkbox below the password field. Then add a
                                    matching forgot-password screen.",
                        "elementIds": ["SCREEN_ID"] }
                      → { "status": "generated", "fileId": "FILE_ID",
                          "screenIds": ["SCREEN_ID", "NEW_SCREEN_ID"], ... }

3. get-screen-image   { "fileId": "FILE_ID", "screenId": "SCREEN_ID" }
                      → [inline PNG]
   get-screen-image   { "fileId": "FILE_ID", "screenId": "NEW_SCREEN_ID" }
                      → [inline PNG]
```

`screenIds`에는 호출로 만들거나 변경된 모든 화면이 나열되므로, 각 화면에 대해 `get-screen-image`를 한 번씩 호출하세요. 기존 화면만 편집하려면 메시지의 마지막 문장을 빼세요.

화면의 일부만 변경하려면 먼저 `"includeIds": true`로 `get-screen-jsx`를 호출한 다음, 변경할 요소의 `data-id`를 `elementIds`에 전달하세요.

화면 전체에 원클릭 프리셋을 적용하려면 대신 `ai-edit-screen-variant`를 호출하세요. 예를 들어 `"operationVariant": "light_theme"` 또는 `"different_layout"`을 사용합니다.

**AI 어시스턴트에게 보내는 프롬프트:**

> In my "Login flow" Flowstep file, switch the sign-in screen to dark mode, add a "Remember me" checkbox below the password field, and add a matching forgot-password screen. Show me the results.

***

## 4. 화면을 전체 흐름으로 확장하기

기존 디자인에 후속 화면을 추가합니다.

```
1. list-screens                { "fileId": "FILE_ID" }
                               → { "screens": [{ "screenId": "BASE_SCREEN_ID", "prompt": "Sign-in screen", ... }] }

2. ai-generate-screen-variant  { "fileId": "FILE_ID",
                                 "screenId": "BASE_SCREEN_ID",
                                 "operationVariant": "next_screen" }
                               → { "status": "generated", "fileId": "FILE_ID", "screenIds": ["NEXT_SCREEN_ID"], ... }

3. get-screen-image            { "fileId": "FILE_ID", "screenId": "NEXT_SCREEN_ID" }
                               → [inline PNG]
```

2단계를 `operationVariant: "error_state"` 또는 `"empty_state"`로 반복하면 예외 상황 화면을 추가할 수 있습니다. 다른 플랫폼용 화면은 `"web_version"` 또는 `"tablet_version"`을 사용하세요.

> [!NOTE]
>
> `ai-generate-screen-variant`에는 `operationVariant`가 필요하며, 이 도구는 `screenId`를 정확히 하나만 받습니다. 기존 화면의 변형이 아닌 화면을 추가하려면 `fileId`와 함께 `ai-design-screens`를 사용하세요.

***

## 5. 화면을 코드베이스로 가져오고, 변경 사항을 다시 기록하기

화면을 JSX로 읽고, 그 결과를 바탕으로 작업한 다음, 편집한 JSX를 캔버스에 다시 올립니다. 이 과정에서는 메시지를 사용하지 않습니다.

```
1. get-screen-jsx      { "fileId": "FILE_ID", "screenId": "SCREEN_ID" }
                       → { "name": "Settings", "fidelity": "ui", "screenType": "web",
                           "colorTheme": "default", "jsx": "<div ...>...</div>", "fragments": [] }

2. replace-screen-jsx  { "fileId": "FILE_ID", "screenId": "SCREEN_ID",
                         "jsx": "<div ...>...edited...</div>" }
                       → { "fileId": "FILE_ID", "screenId": "SCREEN_ID" }

3. get-screen-image    { "fileId": "FILE_ID", "screenId": "SCREEN_ID" }
                       → [inline PNG]
```

생략한 필드(`name`, `fidelity`, `screenType`, `colorTheme`, `fragments`)는 현재 값을 유지합니다. 원본을 남기고 수정본을 옆에 추가하려면 `replace-screen-jsx` 대신 `screenType`과 `jsx`를 넣어 `add-screen-jsx`를 호출하세요.

화면에 직접 만든 이미지를 표시하려면 `upload-attachment`로 이미지를 업로드하고, 반환된 `assetUrl`을 JSX의 `img src`에 넣으세요. [JSX의 이미지](https://docs.flowstep.ai/ko/mcp/tools.md#images-in-jsx)를 참조하세요.

***

## 6. 일괄 작업 전에 할당량 확인하기

여러 생성 작업을 시작하기 전에 남은 용량을 확인하세요. `get-plan-details` 호출은 무료입니다.

```
get-plan-details {}
→ { "plan": { ... }, "subscription": { ... }, "limits": { ... }, "usage": { ... },
    "remaining": { "messages": { "daily": ..., "monthly": ... } } }
```

`remaining.messages.daily` 값이 적다면, 한도가 초기화되는 00:00 UTC 이후로 일괄 작업을 예약하세요.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.