fix(mcp): expose standard protected resource metadata
Some checks failed
CI / verify (push) Has been cancelled
CI / print-rust (push) Has been cancelled

This commit is contained in:
Admin 2026-09-27 18:18:50 +00:00
parent 85a9d0238c
commit 7c9d136b4d

View File

@ -129,8 +129,8 @@ app.get('/api/health/ready', async (_req, res) => {
}
})
const mcpResourceMetadataUrl = new URL('/.well-known/oauth-protected-resource/api/mcp', config.mcpResourceUrl).href
app.get('/.well-known/oauth-protected-resource/api/mcp', (_req, res) => {
const mcpResourceMetadataUrl = new URL('/.well-known/oauth-protected-resource', config.mcpResourceUrl).href
function sendMcpProtectedResourceMetadata(res: express.Response) {
res.setHeader('Cache-Control', 'public, max-age=300')
res.json({
resource: config.mcpResourceUrl,
@ -138,6 +138,12 @@ app.get('/.well-known/oauth-protected-resource/api/mcp', (_req, res) => {
scopes_supported: [...FIELDLENS_MCP_OAUTH_SCOPES],
bearer_methods_supported: ['header'],
})
}
app.get('/.well-known/oauth-protected-resource', (_req, res) => {
sendMcpProtectedResourceMetadata(res)
})
app.get('/.well-known/oauth-protected-resource/api/mcp', (_req, res) => {
sendMcpProtectedResourceMetadata(res)
})
app.use('/api/mcp', (_req, res, next) => {