MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / mcp_error_to_api_error

Function mcp_error_to_api_error

crates/opencode-server/src/routes.rs:2709–2721  ·  view source on GitHub ↗
(error: McpOAuthError)

Source from the content-addressed store, hash-verified

2707}
2708
2709fn mcp_error_to_api_error(error: McpOAuthError) -> ApiError {
2710 match error {
2711 McpOAuthError::ServerNotFound(name) => {
2712 ApiError::NotFound(format!("MCP server not found: {}", name))
2713 }
2714 McpOAuthError::OAuthNotSupported(name) => {
2715 ApiError::BadRequest(format!("MCP server does not support OAuth: {}", name))
2716 }
2717 McpOAuthError::OAuthInProgress => ApiError::BadRequest("OAuth already in progress".into()),
2718 McpOAuthError::OAuthFailed(message) => ApiError::BadRequest(message),
2719 McpOAuthError::RuntimeError(message) => ApiError::BadRequest(message),
2720 }
2721}
2722
2723fn parse_runtime_from_request(config: McpConfigInput) -> Result<(McpRuntimeConfig, bool)> {
2724 let enabled = config.enabled.unwrap_or(true);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected