@ferrlabs/mcp-core 6.3.0 → 6.3.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/transports/http.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAiBzE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,SAAS,CAAC;IAC9B;;;;;;;;;;;;OAYG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAoBD,wBAAsB,eAAe,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuH5E"}
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/transports/http.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAiBzE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,MAAM,SAAS,CAAC;IAC9B;;;;;;;;;;;;OAYG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAoBD,wBAAsB,eAAe,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6I5E"}
@@ -106,7 +106,25 @@ export async function startHttpServer(opts) {
106
106
  const body = await readJsonBody(req);
107
107
  await runWithAuthContext({ bearerToken }, () => transport.handleRequest(req, res, body));
108
108
  }
109
+ function applyCorsHeaders(req, res) {
110
+ const origin = req.headers.origin ?? '*';
111
+ res.setHeader('Access-Control-Allow-Origin', origin);
112
+ res.setHeader('Vary', 'Origin');
113
+ res.setHeader('Access-Control-Allow-Credentials', 'true');
114
+ res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
115
+ const requested = req.headers['access-control-request-headers'] ??
116
+ 'authorization, content-type, mcp-session-id, mcp-protocol-version';
117
+ res.setHeader('Access-Control-Allow-Headers', requested);
118
+ res.setHeader('Access-Control-Expose-Headers', 'mcp-session-id, www-authenticate');
119
+ res.setHeader('Access-Control-Max-Age', '86400');
120
+ }
109
121
  const httpServer = createHttpServer((req, res) => {
122
+ applyCorsHeaders(req, res);
123
+ if (req.method === 'OPTIONS') {
124
+ res.writeHead(204);
125
+ res.end();
126
+ return;
127
+ }
110
128
  const url = req.url ?? '/';
111
129
  if (url === '/health' || url === '/livez' || url === '/readyz') {
112
130
  res.writeHead(200, { 'Content-Type': 'application/json' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ferrlabs/mcp-core",
3
- "version": "6.3.0",
3
+ "version": "6.3.2",
4
4
  "description": "Shared core for FerrLabs MCP servers — auth, transports (stdio + Streamable HTTP), api-client, runner",
5
5
  "license": "MPL-2.0",
6
6
  "type": "module",