fix: Handle invalid claudeai scope (#11484)

* fix: Handle invalid 'claudeai' scope

* Add docs link
This commit is contained in:
Tom Moor
2026-02-17 18:51:36 -05:00
committed by GitHub
parent c9fe7b3d5c
commit 924db0a3fd
4 changed files with 38 additions and 8 deletions
+19 -3
View File
@@ -53,6 +53,23 @@ export default function OAuthAuthorize() {
return <Login />;
}
function inputScopes(scope?: string): string[] {
const defaultScopes = ["read", "write"];
// Some clients don't send the scope parameter if it's empty, so we default to "read write".
if (!scope) {
return defaultScopes;
}
// Handle invalid "claudeai" scope sent by Claude:
// https://github.com/modelcontextprotocol/modelcontextprotocol/issues/653
if (scope === "claudeai") {
return defaultScopes;
}
return scope.split(" ").filter(Boolean);
}
/**
* Authorize component is responsible for handling the OAuth authorization process.
* It retrieves the OAuth client information, displays the authorization request,
@@ -72,10 +89,9 @@ function Authorize() {
code_challenge: codeChallenge,
code_challenge_method: codeChallengeMethod,
state,
// Some clients don't send the scope parameter if it's empty, so we default to "read write".
scope = "read write",
scope,
} = Object.fromEntries(params);
const [scopes] = useState(() => scope?.split(" ") ?? []);
const [scopes] = useState(() => inputScopes(scope));
const { error: clientError, data: response } = useRequest<{
data: OAuthClient;
}>(() => client.post("/oauthClients.info", { clientId, redirectUri }), true);
+4
View File
@@ -45,6 +45,10 @@ export class OAuthScopeHelper {
const [namespace, method] = scope.replace("/api/", "").split(/[:\.]/g);
const readableMethod =
methodToReadable[method as keyof typeof methodToReadable] ?? method;
if (!readableMethod) {
return scope;
}
const translatedNamespace =
translatedNamespaces[namespace as keyof typeof translatedNamespaces] ??
namespace;
+14 -4
View File
@@ -60,10 +60,20 @@ function Features() {
as="p"
style={{ marginTop: 8, marginBottom: 4 }}
>
{t(
"Use the following endpoint to connect to the MCP server from your app"
)}
:
<Trans
defaults="Use the following endpoint to connect to the MCP server from your app. Find out more about setup in <a>the docs</a>."
components={{
a: (
<Text
as="a"
weight="bold"
href="https://docs.getoutline.com/s/guide/doc/mcp-6j9jtENNKL"
target="_blank"
rel="noopener noreferrer"
/>
),
}}
/>
</Text>
<Input readOnly value={mcpEndpoint}>
<Tooltip content={t("Copy URL")} placement="top">
+1 -1
View File
@@ -1205,7 +1205,7 @@
"Manage AI and integration features for your workspace.": "Manage AI and integration features for your workspace.",
"MCP server": "MCP server",
"Allow members to connect to this workspace with MCP to read and write data.": "Allow members to connect to this workspace with MCP to read and write data.",
"Use the following endpoint to connect to the MCP server from your app": "Use the following endpoint to connect to the MCP server from your app",
"Use the following endpoint to connect to the MCP server from your app. Find out more about setup in <a>the docs</a>.": "Use the following endpoint to connect to the MCP server from your app. Find out more about setup in <a>the docs</a>.",
"Copy URL": "Copy URL",
"AI answers": "AI answers",
"Use AI to get direct answers to questions in search. This feature requires a paid license.": "Use AI to get direct answers to questions in search. This feature requires a paid license.",