@mongodb-js/mcp-fetch 3.0.0-prerelease.1
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.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/proxyFetch.d.ts +14 -0
- package/dist/proxyFetch.d.ts.map +1 -0
- package/dist/proxyFetch.js +32 -0
- package/dist/proxyFetch.js.map +1 -0
- package/package.json +39 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAmB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process-wide memoized `fetch`: `createFetch` (proxy + system CA) in Node,
|
|
3
|
+
* platform `fetch` elsewhere. Memoized because `createFetch` builds a fresh
|
|
4
|
+
* system-CA bundle and proxy Agent per call, which accumulates until OOM.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getSharedProxyFetch(): typeof fetch;
|
|
7
|
+
/** A matched `fetch`/`Request` pair (must come from the same implementation). */
|
|
8
|
+
export type HttpClient = {
|
|
9
|
+
fetch: typeof fetch;
|
|
10
|
+
Request: typeof globalThis.Request;
|
|
11
|
+
};
|
|
12
|
+
/** Default `httpClient`: the shared proxy-aware `fetch` + platform `Request`. */
|
|
13
|
+
export declare function getDefaultHttpClient(): HttpClient;
|
|
14
|
+
//# sourceMappingURL=proxyFetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxyFetch.d.ts","sourceRoot":"","sources":["../src/proxyFetch.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,KAAK,CASlD;AAED,iFAAiF;AACjF,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,OAAO,EAAE,OAAO,UAAU,CAAC,OAAO,CAAC;CACtC,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,oBAAoB,IAAI,UAAU,CAKjD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createFetch } from "@mongodb-js/devtools-proxy-support";
|
|
2
|
+
let sharedProxyFetch;
|
|
3
|
+
/**
|
|
4
|
+
* Node detection via `process.versions.node` (bundlers may shim `process`
|
|
5
|
+
* to a plain object, so `typeof process` alone is not reliable).
|
|
6
|
+
*/
|
|
7
|
+
function isNodeRuntime() {
|
|
8
|
+
return typeof process !== "undefined" && process.versions !== undefined && process.versions.node !== undefined;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Process-wide memoized `fetch`: `createFetch` (proxy + system CA) in Node,
|
|
12
|
+
* platform `fetch` elsewhere. Memoized because `createFetch` builds a fresh
|
|
13
|
+
* system-CA bundle and proxy Agent per call, which accumulates until OOM.
|
|
14
|
+
*/
|
|
15
|
+
export function getSharedProxyFetch() {
|
|
16
|
+
if (sharedProxyFetch === undefined) {
|
|
17
|
+
sharedProxyFetch = isNodeRuntime()
|
|
18
|
+
? createFetch({
|
|
19
|
+
useEnvironmentVariableProxies: true,
|
|
20
|
+
})
|
|
21
|
+
: globalThis.fetch.bind(globalThis);
|
|
22
|
+
}
|
|
23
|
+
return sharedProxyFetch;
|
|
24
|
+
}
|
|
25
|
+
/** Default `httpClient`: the shared proxy-aware `fetch` + platform `Request`. */
|
|
26
|
+
export function getDefaultHttpClient() {
|
|
27
|
+
return {
|
|
28
|
+
fetch: getSharedProxyFetch(),
|
|
29
|
+
Request: globalThis.Request,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=proxyFetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxyFetch.js","sourceRoot":"","sources":["../src/proxyFetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEjE,IAAI,gBAA0C,CAAC;AAE/C;;;GAGG;AACH,SAAS,aAAa;IAClB,OAAO,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC;AACnH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB;IAC/B,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACjC,gBAAgB,GAAG,aAAa,EAAE;YAC9B,CAAC,CAAE,WAAW,CAAC;gBACT,6BAA6B,EAAE,IAAI;aACtC,CAA6B;YAChC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,gBAAgB,CAAC;AAC5B,CAAC;AAQD,iFAAiF;AACjF,MAAM,UAAU,oBAAoB;IAChC,OAAO;QACH,KAAK,EAAE,mBAAmB,EAAE;QAC5B,OAAO,EAAE,UAAU,CAAC,OAAO;KAC9B,CAAC;AACN,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mongodb-js/mcp-fetch",
|
|
3
|
+
"description": "Shared proxy-aware fetch and httpClient factory for the MongoDB MCP server",
|
|
4
|
+
"version": "3.0.0-prerelease.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"author": "MongoDB <info@mongodb.com>",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/mongodb-js/mongodb-mcp-server.git",
|
|
10
|
+
"directory": "packages/fetch"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc --build tsconfig.build.json",
|
|
25
|
+
"test": "vitest --run",
|
|
26
|
+
"check": "tsc --build tsconfig.build.json --noEmit"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@mongodb-js/devtools-proxy-support": "^0.7.8"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^25.6.0",
|
|
33
|
+
"typescript": "^5.9.2",
|
|
34
|
+
"vitest": "^4.1.4"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
}
|
|
39
|
+
}
|