Adds enterprise-managed authorization (EMA): browser-side IdP login + RFC 8693 token-exchange and JWT-bearer resource-token mint, per-server EMA opt-in in Server Settings, IdP config in Client Settings, and IdP clientSecret keychain storage. Includes the v2/main merge and review follow-ups (400 on malformed client config; normalizeIdpIssuer import consolidation).
29 lines
872 B
TypeScript
29 lines
872 B
TypeScript
import type { MCPServerConfig, ServerType } from "./types.js";
|
|
|
|
/**
|
|
* Returns the transport type for an MCP server configuration.
|
|
* If type is omitted, defaults to "stdio". Throws if type is invalid.
|
|
*/
|
|
export function getServerType(config: MCPServerConfig): ServerType {
|
|
if (!("type" in config) || config.type === undefined) {
|
|
return "stdio";
|
|
}
|
|
const type = config.type;
|
|
if (type === "stdio") {
|
|
return "stdio";
|
|
}
|
|
if (type === "sse") {
|
|
return "sse";
|
|
}
|
|
if (type === "streamable-http") {
|
|
return "streamable-http";
|
|
}
|
|
throw new Error(
|
|
`Invalid server type: ${type}. Valid types are: stdio, sse, streamable-http`,
|
|
);
|
|
}
|
|
|
|
/** OAuth and enterprise-managed auth apply only to remote HTTP-based transports. */
|
|
export function isOAuthCapableServerType(type: ServerType): boolean {
|
|
return type === "sse" || type === "streamable-http";
|
|
}
|