qingflow-mcp 0.2.1 → 0.2.2

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 CHANGED
@@ -14,6 +14,10 @@ It intentionally excludes delete for now.
14
14
 
15
15
  ## Setup
16
16
 
17
+ Runtime requirement:
18
+
19
+ - Node.js `>=18`
20
+
17
21
  1. Install dependencies:
18
22
 
19
23
  ```bash
@@ -56,6 +60,12 @@ Global install from GitHub:
56
60
  npm i -g git+https://github.com/853046310/qingflow-mcp.git
57
61
  ```
58
62
 
63
+ Install latest from npm:
64
+
65
+ ```bash
66
+ npm i -g qingflow-mcp@latest
67
+ ```
68
+
59
69
  Or one-click installer:
60
70
 
61
71
  ```bash
@@ -107,6 +117,23 @@ export QINGFLOW_LIST_MAX_ITEMS_WITH_ANSWERS=5
107
117
  export QINGFLOW_LIST_MAX_ITEMS_BYTES=400000
108
118
  ```
109
119
 
120
+ ## Troubleshooting
121
+
122
+ If you see runtime errors around `Headers` or missing web APIs:
123
+
124
+ 1. Upgrade Node to `>=18`.
125
+ 2. Upgrade package to latest:
126
+
127
+ ```bash
128
+ npm i -g qingflow-mcp@latest
129
+ ```
130
+
131
+ 3. Verify runtime:
132
+
133
+ ```bash
134
+ node -e "console.log(process.version, typeof fetch, typeof Headers)"
135
+ ```
136
+
110
137
  ## Publish
111
138
 
112
139
  ```bash
@@ -88,24 +88,25 @@ export class QingflowClient {
88
88
  const options = params.options ?? {};
89
89
  const url = new URL(params.path, this.baseUrl);
90
90
  appendQuery(url, options.query);
91
- const headers = new Headers();
92
- headers.set("accessToken", this.accessToken);
91
+ const headers = {
92
+ accessToken: this.accessToken
93
+ };
93
94
  if (options.userId) {
94
- headers.set("userId", options.userId);
95
+ headers.userId = options.userId;
95
96
  }
96
97
  const init = {
97
98
  method: params.method,
98
99
  headers
99
100
  };
100
101
  if (options.body !== undefined) {
101
- headers.set("content-type", "application/json");
102
+ headers["content-type"] = "application/json";
102
103
  init.body = JSON.stringify(options.body);
103
104
  }
104
105
  const controller = new AbortController();
105
106
  const timer = setTimeout(() => controller.abort(), this.timeoutMs);
106
107
  init.signal = controller.signal;
107
108
  try {
108
- const response = await fetch(url, init);
109
+ const response = await getFetch()(url, init);
109
110
  const text = await response.text();
110
111
  const data = safeJsonParse(text);
111
112
  if (!response.ok) {
@@ -253,3 +254,12 @@ function toFiniteNumber(value) {
253
254
  }
254
255
  return null;
255
256
  }
257
+ function getFetch() {
258
+ const runtimeFetch = globalThis.fetch;
259
+ if (typeof runtimeFetch === "function") {
260
+ return runtimeFetch.bind(globalThis);
261
+ }
262
+ throw new QingflowApiError({
263
+ message: "Global fetch is not available. Use Node.js >= 18."
264
+ });
265
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qingflow-mcp",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,6 +35,9 @@
35
35
  "start": "node dist/server.js",
36
36
  "prepublishOnly": "npm run build"
37
37
  },
38
+ "engines": {
39
+ "node": ">=18"
40
+ },
38
41
  "dependencies": {
39
42
  "@modelcontextprotocol/sdk": "^1.17.4",
40
43
  "zod": "^3.25.76"