mcp-server-markview 1.2.7 → 1.2.9

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.
@@ -51,6 +51,14 @@ if [ -x "$USER_APP_BINARY" ]; then
51
51
  exec "$USER_APP_BINARY" "$@"
52
52
  fi
53
53
 
54
+ # --- Fallback: run capability-only sandbox server via Node.js ---
55
+ # Used by Smithery's Linux scanner and other non-macOS environments.
56
+ # index.js detects non-macOS and starts the sandbox MCP server over stdio.
57
+ INDEX_JS="$(dirname "$SCRIPT_DIR")/index.js"
58
+ if [ -f "$INDEX_JS" ] && command -v node >/dev/null 2>&1; then
59
+ exec node "$INDEX_JS" "$@"
60
+ fi
61
+
54
62
  # --- Not found ---
55
63
  cat >&2 <<'EOF'
56
64
  mcp-server-markview: could not find the MarkView MCP server binary.
package/index.js CHANGED
@@ -70,16 +70,36 @@ module.exports.default = createSandboxServer;
70
70
 
71
71
  // Stdio entrypoint — only spawns the native binary when run directly.
72
72
  if (require.main === module) {
73
- const { spawn } = require("child_process");
74
73
  const { resolve } = require("path");
74
+ const fs = require("fs");
75
75
  const binary = resolve(__dirname, "bin/mcp-server-markview");
76
- const child = spawn(binary, process.argv.slice(2), {
77
- stdio: "inherit",
78
- env: process.env,
79
- });
80
- child.on("exit", (code) => process.exit(code != null ? code : 0));
81
- child.on("error", (err) => {
82
- process.stderr.write("MarkView MCP server error: " + err.message + "\n");
83
- process.exit(1);
84
- });
76
+
77
+ if (process.platform === "darwin" && fs.existsSync(binary)) {
78
+ const { spawn } = require("child_process");
79
+ const child = spawn(binary, process.argv.slice(2), {
80
+ stdio: "inherit",
81
+ env: process.env,
82
+ });
83
+ child.on("exit", (code) => process.exit(code != null ? code : 0));
84
+ child.on("error", (err) => {
85
+ process.stderr.write("MarkView MCP server error: " + err.message + "\n");
86
+ process.exit(1);
87
+ });
88
+ } else {
89
+ // Non-macOS or binary unavailable: run capability-only sandbox server over stdio.
90
+ // Used by Smithery's scanner and other non-macOS environments.
91
+ const {
92
+ StdioServerTransport,
93
+ } = require("@modelcontextprotocol/sdk/server/stdio.js");
94
+ (async () => {
95
+ const server = createSandboxServer();
96
+ const transport = new StdioServerTransport();
97
+ await server.connect(transport);
98
+ })().catch((err) => {
99
+ process.stderr.write(
100
+ "MarkView sandbox server error: " + err.message + "\n",
101
+ );
102
+ process.exit(1);
103
+ });
104
+ }
85
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-server-markview",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "MCP server for MarkView — preview Markdown files in a native macOS viewer",
5
5
  "license": "MIT",
6
6
  "author": "Paul Kang <contact@paulkang.dev>",