@pluggedin/pluggedin-mcp-proxy
Version:
Unified MCP proxy that aggregates all your MCP servers (STDIO, SSE, Streamable HTTP) into one powerful interface. Access any tool through a single connection, search across unified documents with built-in RAG, and receive notifications from any model. Tes
20 lines (19 loc) • 651 B
JavaScript
/**
* Resource helper functions
*/
import { getPluggedinMCPApiKey, getPluggedinMCPApiBaseUrl } from '../utils.js';
/**
* Ensures authentication for resources that require it
* @param uri - Resource URI
* @param requiresAuth - Whether the resource requires authentication
* @returns API key and base URL
* @throws Error if authentication is required but not provided
*/
export function ensureAuth(uri, requiresAuth) {
const key = getPluggedinMCPApiKey();
const base = getPluggedinMCPApiBaseUrl();
if (requiresAuth && (!key || !base)) {
throw new Error(`API key required to access ${uri}`);
}
return { key, base };
}