mcp-server-markview 1.2.7 → 1.2.8

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 (2) hide show
  1. package/index.js +30 -10
  2. package/package.json +1 -1
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.8",
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>",