@civic/hub-bridge
Version:
Stdio <-> HTTP/SSE MCP bridge with Civic auth handling
24 lines • 945 B
JavaScript
import { RestartableStreamableHTTPClientTransport } from "@civic/auth-mcp/client";
import { CLIAuthProviderSingleton } from "../auth/cli-auth-provider-singleton.js";
import { REMOTE_MCP_URL } from "../config/index.js";
/**
* Create a client that connects to the target MCP server
*/
export function createHubBridgeStreamableHttpTransport(currentProfile) {
// Use the singleton auth provider
const authProvider = CLIAuthProviderSingleton.getInstance();
// Only include the profile header if it's not the default
const headers = {};
if (currentProfile && currentProfile !== "default") {
headers["x-civic-profile"] = currentProfile;
}
// Create the transport with auth provider
const serverUrl = new URL(REMOTE_MCP_URL);
return new RestartableStreamableHTTPClientTransport(serverUrl, {
authProvider,
requestInit: {
headers
}
});
}
//# sourceMappingURL=index.js.map