Kuberwastaken/claurst · error · anyhow::Error
Unknown MCP server
Error message
Unknown MCP server: {} What it means
begin_auth() looks up the server's configuration in server_configs before starting an OAuth session. If no config entry exists for the given name, it throws 'Unknown MCP server'. This is a config-table miss — the server may exist but OAuth can only proceed for configured servers.
Solutions
- List configured servers (server_configs keys) and confirm the exact name
- Fix the server name to match its settings.json entry
- Reload/parse the MCP configuration so the server appears in server_configs
- Add the server to the configuration if it is genuinely missing
Example fix
// before
hub.begin_auth("github-mcp").await?;
// after
hub.begin_auth("github").await?; // key must match settings.json server name Defensive patterns
Strategy: validation
Validate before calling
if !hub.configured_server_names().contains(&server_name.to_string()) {
anyhow::bail!("no MCP config for '{}'; check settings.json", server_name);
} Try / catch
match hub.begin_auth(server).await {
Ok(s) => s,
Err(e) if e.to_string().starts_with("Unknown MCP server") => {
eprintln!("'{}' not in config; available: {:?}", server, hub.configured_server_names());
return Ok(());
}
Err(e) => return Err(e),
} Prevention
- Use the exact settings.json key as the server identifier everywhere
- Reload MCP config after editing settings.json before OAuth calls
- Only run OAuth flows against HTTP/SSE servers listed in the config
When it happens
Trigger: Calling McpHub::begin_auth(server_name) where server_name is not a key in self.server_configs (typo, server defined only at runtime, or configs not loaded yet).
Common situations: Server name typo; calling OAuth on a stdio-only server that was never registered in server_configs; configuration file not reloaded after adding the server; name mismatch between settings.json key and the code.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- MCP server ' ' not found or not connected
- MCP server ' ' has no URL configured (required for OAuth)
- MCP server ' ' is configured as ' ' but missing URL
- Unknown MCP server
- invalid legacy SSE base URL
AI-assisted analysis of Kuberwastaken/claurst@b0637c97ec (2026-09-10).
Data as JSON: /api/errors/d2c283c7ba426a02.
Report an issue: GitHub.
Appendix: source
Thrown at src-rust/crates/mcp/src/lib.rs:1222
McpAuthState::Required {
auth_url: config
.url
.clone()
.unwrap_or_else(|| "(unknown URL)".to_string()),
}
}
/// Initiate OAuth 2.0 + PKCE for an HTTP MCP server.
pub async fn initiate_auth(&self, server_name: &str) -> anyhow::Result<String> {
Ok(self.begin_auth(server_name).await?.auth_url)
}
/// Build a full OAuth authorization session for an HTTP/SSE MCP server.
pub async fn begin_auth(&self, server_name: &str) -> anyhow::Result<oauth::McpAuthSession> {
let config = self
.server_configs
.get(server_name)
.ok_or_else(|| anyhow::anyhow!("Unknown MCP server: {}", server_name))?;
let base_url = config
.url
.as_deref()
.ok_or_else(|| {
anyhow::anyhow!(
"MCP server '{}' has no URL configured (required for OAuth)",
server_name
)
})?;
oauth::begin_mcp_auth(server_name, base_url).await
}
/// Run the browser-based OAuth flow and persist the resulting token.
pub async fn authenticate(&self, server_name: &str) -> anyhow::Result<oauth::McpAuthResult> {
let config = self
.server_configs
View on GitHub (pinned to b0637c97ec)