mcp-server-markview 1.2.6 → 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.
Binary file
package/index.js ADDED
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * index.js — Smithery capability scanning entry point.
4
+ *
5
+ * Two modes:
6
+ * 1. Imported by Smithery: exports createSandboxServer() — returns a mock MCP
7
+ * server with tool definitions. No binary spawned, works on any platform.
8
+ * 2. Run directly (main): proxies to the native MarkView MCP binary via stdio.
9
+ */
10
+ "use strict";
11
+
12
+ const { Server } = require("@modelcontextprotocol/sdk/server/index.js");
13
+ const {
14
+ ListToolsRequestSchema,
15
+ } = require("@modelcontextprotocol/sdk/types.js");
16
+
17
+ const VERSION = "1.2.7";
18
+
19
+ const TOOLS = [
20
+ {
21
+ name: "preview_markdown",
22
+ description:
23
+ "Render a markdown string in MarkView's native macOS preview window. " +
24
+ "Supports GFM, Mermaid diagrams, code syntax highlighting (Prism.js), " +
25
+ "tables, task lists, and all CommonMark extensions.",
26
+ inputSchema: {
27
+ type: "object",
28
+ properties: {
29
+ content: {
30
+ type: "string",
31
+ description: "Markdown source text to preview",
32
+ },
33
+ title: { type: "string", description: "Optional window title" },
34
+ },
35
+ required: ["content"],
36
+ },
37
+ },
38
+ {
39
+ name: "open_file",
40
+ description:
41
+ "Open an existing markdown file from disk in MarkView. " +
42
+ "The file must exist and have a markdown extension (.md, .markdown).",
43
+ inputSchema: {
44
+ type: "object",
45
+ properties: {
46
+ path: { type: "string", description: "Absolute path to the .md file" },
47
+ },
48
+ required: ["path"],
49
+ },
50
+ },
51
+ ];
52
+
53
+ /**
54
+ * Sandbox server for Smithery capability scanning.
55
+ * Returns a mock MCP server that responds to tools/list without spawning the Swift binary.
56
+ */
57
+ function createSandboxServer() {
58
+ const server = new Server(
59
+ { name: "markview", version: VERSION },
60
+ { capabilities: { tools: {} } },
61
+ );
62
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
63
+ tools: TOOLS,
64
+ }));
65
+ return server;
66
+ }
67
+
68
+ module.exports = { createSandboxServer };
69
+ module.exports.default = createSandboxServer;
70
+
71
+ // Stdio entrypoint — only spawns the native binary when run directly.
72
+ if (require.main === module) {
73
+ const { resolve } = require("path");
74
+ const fs = require("fs");
75
+ const binary = resolve(__dirname, "bin/mcp-server-markview");
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
+ }
105
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-server-markview",
3
- "version": "1.2.6",
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>",
@@ -13,6 +13,7 @@
13
13
  "bugs": {
14
14
  "url": "https://github.com/paulhkang94/markview/issues"
15
15
  },
16
+ "main": "index.js",
16
17
  "bin": {
17
18
  "mcp-server-markview": "bin/mcp-server-markview"
18
19
  },
@@ -21,6 +22,7 @@
21
22
  "postinstall": "node scripts/postinstall.js"
22
23
  },
23
24
  "files": [
25
+ "index.js",
24
26
  "bin/",
25
27
  "scripts/",
26
28
  "README.md"
@@ -38,11 +40,7 @@
38
40
  "engines": {
39
41
  "node": ">=18.0.0"
40
42
  },
41
- "os": [
42
- "darwin"
43
- ],
44
- "cpu": [
45
- "arm64",
46
- "x64"
47
- ]
43
+ "dependencies": {
44
+ "@modelcontextprotocol/sdk": "^1.27.1"
45
+ }
48
46
  }
@@ -22,9 +22,12 @@ const { execFileSync } = require("child_process");
22
22
 
23
23
  const GITHUB_OWNER = "paulhkang94";
24
24
  const GITHUB_REPO = "markview";
25
- const VERSION = "1.2.6";
26
- const ARCHIVE_NAME = `MarkView-${VERSION}.tar.gz`;
27
- const DOWNLOAD_URL = `https://github.com/${GITHUB_OWNER}/${GITHUB_REPO}/releases/download/v${VERSION}/${ARCHIVE_NAME}`;
25
+ // BINARY_VERSION pins the macOS app release to download.
26
+ // This is intentionally decoupled from the npm package version —
27
+ // npm patches (JS-only changes) don't require a new macOS binary release.
28
+ const BINARY_VERSION = "1.2.6";
29
+ const ARCHIVE_NAME = `MarkView-${BINARY_VERSION}.tar.gz`;
30
+ const DOWNLOAD_URL = `https://github.com/${GITHUB_OWNER}/${GITHUB_REPO}/releases/download/v${BINARY_VERSION}/${ARCHIVE_NAME}`;
28
31
 
29
32
  // Path inside the tar.gz where the MCP server binary lives
30
33
  const BINARY_IN_ARCHIVE = `MarkView.app/Contents/MacOS/markview-mcp-server`;
@@ -148,7 +151,9 @@ async function main() {
148
151
  const archivePath = path.join(tmpDir, ARCHIVE_NAME);
149
152
 
150
153
  try {
151
- console.log(`[mcp-server-markview] Downloading MarkView v${VERSION}...`);
154
+ console.log(
155
+ `[mcp-server-markview] Downloading MarkView v${BINARY_VERSION}...`,
156
+ );
152
157
  console.log(` ${DOWNLOAD_URL}`);
153
158
 
154
159
  await downloadFile(DOWNLOAD_URL, archivePath);