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

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