@datadive-tools/mcp 0.18.0 → 0.19.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/dist/index.js +12 -7
- package/dist/index.js.map +1 -1
- package/dist/lib.d.ts +7 -0
- package/dist/lib.js +12 -7
- package/dist/lib.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -144,7 +144,7 @@ function extractMessage(body) {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
// package.json
|
|
147
|
-
var version = "0.
|
|
147
|
+
var version = "0.19.0";
|
|
148
148
|
|
|
149
149
|
// src/http/client.ts
|
|
150
150
|
var PKG_VERSION = version;
|
|
@@ -184,7 +184,7 @@ async function httpGet(ctx, path, query) {
|
|
|
184
184
|
method: "GET",
|
|
185
185
|
headers: {
|
|
186
186
|
...authHeaders(ctx.config),
|
|
187
|
-
...
|
|
187
|
+
...hostHeaders(ctx.config),
|
|
188
188
|
accept: "application/json",
|
|
189
189
|
"user-agent": userAgent(ctx.toolName)
|
|
190
190
|
}
|
|
@@ -202,7 +202,7 @@ async function httpPost(ctx, path, body) {
|
|
|
202
202
|
method: "POST",
|
|
203
203
|
headers: {
|
|
204
204
|
...authHeaders(ctx.config),
|
|
205
|
-
...
|
|
205
|
+
...hostHeaders(ctx.config),
|
|
206
206
|
accept: "application/json",
|
|
207
207
|
"content-type": "application/json",
|
|
208
208
|
"user-agent": userAgent(ctx.toolName)
|
|
@@ -222,7 +222,7 @@ async function httpPatch(ctx, path, body) {
|
|
|
222
222
|
method: "PATCH",
|
|
223
223
|
headers: {
|
|
224
224
|
...authHeaders(ctx.config),
|
|
225
|
-
...
|
|
225
|
+
...hostHeaders(ctx.config),
|
|
226
226
|
accept: "application/json",
|
|
227
227
|
"content-type": "application/json",
|
|
228
228
|
"user-agent": userAgent(ctx.toolName)
|
|
@@ -242,7 +242,7 @@ async function httpDelete(ctx, path) {
|
|
|
242
242
|
method: "DELETE",
|
|
243
243
|
headers: {
|
|
244
244
|
...authHeaders(ctx.config),
|
|
245
|
-
...
|
|
245
|
+
...hostHeaders(ctx.config),
|
|
246
246
|
accept: "application/json",
|
|
247
247
|
"user-agent": userAgent(ctx.toolName)
|
|
248
248
|
}
|
|
@@ -288,8 +288,13 @@ function authHeaders(config) {
|
|
|
288
288
|
const c = config.credentials;
|
|
289
289
|
return c.kind === "bearer" ? { authorization: `Bearer ${c.token}` } : { "x-api-key": c.apiKey };
|
|
290
290
|
}
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
var RESERVED_HEADERS = /* @__PURE__ */ new Set(["authorization", "x-api-key", "accept", "content-type", "user-agent"]);
|
|
292
|
+
function hostHeaders(config) {
|
|
293
|
+
const extra = Object.entries(config.extraHeaders ?? {}).filter(([name]) => !RESERVED_HEADERS.has(name.toLowerCase()));
|
|
294
|
+
return {
|
|
295
|
+
...Object.fromEntries(extra),
|
|
296
|
+
...config.forwardedFor ? { "x-forwarded-for": config.forwardedFor } : {}
|
|
297
|
+
};
|
|
293
298
|
}
|
|
294
299
|
function unwrap(body) {
|
|
295
300
|
if (!isObject(body)) return body;
|