mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-06-19 07:43:46 +08:00
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
23 lines
813 B
Ruby
Vendored
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
|