@shotfly/mcp 0.0.0-stage → 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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +76 -2
  3. package/dist/index.js +107 -0
  4. package/package.json +44 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nexora Data LLC
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 CHANGED
@@ -1,3 +1,77 @@
1
- # Temporary Holding Version
1
+ # Shotfly MCP server
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ MCP server for [Shotfly](https://shotfly.dev), the website screenshot API. It gives AI agents a `take_screenshot` tool that renders a page in a real browser and returns the image with the page's title, description and Open Graph image. Failed captures, bot-challenge pages and blank pages are never billed.
4
+
5
+ The server is a thin client of the public Shotfly API: requests are billed, cached and checked exactly like any other API call.
6
+
7
+ ## Requirements
8
+
9
+ - Node.js 22 or newer.
10
+ - A Shotfly secret key (`sk_…`). Create one in the [dashboard](https://shotfly.dev/dashboard/keys); the free plan includes 100 screenshots a month.
11
+
12
+ ## Setup
13
+
14
+ ### Claude Code
15
+
16
+ ```bash
17
+ claude mcp add shotfly --env SHOTFLY_API_KEY=sk_your_key -- npx -y @shotfly/mcp
18
+ ```
19
+
20
+ ### Claude Desktop, Cursor and other MCP clients
21
+
22
+ Add this to the client's MCP configuration (for Claude Desktop, `claude_desktop_config.json`; for Cursor, `.cursor/mcp.json`):
23
+
24
+ ```json
25
+ {
26
+ "mcpServers": {
27
+ "shotfly": {
28
+ "command": "npx",
29
+ "args": ["-y", "@shotfly/mcp"],
30
+ "env": { "SHOTFLY_API_KEY": "sk_your_key" }
31
+ }
32
+ }
33
+ }
34
+ ```
35
+
36
+ The key stays on your machine: the server runs locally and sends it only to the Shotfly API.
37
+
38
+ ## Tools
39
+
40
+ ### `take_screenshot`
41
+
42
+ | Argument | Type | Description |
43
+ | --- | --- | --- |
44
+ | `url` | string, required | Page to capture (http or https). |
45
+ | `full_page` | boolean | Capture the whole scrollable page. |
46
+ | `device` | `desktop`, `desktop_hd`, `iphone_15`, `pixel_8`, `ipad` | Viewport preset. |
47
+ | `format` | `png`, `jpeg`, `webp` | Image format. Default `webp`. |
48
+ | `dark_mode` | boolean | Render with `prefers-color-scheme: dark`. |
49
+ | `wait_for_selector` | string | Wait until this CSS selector is visible before capturing. |
50
+
51
+ Returns the screenshot as an image, plus JSON with a link to the file (valid for one hour), its dimensions, the credits charged and the page metadata. Images larger than 4 MB are returned as the link only, to keep the model's context small. Cookie banners are rejected and ads are blocked.
52
+
53
+ ### `get_usage`
54
+
55
+ Shows the current plan, billing period and credits used.
56
+
57
+ ## Configuration
58
+
59
+ | Variable | Required | Description |
60
+ | --- | --- | --- |
61
+ | `SHOTFLY_API_KEY` | yes | Secret key (`sk_…`) from the dashboard. |
62
+ | `SHOTFLY_API_URL` | no | API origin. Default `https://api.shotfly.dev`. |
63
+
64
+ ## Billing
65
+
66
+ Each successful screenshot costs credits, like any other API request; see [pricing](https://shotfly.dev/pricing). Failed renders, bot challenges, blank pages and cache hits cost nothing. Every result reports `credits_charged`.
67
+
68
+ ## Links
69
+
70
+ - [Documentation](https://shotfly.dev/docs)
71
+ - [Parameters](https://shotfly.dev/docs/parameters)
72
+ - [Pricing](https://shotfly.dev/pricing)
73
+ - Support: support@shotfly.dev
74
+
75
+ ## License
76
+
77
+ MIT
package/dist/index.js ADDED
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/index.ts
4
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
+
6
+ // src/config.ts
7
+ import { z } from "zod";
8
+ var schema = z.object({
9
+ SHOTFLY_API_KEY: z.string().startsWith("sk_", "SHOTFLY_API_KEY must be a secret key (sk_\u2026)"),
10
+ SHOTFLY_API_URL: z.string().url().default("https://api.shotfly.dev")
11
+ });
12
+ function loadConfig(env = process.env) {
13
+ const parsed = schema.safeParse(env);
14
+ if (!parsed.success)
15
+ throw new Error(parsed.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join("; "));
16
+ return parsed.data;
17
+ }
18
+
19
+ // src/server.ts
20
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
21
+ import { z as z2 } from "zod";
22
+ var SERVER_VERSION = "0.1.0";
23
+ var MAX_INLINE_BYTES = 4 * 1024 * 1024;
24
+ function createShotflyMcpServer(opts) {
25
+ const doFetch = opts.fetch ?? fetch;
26
+ const base = opts.apiUrl.replace(/\/$/, "");
27
+ const headers = { authorization: `Bearer ${opts.apiKey}`, "content-type": "application/json" };
28
+ const server2 = new McpServer({ name: "shotfly", version: SERVER_VERSION });
29
+ server2.registerTool(
30
+ "take_screenshot",
31
+ {
32
+ title: "Take a website screenshot",
33
+ description: "Render a web page in a real browser and return the screenshot plus page metadata (title, description, Open Graph image). Cookie banners and ads are removed. Failed renders are not charged.",
34
+ inputSchema: {
35
+ url: z2.string().describe("Page to capture (http or https)."),
36
+ full_page: z2.boolean().optional().describe("Capture the whole scrollable page."),
37
+ device: z2.enum(["desktop", "desktop_hd", "iphone_15", "pixel_8", "ipad"]).optional(),
38
+ format: z2.enum(["png", "jpeg", "webp"]).optional(),
39
+ dark_mode: z2.boolean().optional(),
40
+ wait_for_selector: z2.string().optional().describe("CSS selector to wait for.")
41
+ }
42
+ },
43
+ async (args) => {
44
+ const res = await doFetch(`${base}/v1/screenshot`, {
45
+ method: "POST",
46
+ headers,
47
+ body: JSON.stringify({ ...args, format: args.format ?? "webp", response_type: "json" })
48
+ });
49
+ const body = await res.json();
50
+ if (!res.ok || body.error) {
51
+ const e = body.error;
52
+ return {
53
+ isError: true,
54
+ content: [
55
+ {
56
+ type: "text",
57
+ text: `${e?.code ?? res.status}: ${e?.message ?? "request failed"}${e?.retry_hint ? ` (${e.retry_hint})` : ""}`
58
+ }
59
+ ]
60
+ };
61
+ }
62
+ const summary = {
63
+ url: body.url,
64
+ content_type: body.content_type,
65
+ width: body.width,
66
+ height: body.height,
67
+ credits_charged: body.credits_charged,
68
+ metadata: body.metadata
69
+ };
70
+ const content = [{ type: "text", text: JSON.stringify(summary, null, 2) }];
71
+ if (body.url && (body.bytes ?? 0) <= MAX_INLINE_BYTES) {
72
+ const file = await doFetch(body.url);
73
+ if (file.ok) {
74
+ content.unshift({
75
+ type: "image",
76
+ data: Buffer.from(await file.arrayBuffer()).toString("base64"),
77
+ mimeType: body.content_type ?? "image/webp"
78
+ });
79
+ }
80
+ }
81
+ return { content };
82
+ }
83
+ );
84
+ server2.registerTool(
85
+ "get_usage",
86
+ {
87
+ title: "Shotfly credit usage",
88
+ description: "Show the current plan, billing period and remaining credits.",
89
+ inputSchema: {}
90
+ },
91
+ async () => {
92
+ const res = await doFetch(`${base}/v1/usage`, { headers });
93
+ const text = await res.text();
94
+ return { isError: !res.ok, content: [{ type: "text", text }] };
95
+ }
96
+ );
97
+ return server2;
98
+ }
99
+
100
+ // src/index.ts
101
+ var config = loadConfig();
102
+ var server = createShotflyMcpServer({
103
+ apiUrl: config.SHOTFLY_API_URL,
104
+ apiKey: config.SHOTFLY_API_KEY
105
+ });
106
+ await server.connect(new StdioServerTransport());
107
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,46 @@
1
1
  {
2
2
  "name": "@shotfly/mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "MCP server for Shotfly, the website screenshot API: give AI agents a take_screenshot tool. Failed captures, bot-challenge pages and blank pages are never billed.",
5
+ "keywords": [
6
+ "mcp",
7
+ "model-context-protocol",
8
+ "mcp-server",
9
+ "screenshot",
10
+ "website-screenshot",
11
+ "screenshot-api",
12
+ "ai-agents",
13
+ "shotfly"
14
+ ],
15
+ "homepage": "https://shotfly.dev",
16
+ "bugs": {
17
+ "email": "support@shotfly.dev"
18
+ },
19
+ "license": "MIT",
20
+ "mcpName": "dev.shotfly/mcp",
21
+ "type": "module",
22
+ "bin": {
23
+ "shotfly-mcp": "dist/index.js"
24
+ },
25
+ "files": [
26
+ "dist/index.js",
27
+ "README.md",
28
+ "LICENSE"
29
+ ],
30
+ "engines": {
31
+ "node": ">=22"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "scripts": {
37
+ "dev": "tsx src/index.ts",
38
+ "build": "tsup && node ../../scripts/check-externals.mjs .",
39
+ "start": "node dist/index.js",
40
+ "prepublishOnly": "pnpm run build"
41
+ },
42
+ "dependencies": {
43
+ "@modelcontextprotocol/sdk": "^1.32.2",
44
+ "zod": "^4.6.7"
45
+ }
46
+ }