screen-context-mcp 1.0.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/bin/screen-context-mcp.js +85 -0
- package/package.json +26 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// screen-context-mcp npm wrapper
|
|
4
|
+
// Ensures the MSIX-packaged .NET MCP server is installed, then proxies stdio to it.
|
|
5
|
+
|
|
6
|
+
const { execFileSync, spawn } = require("child_process");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
|
|
9
|
+
const EXE_NAME = "screen-context-mcp.exe";
|
|
10
|
+
const WINGET_PACKAGE_ID = "ScreenContextMcp.ScreenContextMcp";
|
|
11
|
+
|
|
12
|
+
function isInstalled() {
|
|
13
|
+
try {
|
|
14
|
+
// The MSIX execution alias lives in WindowsApps — check if it resolves
|
|
15
|
+
execFileSync("where.exe", [EXE_NAME], { stdio: "pipe" });
|
|
16
|
+
return true;
|
|
17
|
+
} catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function installViaMsix() {
|
|
23
|
+
process.stderr.write(
|
|
24
|
+
`[screen-context-mcp] Server not found. Installing via winget...\n`
|
|
25
|
+
);
|
|
26
|
+
try {
|
|
27
|
+
execFileSync(
|
|
28
|
+
"winget",
|
|
29
|
+
[
|
|
30
|
+
"install",
|
|
31
|
+
WINGET_PACKAGE_ID,
|
|
32
|
+
"--accept-source-agreements",
|
|
33
|
+
"--accept-package-agreements",
|
|
34
|
+
"--silent",
|
|
35
|
+
],
|
|
36
|
+
{ stdio: ["pipe", "pipe", "inherit"] }
|
|
37
|
+
);
|
|
38
|
+
process.stderr.write(`[screen-context-mcp] Installation complete.\n`);
|
|
39
|
+
} catch (err) {
|
|
40
|
+
process.stderr.write(
|
|
41
|
+
`[screen-context-mcp] winget install failed. Please install manually:\n` +
|
|
42
|
+
` winget install ${WINGET_PACKAGE_ID}\n` +
|
|
43
|
+
` -- or download from: https://github.com/shayben/ScreenContextMcp/releases\n`
|
|
44
|
+
);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!isInstalled()) {
|
|
49
|
+
process.stderr.write(
|
|
50
|
+
`[screen-context-mcp] Installation succeeded but exe not found in PATH.\n` +
|
|
51
|
+
`You may need to restart your terminal.\n`
|
|
52
|
+
);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Ensure the server is installed
|
|
58
|
+
if (!isInstalled()) {
|
|
59
|
+
installViaMsix();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Forward all args (skip node and script path) to the .NET exe
|
|
63
|
+
const userArgs = process.argv.slice(2);
|
|
64
|
+
const child = spawn(EXE_NAME, userArgs, {
|
|
65
|
+
stdio: ["pipe", "pipe", "inherit"], // stdin/stdout piped for MCP, stderr to parent
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Proxy stdin → child
|
|
69
|
+
process.stdin.pipe(child.stdin);
|
|
70
|
+
|
|
71
|
+
// Proxy child stdout → stdout
|
|
72
|
+
child.stdout.pipe(process.stdout);
|
|
73
|
+
|
|
74
|
+
child.on("exit", (code) => {
|
|
75
|
+
process.exit(code ?? 0);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
child.on("error", (err) => {
|
|
79
|
+
process.stderr.write(`[screen-context-mcp] Failed to start server: ${err.message}\n`);
|
|
80
|
+
process.exit(1);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// Forward signals
|
|
84
|
+
process.on("SIGINT", () => child.kill("SIGINT"));
|
|
85
|
+
process.on("SIGTERM", () => child.kill("SIGTERM"));
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "screen-context-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP server that captures screen context via Windows AI OCR. Provides tools for agentic workflows to understand what the user is looking at.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": { "type": "git", "url": "https://github.com/shayben/ScreenContextMcp.git" },
|
|
7
|
+
"homepage": "https://github.com/shayben/ScreenContextMcp#readme",
|
|
8
|
+
"bugs": { "url": "https://github.com/shayben/ScreenContextMcp/issues" },
|
|
9
|
+
"bin": {
|
|
10
|
+
"screen-context-mcp": "bin/screen-context-mcp.js"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"mcp",
|
|
14
|
+
"model-context-protocol",
|
|
15
|
+
"ocr",
|
|
16
|
+
"screen-capture",
|
|
17
|
+
"windows-ai",
|
|
18
|
+
"copilot"
|
|
19
|
+
],
|
|
20
|
+
"os": [
|
|
21
|
+
"win32"
|
|
22
|
+
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18"
|
|
25
|
+
}
|
|
26
|
+
}
|