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

Viewing files at commit 2c749578ec22Commit detailsView latest

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