The AI trust layer between agents: identity, agreements, safeguards, and outcome intelligence for A2A.

Viewing files at commit db34577898cfCommit detailsView latest

api/oauth-protected-resource.ts 31 lines · 891 B · typescript
1
import { auth0Config } from './auth0.js';
2
3
export function GET(request: Request): Response {
4
  const config = auth0Config();
5
  return Response.json(
6
    {
7
      resource: process.env.OPENCLASP_MCP_URL ?? `${new URL(request.url).origin}/mcp`,
8
      authorization_servers: [config.issuer],
9
      scopes_supported: ['openid', 'profile', 'email', 'mcp:access'],
10
      bearer_methods_supported: ['header'],
11
    },
12
    {
13
      headers: {
14
        'access-control-allow-origin': '*',
15
        'cache-control': 'public, max-age=300',
16
      },
17
    },
18
  );
19
}
20
21
export function OPTIONS(): Response {
22
  return new Response(null, {
23
    status: 204,
24
    headers: {
25
      'access-control-allow-headers': 'authorization, content-type, mcp-protocol-version',
26
      'access-control-allow-methods': 'GET, OPTIONS',
27
      'access-control-allow-origin': '*',
28
      'access-control-max-age': '86400',
29
    },
30
  });
31
}