@zenrows/mcp 1.1.0 → 1.1.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.
Files changed (2) hide show
  1. package/dist/http.js +13 -0
  2. package/package.json +1 -1
package/dist/http.js CHANGED
@@ -1,9 +1,19 @@
1
1
  import { Hono } from "hono";
2
+ import { cors } from "hono/cors";
2
3
  import { serve } from "@hono/node-server";
3
4
  import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
4
5
  import { createServer } from "./server.js";
5
6
  // ─── app ──────────────────────────────────────────────────────────────────────
6
7
  const app = new Hono();
8
+ // CORS — required for browser-side MCP clients (Claude.ai, Cursor web, etc.)
9
+ // All origins allowed: the API key is the auth mechanism, not the origin.
10
+ app.use(cors({
11
+ origin: "*",
12
+ allowMethods: ["GET", "POST", "OPTIONS"],
13
+ allowHeaders: ["Authorization", "Content-Type", "Accept", "Mcp-Session-Id"],
14
+ exposeHeaders: ["WWW-Authenticate", "Mcp-Session-Id"],
15
+ maxAge: 86_400,
16
+ }));
7
17
  function extractApiKey(req) {
8
18
  const auth = req.headers.get("authorization");
9
19
  if (auth) {
@@ -30,6 +40,9 @@ app.all("/mcp", async (c) => {
30
40
  error: "Missing API key. Use Authorization: Bearer <key> header or ?apikey=<key> query param.",
31
41
  }, 401, {
32
42
  "WWW-Authenticate": `Bearer realm="${AUTH_SERVER}", resource_metadata="https://mcp.zenrows.com/.well-known/oauth-authorization-server"`,
43
+ // CloudFront strips WWW-Authenticate — add Link header as RFC 8615 fallback
44
+ // so MCP clients can still discover the OAuth server
45
+ "Link": `<https://mcp.zenrows.com/.well-known/oauth-authorization-server>; rel="oauth-authorization-server"`,
33
46
  });
34
47
  }
35
48
  const transport = new WebStandardStreamableHTTPServerTransport({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenrows/mcp",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "ZenRows MCP server — Universal Scraper API for AI coding assistants",
5
5
  "type": "module",
6
6
  "bin": {