go-mdurl-mcp-server 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/README.md ADDED
@@ -0,0 +1,144 @@
1
+ # go_mcp_server_mdurl
2
+
3
+ A Go MCP (Model Context Protocol) server that converts URL content to Markdown.
4
+
5
+ Server URL: `http://localhost:8890/sse`
6
+
7
+ ## Requirements
8
+
9
+ - Go 1.23+
10
+
11
+ ## Tools
12
+
13
+ 1. `markdown_content_of_url` - Extracts the main article content from a URL and converts it to Markdown
14
+ 2. `markdown_all_html_of_url` - Converts the entire HTML content from a URL to Markdown
15
+
16
+ ## Running
17
+
18
+ The server can operate in two modes: stdio and sse (Server-Sent Events). By default, it uses sse.
19
+
20
+ ### Stdio
21
+
22
+ ```bash
23
+ go_mcp_server_mdurl -t stdio
24
+ ```
25
+
26
+ ### SSE
27
+
28
+ ```bash
29
+ go_mcp_server_mdurl -t sse -h 0.0.0.0 -p 8890
30
+ ```
31
+
32
+ SSE endpoint:
33
+
34
+ ```
35
+ http://localhost:8890/sse
36
+ ```
37
+
38
+ ## Build
39
+
40
+ ```bash
41
+ make build
42
+ ```
43
+
44
+ Binary output: `./go_mcp_server_mdurl`
45
+
46
+ ## npm / npx
47
+
48
+ This repo includes an npm wrapper so the server can be installed and run via `npx`.
49
+
50
+ ### Build npm package (multi-platform binaries)
51
+
52
+ ```bash
53
+ npm run build:npm
54
+ ```
55
+
56
+ This creates platform binaries under `native/` and prepares the package for `npm pack`/publish.
57
+
58
+ ### Run with npx
59
+
60
+ After publishing the package (or using a local tarball), you can run:
61
+
62
+ ```bash
63
+ npx go-mdurl-mcp-server -t stdio
64
+ ```
65
+
66
+ To run a specific version:
67
+
68
+ ```bash
69
+ npx go-mdurl-mcp-server@1.0.0 -t stdio
70
+ ```
71
+
72
+ For a local tarball:
73
+
74
+ ```bash
75
+ npm pack
76
+ npx ./go-mdurl-mcp-server-*.tgz -t stdio
77
+ ```
78
+
79
+ ## Claude Code
80
+
81
+ ```bash
82
+ claude mcp add --transport stdio mdurl -- npx -y go-mdurl-mcp-server -t stdio
83
+ ```
84
+
85
+ In project `.mcp.json` or global `~/.claude.json`:
86
+
87
+ ```json
88
+ {
89
+ "mcpServers": {
90
+ "mdurl": {
91
+ "type": "stdio",
92
+ "command": "npx",
93
+ "args": ["-y", "go-mdurl-mcp-server", "-t", "stdio"]
94
+ }
95
+ }
96
+ }
97
+ ```
98
+
99
+ ## Codex CLI
100
+
101
+ Codex supports MCP servers in `~/.codex/config.toml` or via the `codex mcp add` command.
102
+
103
+ Add via CLI:
104
+
105
+ ```bash
106
+ codex mcp add mdurl -- npx -y go-mdurl-mcp-server -t stdio
107
+ ```
108
+
109
+ Or configure in `~/.codex/config.toml`:
110
+
111
+ ```toml
112
+ [mcp_servers.mdurl]
113
+ command = "npx"
114
+ args = ["-y", "go-mdurl-mcp-server", "-t", "stdio"]
115
+ ```
116
+
117
+ ## Cursor
118
+
119
+ - macOS/Linux: `~/.cursor/mcp.json`
120
+ - Windows: `%USERPROFILE%\\.cursor\\mcp.json`
121
+
122
+ ```json
123
+ {
124
+ "mcpServers": {
125
+ "mdurl": {
126
+ "command": "npx",
127
+ "args": ["-y", "go-mdurl-mcp-server", "-t", "stdio"]
128
+ }
129
+ }
130
+ }
131
+ ```
132
+
133
+ ## MCP Client Config Example
134
+
135
+ ```json
136
+ {
137
+ "mcpServers": {
138
+ "mdurl": {
139
+ "command": "/path/to/go_mcp_server_mdurl",
140
+ "args": ["-t", "stdio"]
141
+ }
142
+ }
143
+ }
144
+ ```
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require("node:child_process");
4
+ const { existsSync } = require("node:fs");
5
+ const { join } = require("node:path");
6
+
7
+ function resolveBinaryPath() {
8
+ const platform = process.platform;
9
+ const arch = process.arch;
10
+
11
+ let platformKey = "";
12
+ if (platform === "linux") {
13
+ platformKey = "linux";
14
+ } else if (platform === "darwin") {
15
+ platformKey = "darwin";
16
+ } else if (platform === "win32") {
17
+ platformKey = "windows";
18
+ }
19
+
20
+ let archKey = "";
21
+ if (arch === "x64") {
22
+ archKey = "amd64";
23
+ } else if (arch === "arm64") {
24
+ archKey = "arm64";
25
+ }
26
+
27
+ if (!platformKey || !archKey) {
28
+ throw new Error(`Unsupported platform/arch: ${platform}/${arch}`);
29
+ }
30
+
31
+ const binaryName = platformKey === "windows"
32
+ ? `go_mcp_server_mdurl-${platformKey}-${archKey}.exe`
33
+ : `go_mcp_server_mdurl-${platformKey}-${archKey}`;
34
+
35
+ return join(__dirname, "..", "native", `${platformKey}-${archKey}`, binaryName);
36
+ }
37
+
38
+ function main() {
39
+ let binaryPath;
40
+ try {
41
+ binaryPath = resolveBinaryPath();
42
+ } catch (error) {
43
+ console.error(error.message);
44
+ process.exit(1);
45
+ }
46
+
47
+ if (!existsSync(binaryPath)) {
48
+ console.error(`Binary not found: ${binaryPath}`);
49
+ console.error("Run 'npm run build:npm' to generate platform binaries.");
50
+ process.exit(1);
51
+ }
52
+
53
+ const child = spawn(binaryPath, process.argv.slice(2), {
54
+ stdio: "inherit",
55
+ });
56
+
57
+ child.on("exit", (code, signal) => {
58
+ if (signal) {
59
+ process.kill(process.pid, signal);
60
+ return;
61
+ }
62
+ process.exit(code ?? 0);
63
+ });
64
+ }
65
+
66
+ main();
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "go-mdurl-mcp-server",
3
+ "version": "1.0.0",
4
+ "description": "Go MCP server for converting URLs to Markdown",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "go-mdurl-mcp-server": "bin/mdurl-mcp.js"
8
+ },
9
+ "files": [
10
+ "bin/mdurl-mcp.js",
11
+ "native/",
12
+ "README.md"
13
+ ],
14
+ "scripts": {
15
+ "build:npm": "./scripts/build-npm.sh",
16
+ "prepack": "./scripts/build-npm.sh"
17
+ }
18
+ }