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

Viewing files at commit 81afd7789b27Commit detailsView latest

api/oauth-authorization-server.ts 34 lines · 1.0 KB · typescript
1
export async function GET(request: Request): Promise<Response> {
2
  const origin = new URL(request.url).origin;
3
  return Response.json(
4
    {
5
      issuer: origin,
6
      authorization_endpoint: `${origin}/oauth/authorize`,
7
      token_endpoint: `${origin}/oauth/token`,
8
      registration_endpoint: `${origin}/oauth/register`,
9
      scopes_supported: ['mcp:access'],
10
      response_types_supported: ['code'],
11
      grant_types_supported: ['authorization_code', 'refresh_token'],
12
      code_challenge_methods_supported: ['S256'],
13
      token_endpoint_auth_methods_supported: ['none'],
14
    },
15
    {
16
      headers: {
17
        'access-control-allow-origin': '*',
18
        'cache-control': 'public, max-age=300',
19
      },
20
    },
21
  );
22
}
23
24
export function OPTIONS(): Response {
25
  return new Response(null, {
26
    status: 204,
27
    headers: {
28
      'access-control-allow-headers': 'content-type, mcp-protocol-version',
29
      'access-control-allow-methods': 'GET, OPTIONS',
30
      'access-control-allow-origin': '*',
31
      'access-control-max-age': '86400',
32
    },
33
  });
34
}