@talonic/mcp 0.1.33 → 0.1.34

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.
@@ -982,7 +982,7 @@ function registerToMarkdown(server, getTalonic) {
982
982
 
983
983
  // package.json
984
984
  var package_default = {
985
- version: "0.1.33"};
985
+ version: "0.1.34"};
986
986
 
987
987
  // src/version.ts
988
988
  var VERSION = package_default.version;
@@ -1058,6 +1058,21 @@ function createServer(options) {
1058
1058
  return server;
1059
1059
  }
1060
1060
 
1061
+ // src/origin.ts
1062
+ var ALLOWED_ORIGINS = /* @__PURE__ */ new Set([
1063
+ "https://claude.ai",
1064
+ "https://www.claude.ai",
1065
+ "https://app.claude.ai",
1066
+ "https://cursor.directory",
1067
+ "https://glama.ai",
1068
+ "https://mcp.so",
1069
+ "https://smithery.ai"
1070
+ ]);
1071
+ function isOriginAllowed(originHeader) {
1072
+ if (!originHeader) return true;
1073
+ return ALLOWED_ORIGINS.has(originHeader);
1074
+ }
1075
+
1061
1076
  // src/http-server.ts
1062
1077
  var PORT = Number(process.env["PORT"] ?? 3e3);
1063
1078
  var RESOURCE_URL = process.env["MCP_RESOURCE_URL"] ?? "https://mcp.talonic.com";
@@ -1087,6 +1102,18 @@ var WWW_AUTHENTICATE = `Bearer resource_metadata="${RESOURCE_URL}/.well-known/oa
1087
1102
  var httpServer = createServer$1(async (req, res) => {
1088
1103
  const url = new URL(req.url ?? "/", "http://localhost");
1089
1104
  const path = url.pathname;
1105
+ const incomingOrigin = req.headers["origin"];
1106
+ const incomingOriginValue = typeof incomingOrigin === "string" ? incomingOrigin : void 0;
1107
+ if (!isOriginAllowed(incomingOriginValue)) {
1108
+ res.writeHead(403, { "Content-Type": "application/json" });
1109
+ res.end(
1110
+ JSON.stringify({
1111
+ error: "origin_not_allowed",
1112
+ message: `Origin '${incomingOriginValue}' is not in the allowlist. Contact info@talonic.ai if you believe this is an error.`
1113
+ })
1114
+ );
1115
+ return;
1116
+ }
1090
1117
  if (path === "/health") {
1091
1118
  res.writeHead(200, { "Content-Type": "application/json" });
1092
1119
  res.end(JSON.stringify({ status: "ok", server: SERVER_NAME, version: VERSION }));
@@ -1116,7 +1143,10 @@ var httpServer = createServer$1(async (req, res) => {
1116
1143
  );
1117
1144
  return;
1118
1145
  }
1119
- res.setHeader("Access-Control-Allow-Origin", "*");
1146
+ if (incomingOriginValue) {
1147
+ res.setHeader("Access-Control-Allow-Origin", incomingOriginValue);
1148
+ res.setHeader("Vary", "Origin");
1149
+ }
1120
1150
  res.setHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, OPTIONS");
1121
1151
  res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization, Mcp-Session-Id");
1122
1152
  res.setHeader("Access-Control-Expose-Headers", "Mcp-Session-Id");