universal-screenshot-mcp 1.3.0 → 1.4.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/build/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { serveStdio } from '@modelcontextprotocol/server/stdio';
|
|
3
3
|
import { createServer } from './server.js';
|
|
4
4
|
import { runDoctor, formatDoctorReport } from './utils/doctor.js';
|
|
5
5
|
import { commandExists } from './utils/screenshot-provider.js';
|
|
@@ -10,9 +10,13 @@ async function main() {
|
|
|
10
10
|
console.log(formatDoctorReport(report));
|
|
11
11
|
process.exit(report.hasFailures ? 1 : 0);
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
// serveStdio owns the protocol-era decision for the connection: the opening
|
|
14
|
+
// exchange selects the era and pins one instance from this factory for the
|
|
15
|
+
// connection's lifetime. `legacy` is left at its default 'serve' so clients
|
|
16
|
+
// still speaking the 2025-era `initialize` handshake keep working.
|
|
17
|
+
serveStdio(() => createServer(), {
|
|
18
|
+
onerror: (error) => console.error('Transport error:', error),
|
|
19
|
+
});
|
|
16
20
|
console.error('Screenshot MCP server running');
|
|
17
21
|
if (process.platform === 'linux') {
|
|
18
22
|
void warnIfMissingLinuxBackend();
|
package/build/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import { McpServer } from '@modelcontextprotocol/
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/server';
|
|
3
3
|
import { registerTakeScreenshot } from './tools/take-screenshot.js';
|
|
4
4
|
import { registerTakeSystemScreenshot } from './tools/take-system-screenshot.js';
|
|
5
5
|
const require = createRequire(import.meta.url);
|
|
@@ -9,7 +9,7 @@ import { ok, err, timestamp, ensureDir } from '../utils/helpers.js';
|
|
|
9
9
|
export function registerTakeScreenshot(server) {
|
|
10
10
|
server.registerTool('take_screenshot', {
|
|
11
11
|
description: 'Capture web page or element via headless browser. Saves to ~/Documents/screenshots by default (configurable via SCREENSHOT_OUTPUT_DIR env var).',
|
|
12
|
-
inputSchema: {
|
|
12
|
+
inputSchema: z.object({
|
|
13
13
|
url: z.string().describe('URL to capture'),
|
|
14
14
|
width: z.number().min(1).max(3840).optional().describe('Viewport width'),
|
|
15
15
|
height: z.number().min(1).max(2160).optional().describe('Viewport height'),
|
|
@@ -18,7 +18,7 @@ export function registerTakeScreenshot(server) {
|
|
|
18
18
|
waitForSelector: z.string().optional().describe('Wait for selector'),
|
|
19
19
|
waitForTimeout: z.number().min(0).max(30000).optional().describe('Delay in ms'),
|
|
20
20
|
outputPath: z.string().optional().describe('Absolute path, or relative to home dir'),
|
|
21
|
-
},
|
|
21
|
+
}),
|
|
22
22
|
}, async ({ url, width, height, fullPage, selector, waitForSelector, waitForTimeout, outputPath: custom }) => {
|
|
23
23
|
ensureDefaultDirectory(); // Ensure the default directory exists
|
|
24
24
|
// Security: Validate URL before making request (SSRF prevention)
|
|
@@ -9,7 +9,7 @@ import { getScreenshotProvider } from '../utils/screenshot-provider.js';
|
|
|
9
9
|
export function registerTakeSystemScreenshot(server) {
|
|
10
10
|
server.registerTool('take_system_screenshot', {
|
|
11
11
|
description: 'Capture desktop, window, or region screenshot. Cross-platform: macOS (screencapture), Linux (maim/scrot/gnome-screenshot/etc.), Windows (PowerShell+.NET). Saves to ~/Documents/screenshots by default (configurable via SCREENSHOT_OUTPUT_DIR env var). For window mode, provide windowName (app name like "Safari") or windowId.',
|
|
12
|
-
inputSchema: {
|
|
12
|
+
inputSchema: z.object({
|
|
13
13
|
mode: z
|
|
14
14
|
.enum(['fullscreen', 'window', 'region'])
|
|
15
15
|
.describe('fullscreen=entire screen, window=specific app (requires windowName or windowId), region=coordinates'),
|
|
@@ -35,7 +35,7 @@ export function registerTakeSystemScreenshot(server) {
|
|
|
35
35
|
.string()
|
|
36
36
|
.optional()
|
|
37
37
|
.describe('Absolute path, or relative to home dir'),
|
|
38
|
-
},
|
|
38
|
+
}),
|
|
39
39
|
}, async ({ mode, windowId, windowName, region, display, includeCursor, format, delay, outputPath: custom, }) => {
|
|
40
40
|
ensureDefaultDirectory();
|
|
41
41
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "universal-screenshot-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "An MCP server for capturing web page screenshots via Puppeteer and cross-platform system screenshots via native OS tools",
|
|
5
5
|
"author": "Seth Bang",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -52,11 +52,12 @@
|
|
|
52
52
|
"lint": "eslint src/"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@modelcontextprotocol/
|
|
55
|
+
"@modelcontextprotocol/server": "^2.0.0",
|
|
56
56
|
"puppeteer": "^25.0.4",
|
|
57
|
-
"zod": "^
|
|
57
|
+
"zod": "^4.2.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
+
"@modelcontextprotocol/client": "^2.0.0",
|
|
60
61
|
"@types/node": "^22.0.0",
|
|
61
62
|
"@typescript-eslint/eslint-plugin": "^8.59.0",
|
|
62
63
|
"@typescript-eslint/parser": "^8.59.0",
|