@talonic/mcp 0.1.79 → 0.1.80
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/CHANGELOG.md +6 -0
- package/dist/content.js +1 -1
- package/dist/content.js.map +1 -1
- package/dist/http-server.js +19 -5
- package/dist/http-server.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/http-server.js
CHANGED
|
@@ -4507,7 +4507,7 @@ function registerAskTools(server, getToken, baseUrl) {
|
|
|
4507
4507
|
|
|
4508
4508
|
// package.json
|
|
4509
4509
|
var package_default = {
|
|
4510
|
-
version: "0.1.
|
|
4510
|
+
version: "0.1.80"};
|
|
4511
4511
|
|
|
4512
4512
|
// src/version.ts
|
|
4513
4513
|
var VERSION = package_default.version;
|
|
@@ -4719,9 +4719,9 @@ async function adminAgentTaskAccessCached(token, probe = probeAgentTaskAdminAcce
|
|
|
4719
4719
|
var RESOURCE_URL = process.env["MCP_RESOURCE_URL"] ?? "https://mcp.talonic.com";
|
|
4720
4720
|
var AUTHORIZATION_SERVER = process.env["OAUTH_AUTHORIZATION_SERVER"] ?? "https://api.talonic.com";
|
|
4721
4721
|
var APPS_CHALLENGE_TOKEN = process.env["OPENAI_APPS_CHALLENGE_TOKEN"] ?? "gnHvfQsKH6NVBNIeOWVK1vSt5QR2gsgBAIcXdSlpR_U";
|
|
4722
|
-
function renderProtectedResourceMetadata() {
|
|
4722
|
+
function renderProtectedResourceMetadata(resourcePath = "") {
|
|
4723
4723
|
return {
|
|
4724
|
-
resource: RESOURCE_URL
|
|
4724
|
+
resource: `${RESOURCE_URL}${resourcePath}`,
|
|
4725
4725
|
authorization_servers: [AUTHORIZATION_SERVER],
|
|
4726
4726
|
scopes_supported: ["extract:write", "documents:read", "schemas:read", DECIDE_SCOPE],
|
|
4727
4727
|
bearer_methods_supported: ["header"]
|
|
@@ -4739,7 +4739,13 @@ function extractBearerToken(req) {
|
|
|
4739
4739
|
}
|
|
4740
4740
|
return void 0;
|
|
4741
4741
|
}
|
|
4742
|
-
|
|
4742
|
+
function wwwAuthenticate(path) {
|
|
4743
|
+
const suffix = isMcpPath(path) ? "/mcp" : "";
|
|
4744
|
+
return `Bearer error="invalid_token", resource_metadata="${RESOURCE_URL}/.well-known/oauth-protected-resource${suffix}"`;
|
|
4745
|
+
}
|
|
4746
|
+
function isMcpPath(path) {
|
|
4747
|
+
return path === "/mcp" || path === "/mcp/";
|
|
4748
|
+
}
|
|
4743
4749
|
function asWidgetTemplateRead(parsed) {
|
|
4744
4750
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
4745
4751
|
const msg = parsed;
|
|
@@ -4796,6 +4802,14 @@ function createRequestHandler(options = {}) {
|
|
|
4796
4802
|
res.end(JSON.stringify(renderProtectedResourceMetadata()));
|
|
4797
4803
|
return;
|
|
4798
4804
|
}
|
|
4805
|
+
if (path === "/.well-known/oauth-protected-resource/mcp") {
|
|
4806
|
+
res.writeHead(200, {
|
|
4807
|
+
"Content-Type": "application/json",
|
|
4808
|
+
"Cache-Control": "public, max-age=3600"
|
|
4809
|
+
});
|
|
4810
|
+
res.end(JSON.stringify(renderProtectedResourceMetadata("/mcp")));
|
|
4811
|
+
return;
|
|
4812
|
+
}
|
|
4799
4813
|
if (path === "/.well-known/openai-apps-challenge") {
|
|
4800
4814
|
res.writeHead(200, {
|
|
4801
4815
|
"Content-Type": "text/plain; charset=utf-8",
|
|
@@ -4911,7 +4925,7 @@ function createRequestHandler(options = {}) {
|
|
|
4911
4925
|
if (!token) {
|
|
4912
4926
|
res.writeHead(401, {
|
|
4913
4927
|
"Content-Type": "application/json",
|
|
4914
|
-
"WWW-Authenticate":
|
|
4928
|
+
"WWW-Authenticate": wwwAuthenticate(path)
|
|
4915
4929
|
});
|
|
4916
4930
|
res.end(
|
|
4917
4931
|
JSON.stringify({
|