mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-05 19:11:00 +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
28 lines
1,015 B
Ruby
28 lines
1,015 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe DiscourseAi::McpOauthController do
|
|
before { enable_current_plugin }
|
|
|
|
describe "GET #client_metadata" do
|
|
it "returns a client metadata document" do
|
|
get "/discourse-ai/mcp/oauth/client-metadata.json"
|
|
|
|
expect(response).to be_successful
|
|
expect(response.parsed_body["client_name"]).to eq("Discourse AI MCP Client")
|
|
expect(response.parsed_body["redirect_uris"]).to include(
|
|
"#{Discourse.base_url}/admin/plugins/discourse-ai/ai-mcp-servers/oauth/callback",
|
|
)
|
|
expect(response.parsed_body["grant_types"]).to eq(%w[authorization_code refresh_token])
|
|
expect(response.parsed_body["token_endpoint_auth_method"]).to eq("none")
|
|
end
|
|
|
|
it "is accessible when login is required" do
|
|
SiteSetting.login_required = true
|
|
|
|
get "/discourse-ai/mcp/oauth/client-metadata.json"
|
|
|
|
expect(response).to be_successful
|
|
expect(response.parsed_body["client_name"]).to eq("Discourse AI MCP Client")
|
|
end
|
|
end
|
|
end
|