@postonus/cli 0.1.11 → 0.1.12
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 +22 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11983,7 +11983,7 @@ function formatTable(headers, rows) {
|
|
|
11983
11983
|
}
|
|
11984
11984
|
|
|
11985
11985
|
// src/version.ts
|
|
11986
|
-
var CLI_VERSION = "0.1.
|
|
11986
|
+
var CLI_VERSION = "0.1.12";
|
|
11987
11987
|
|
|
11988
11988
|
// src/client.ts
|
|
11989
11989
|
var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
@@ -12579,16 +12579,27 @@ async function mcpServe() {
|
|
|
12579
12579
|
const send = oauth ? createOAuthFetch(apiUrl, oauth, persistRefreshedTokens(apiUrl, oauth)) : (request, init) => fetch(request, init);
|
|
12580
12580
|
let protocolVersion;
|
|
12581
12581
|
let sessionId;
|
|
12582
|
-
const headersFor = (currentAuth) =>
|
|
12583
|
-
|
|
12584
|
-
|
|
12585
|
-
|
|
12586
|
-
|
|
12587
|
-
|
|
12588
|
-
|
|
12589
|
-
|
|
12590
|
-
|
|
12591
|
-
|
|
12582
|
+
const headersFor = (currentAuth) => {
|
|
12583
|
+
const headers = new Headers({
|
|
12584
|
+
"content-type": "application/json",
|
|
12585
|
+
// Both, because the endpoint may answer either way and refuses a request
|
|
12586
|
+
// that accepts only one.
|
|
12587
|
+
accept: "application/json, text/event-stream",
|
|
12588
|
+
[CLI_VERSION_HEADER]: CLI_VERSION
|
|
12589
|
+
});
|
|
12590
|
+
if (currentAuth.kind === "api-key") {
|
|
12591
|
+
headers.set("x-api-key", currentAuth.apiKey);
|
|
12592
|
+
} else if (oauth?.accessToken) {
|
|
12593
|
+
headers.set("authorization", `Bearer ${oauth.accessToken}`);
|
|
12594
|
+
}
|
|
12595
|
+
if (protocolVersion) {
|
|
12596
|
+
headers.set("mcp-protocol-version", protocolVersion);
|
|
12597
|
+
}
|
|
12598
|
+
if (sessionId) {
|
|
12599
|
+
headers.set("mcp-session-id", sessionId);
|
|
12600
|
+
}
|
|
12601
|
+
return headers;
|
|
12602
|
+
};
|
|
12592
12603
|
async function forward(message) {
|
|
12593
12604
|
const response = await send(new Request(endpoint, { method: "POST", headers: headersFor(auth), body: message }), {});
|
|
12594
12605
|
const returnedSession = response.headers.get("mcp-session-id");
|