frameshot-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 kamegoro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,180 @@
1
+ # frameshot
2
+
3
+ > Instant cross-browser component preview for AI agents. One call, one screenshot — no dev server, no Storybook, no ceremony.
4
+
5
+ **Works with:** Claude Code · Cursor · Codex · Windsurf · any MCP-compatible tool
6
+
7
+ ## The Problem
8
+
9
+ You're building UI with an AI agent. The agent writes a component but can't see it. You have to:
10
+ 1. Start the dev server
11
+ 2. Log in
12
+ 3. Navigate to the right page
13
+ 4. Scroll to the component
14
+ 5. Tell the agent what's wrong
15
+
16
+ **frameshot** skips all of that. The agent renders the component itself, sees the result, and fixes it.
17
+
18
+ ## Quick Start
19
+
20
+ ### Claude Code
21
+
22
+ ```bash
23
+ claude mcp add frameshot -- npx frameshot-mcp@latest
24
+ ```
25
+
26
+ That's it. Now your AI agent can see UI.
27
+
28
+ ### Cursor (`.cursor/mcp.json`)
29
+
30
+ ```json
31
+ {
32
+ "mcpServers": {
33
+ "frameshot": {
34
+ "command": "npx",
35
+ "args": ["frameshot-mcp@latest"]
36
+ }
37
+ }
38
+ }
39
+ ```
40
+
41
+ ### VS Code Copilot (`.vscode/mcp.json`)
42
+
43
+ ```json
44
+ {
45
+ "servers": {
46
+ "frameshot": {
47
+ "command": "npx",
48
+ "args": ["frameshot-mcp@latest"]
49
+ }
50
+ }
51
+ }
52
+ ```
53
+
54
+ ### Manual setup
55
+
56
+ ```json
57
+ {
58
+ "mcpServers": {
59
+ "frameshot": {
60
+ "command": "npx",
61
+ "args": ["frameshot-mcp@latest"]
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ > **Note:** On first run, Playwright will download Chromium (~150MB). For additional engines: `npx playwright install firefox webkit`
68
+
69
+ ## Tools
70
+
71
+ ### `render_component`
72
+
73
+ Render isolated component code → get screenshot back instantly.
74
+
75
+ ```typescript
76
+ render_component({
77
+ code: `
78
+ function App() {
79
+ return (
80
+ <div className="p-8 bg-gradient-to-r from-blue-500 to-purple-600 rounded-xl">
81
+ <h1 className="text-4xl font-bold text-white">Hello World</h1>
82
+ </div>
83
+ )
84
+ }
85
+ `,
86
+ framework: "react",
87
+ engines: ["chromium", "firefox", "webkit"]
88
+ })
89
+ // Returns 3 screenshots — one per browser engine
90
+ ```
91
+
92
+ | Parameter | Default | Description |
93
+ |-----------|---------|-------------|
94
+ | `code` | required | Component source code |
95
+ | `framework` | `"react"` | `"react"` · `"vue"` · `"html"` |
96
+ | `engines` | `["chromium"]` | Browser engines to render in |
97
+ | `width` | `1280` | Viewport width |
98
+ | `height` | `800` | Viewport height |
99
+ | `fullPage` | `true` | Capture full scroll height |
100
+
101
+ ### `screenshot_url`
102
+
103
+ Screenshot a running app (e.g. localhost) across browsers.
104
+
105
+ ```typescript
106
+ screenshot_url({
107
+ url: "http://localhost:3000/components/button",
108
+ engines: ["chromium", "firefox", "webkit"]
109
+ })
110
+ ```
111
+
112
+ ## Why Not Storybook?
113
+
114
+ | | Storybook | frameshot |
115
+ |---|-----------|-----------|
116
+ | Setup | Write .stories.tsx, configure addons, run server | **Zero** — pass code, get image |
117
+ | Speed | Heavy dev server startup | **~800ms** warm render |
118
+ | Cross-browser | Chromatic ($149+/mo) | **Free** — Playwright built-in |
119
+ | AI-native | Requires pre-written stories | **Works with any code snippet** |
120
+ | Auth required? | Need full app context | **No** — isolated component render |
121
+
122
+ frameshot is not a Storybook replacement. Storybook is for documentation and design systems. frameshot is for **seeing what you just wrote, right now**.
123
+
124
+ ## Performance
125
+
126
+ | Scenario | Time |
127
+ |----------|------|
128
+ | Warm render (browser reused) | **~800ms** |
129
+ | Cold start (first render) | ~3-5s |
130
+ | Cross-browser (3 engines parallel) | ~1-2s warm |
131
+
132
+ The browser stays warm between calls. Second render onwards is sub-second.
133
+
134
+ ## Framework Support
135
+
136
+ ### React (JSX + Tailwind)
137
+ ```jsx
138
+ function App() {
139
+ const [count, setCount] = React.useState(0)
140
+ return <button onClick={() => setCount(c => c+1)} className="btn">{count}</button>
141
+ }
142
+ ```
143
+
144
+ ### Vue 3 (Composition API + Tailwind)
145
+ ```javascript
146
+ const App = {
147
+ setup() {
148
+ const count = ref(0)
149
+ return { count }
150
+ },
151
+ template: `<button @click="count++">{{ count }}</button>`
152
+ }
153
+ ```
154
+
155
+ ### HTML (+ Tailwind)
156
+ ```html
157
+ <div class="flex gap-4 p-8">
158
+ <button class="px-4 py-2 bg-blue-500 text-white rounded">Click me</button>
159
+ </div>
160
+ ```
161
+
162
+ ## Environment Variables
163
+
164
+ | Variable | Description |
165
+ |----------|-------------|
166
+ | `FRAMESHOT_BROWSER_PATH` | Custom Chromium executable path |
167
+
168
+ ## Development
169
+
170
+ ```bash
171
+ git clone https://github.com/kamegoro/frameshot.git
172
+ cd frameshot
173
+ npm install
174
+ npx playwright install chromium
175
+ npm run build
176
+ ```
177
+
178
+ ## License
179
+
180
+ MIT
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node