INNER CODE UNIT · TypeScript

readBearerTokenFromHeader

lazy-dinosaur/ccxt-mcp · src/index.ts:107

function readBearerTokenFromHeader(req: IncomingMessage): string | null {
  const auth = req.headers.authorization;
  if (!auth) return null;

  const match = auth.match(/^Bearer\s+(.+)$/i);
  if (!match) return null;

  const token = match[1].trim();
  return token || null;
}

async function startSseServer() {
  const effectiveConfigPath = resolveConfigPath();
  const expectedBearerToken = readMcpBearerTokenFromConfig(effectiveConfigPath);

  const sessions = new Map<string, { transport: SSEServerTransport; mcpServer: CcxtMcpServer }>();

  const httpServer = createServer(async (req: IncomingMessage, res: ServerResponse) => {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…