discourse/plugins/discourse-ai/app/controllers/discourse_ai/mcp_oauth_controller.rb
Sam a9bf76af1c
FIX: Improve MCP OAuth callback error handling (#38889)
This gets OAuth MCP into a more final state 

- Handles dynamic registration RFC
- Makes it easier to debug
- Allows the work "mcp" to find the mcp section in the app in admin
search
- Compresses UI a bit so we are not bombarded with noise
2026-03-27 07:34:24 +11:00

23 lines
813 B
Ruby
Vendored

# frozen_string_literal: true
module DiscourseAi
class McpOauthController < ::ApplicationController
requires_plugin PLUGIN_NAME
skip_before_action :check_xhr, only: :client_metadata
skip_before_action :preload_json, only: :client_metadata
skip_before_action :redirect_to_login_if_required, only: :client_metadata
def client_metadata
render json: {
client_name: "Discourse AI MCP Client",
redirect_uris: [
"#{Discourse.base_url}/admin/plugins/discourse-ai/ai-mcp-servers/oauth/callback",
],
grant_types: %w[authorization_code refresh_token],
response_types: ["code"],
application_type: "web",
token_endpoint_auth_method: "none",
}
end
end
end