@fruitbars/xfyun-ai-mcp 0.3.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,13 @@
1
+ # @fruitbars/xfyun-ai-mcp
2
+
3
+ Cross-platform `npx` launcher for the `xfyun-ai-mcp` stdio MCP server.
4
+
5
+ ```bash
6
+ npx -y @fruitbars/xfyun-ai-mcp@0.3.0
7
+ ```
8
+
9
+ The launcher selects an npm optional dependency for Windows, macOS, or Linux on x64/arm64 and starts the native Go server with inherited stdio and environment variables. Configure `XFYUN_APP_ID`, `XFYUN_API_KEY`, and `XFYUN_API_SECRET` in the MCP host.
10
+
11
+ PDF OCR uses embedded PDFium WebAssembly: no CGO, Poppler, or other system renderer is required. Text, vector, and scanned PDFs render at 150 DPI by default. Rendering, compression, OCR, NDJSON result writing, and cleanup happen one page at a time, so memory use does not grow with the full document. The PDFium runtime has a 512 MiB hard limit and concurrent PDFs are serialized within one server process. Multi-page MCP calls return an `output_path` instead of accumulating every page in one response.
12
+
13
+ For local launcher development, `XFYUN_AI_MCP_BINARY` can point to a locally built `xfyun-ai-mcp` executable.
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const path = require("node:path");
5
+ const { spawn } = require("node:child_process");
6
+
7
+ const TARGETS = Object.freeze({
8
+ "darwin-arm64": ["@fruitbars/xfyun-ai-mcp-darwin-arm64", "xfyun-ai-mcp"],
9
+ "darwin-x64": ["@fruitbars/xfyun-ai-mcp-darwin-x64", "xfyun-ai-mcp"],
10
+ "linux-arm64": ["@fruitbars/xfyun-ai-mcp-linux-arm64", "xfyun-ai-mcp"],
11
+ "linux-x64": ["@fruitbars/xfyun-ai-mcp-linux-x64", "xfyun-ai-mcp"],
12
+ "win32-arm64": ["@fruitbars/xfyun-ai-mcp-win32-arm64", "xfyun-ai-mcp.exe"],
13
+ "win32-x64": ["@fruitbars/xfyun-ai-mcp-win32-x64", "xfyun-ai-mcp.exe"]
14
+ });
15
+
16
+ function targetFor(platform = process.platform, arch = process.arch) {
17
+ const target = TARGETS[`${platform}-${arch}`];
18
+ if (!target) {
19
+ throw new Error(`unsupported platform: ${platform}/${arch}; supported: Windows, macOS, and Linux on x64 or arm64`);
20
+ }
21
+ return { packageName: target[0], binaryName: target[1] };
22
+ }
23
+
24
+ function resolveBinary(options = {}) {
25
+ const override = options.override || process.env.XFYUN_AI_MCP_BINARY;
26
+ if (override) {
27
+ return path.resolve(override);
28
+ }
29
+ const target = targetFor(options.platform, options.arch);
30
+ let manifest;
31
+ try {
32
+ manifest = require.resolve(`${target.packageName}/package.json`);
33
+ } catch (error) {
34
+ throw new Error(
35
+ `native package ${target.packageName} is not installed; reinstall @fruitbars/xfyun-ai-mcp with optional dependencies enabled`,
36
+ { cause: error }
37
+ );
38
+ }
39
+ return path.join(path.dirname(manifest), "bin", target.binaryName);
40
+ }
41
+
42
+ function run() {
43
+ let binary;
44
+ try {
45
+ binary = resolveBinary();
46
+ } catch (error) {
47
+ process.stderr.write(`xfyun-ai launcher: ${error.message}\n`);
48
+ process.exitCode = 1;
49
+ return;
50
+ }
51
+ const child = spawn(binary, process.argv.slice(2), {
52
+ env: process.env,
53
+ stdio: "inherit",
54
+ windowsHide: true
55
+ });
56
+ child.on("error", (error) => {
57
+ process.stderr.write(`xfyun-ai launcher: unable to start ${binary}: ${error.message}\n`);
58
+ process.exitCode = 1;
59
+ });
60
+ child.on("exit", (code, signal) => {
61
+ if (signal) {
62
+ process.kill(process.pid, signal);
63
+ return;
64
+ }
65
+ process.exitCode = code == null ? 1 : code;
66
+ });
67
+ }
68
+
69
+ if (require.main === module) {
70
+ run();
71
+ }
72
+
73
+ module.exports = { TARGETS, targetFor, resolveBinary };
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@fruitbars/xfyun-ai-mcp",
3
+ "version": "0.3.0",
4
+ "description": "Cross-platform stdio MCP launcher for XFYun AI capabilities",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/fruitbars/go-xfyun-cli.git"
8
+ },
9
+ "bin": {
10
+ "xfyun-ai-mcp": "bin/xfyun-ai-mcp.js"
11
+ },
12
+ "files": [
13
+ "bin",
14
+ "README.md"
15
+ ],
16
+ "engines": {
17
+ "node": ">=18"
18
+ },
19
+ "scripts": {
20
+ "test": "node --test"
21
+ },
22
+ "optionalDependencies": {
23
+ "@fruitbars/xfyun-ai-mcp-darwin-arm64": "0.3.0",
24
+ "@fruitbars/xfyun-ai-mcp-darwin-x64": "0.3.0",
25
+ "@fruitbars/xfyun-ai-mcp-linux-arm64": "0.3.0",
26
+ "@fruitbars/xfyun-ai-mcp-linux-x64": "0.3.0",
27
+ "@fruitbars/xfyun-ai-mcp-win32-arm64": "0.3.0",
28
+ "@fruitbars/xfyun-ai-mcp-win32-x64": "0.3.0"
29
+ }
30
+ }