Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

1.1 KB
Raw Blame
'use strict';

/**
 * Bootstrap for the MCP OAuth multi-process harness.
 *
 * The worker must be a REAL separate process, not a second in-process instance: process-local
 * single-flight maps, connection caches and module state would otherwise satisfy a cross-replica
 * assertion that production cannot satisfy. Jest's transform is unavailable outside the test
 * process, so compile the TypeScript worker with ts-node and resolve the package's `~/*` alias
 * the same way tsconfig.json declares it.
 *
 * Nothing here fakes a production adapter. Mongo, Redis, encryption and the OAuth handler are the
 * real implementations; only the provider and the stores are test-owned.
 */

const path = require('path');

const apiRoot = path.resolve(__dirname, '../../../..');

require('ts-node').register({
  transpileOnly: true,
  esm: false,
  project: path.join(apiRoot, 'tsconfig.json'),
  compilerOptions: { module: 'commonjs', moduleResolution: 'node' },
});

require('tsconfig-paths').register({
  baseUrl: apiRoot,
  paths: { '~/*': ['./src/*'] },
});

require('./mcpOAuthWorkerMain.ts');