MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / bootstrapServer

Function bootstrapServer

src/server/bootstrap.ts:51–214  ·  view source on GitHub ↗
(
  server: McpServer,
  options: BootstrapOptions = {},
)

Source from the content-addressed store, hash-verified

49}
50
51export async function bootstrapServer(
52 server: McpServer,
53 options: BootstrapOptions = {},
54): Promise<BootstrapResult> {
55 const profiler = createStartupProfiler('bootstrap');
56
57 server.server.setRequestHandler(SetLevelRequestSchema, async (request) => {
58 const { level } = request.params;
59 const normalized = normalizeLogLevel(level);
60 if (normalized) {
61 setLogLevel(normalized);
62 }
63 log('info', `Client requested log level: ${level}`);
64 return {};
65 });
66
67 const hasLegacyEnabledWorkflows = Object.prototype.hasOwnProperty.call(
68 options,
69 'enabledWorkflows',
70 );
71 let overrides: RuntimeConfigOverrides | undefined;
72 if (options.configOverrides !== undefined) {
73 overrides = { ...options.configOverrides };
74 }
75 if (hasLegacyEnabledWorkflows) {
76 overrides ??= {};
77 overrides.enabledWorkflows = options.enabledWorkflows ?? [];
78 }
79
80 let stageStartMs = getStartupProfileNowMs();
81 const result = await bootstrapRuntime({
82 runtime: 'mcp',
83 cwd: options.cwd,
84 fs: options.fileSystemExecutor,
85 configOverrides: overrides,
86 });
87 profiler.mark('bootstrapRuntime', stageStartMs);
88
89 if (result.configFound) {
90 for (const notice of result.notices) {
91 log('info', `[ProjectConfig] ${notice}`);
92 }
93 }
94
95 const enabledWorkflows = result.runtime.config.enabledWorkflows;
96 const { workspaceRoot, workspaceKey } = result;
97
98 log('info', `🚀 Initializing server...`);
99
100 const executor = getDefaultCommandExecutor();
101 stageStartMs = getStartupProfileNowMs();
102 const xcodeDetection = await detectXcodeRuntime(executor);
103 profiler.mark('detectXcodeRuntime', stageStartMs);
104
105 const ctx: PredicateContext = {
106 runtime: 'mcp',
107 config: result.runtime.config,
108 runningUnderXcode: xcodeDetection.runningUnderXcode,

Callers 2

createMcpTestHarnessFunction · 0.90
startMcpServerFunction · 0.90

Calls 15

createStartupProfilerFunction · 0.90
normalizeLogLevelFunction · 0.90
setLogLevelFunction · 0.90
logFunction · 0.90
getStartupProfileNowMsFunction · 0.90
bootstrapRuntimeFunction · 0.90
detectXcodeRuntimeFunction · 0.90
getRegisteredWorkflowsFunction · 0.90
registerResourcesFunction · 0.90

Tested by

no test coverage detected