main() — mcp Function Reference
Architecture documentation for the main() function in index.ts from the mcp codebase.
Entity Profile
Dependency Diagram
graph TD 9b0f2e33_56dd_6b97_6fd4_a4a2c45675d5["main()"] a8b6f9ab_3b5e_37b9_6276_9a5fda5bb2c4["index.ts"] 9b0f2e33_56dd_6b97_6fd4_a4a2c45675d5 -->|defined in| a8b6f9ab_3b5e_37b9_6276_9a5fda5bb2c4 8f9bd40a_a38b_c157_ad49_822975099f71["handlePrecache()"] 9b0f2e33_56dd_6b97_6fd4_a4a2c45675d5 -->|calls| 8f9bd40a_a38b_c157_ad49_822975099f71 33bb86df_1268_373b_a74a_77412144612c["debug()"] 9b0f2e33_56dd_6b97_6fd4_a4a2c45675d5 -->|calls| 33bb86df_1268_373b_a74a_77412144612c 9d72a623_8b26_a485_5797_5f53c18e4294["start()"] 9b0f2e33_56dd_6b97_6fd4_a4a2c45675d5 -->|calls| 9d72a623_8b26_a485_5797_5f53c18e4294 style 9b0f2e33_56dd_6b97_6fd4_a4a2c45675d5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/index.ts lines 14–50
async function main() {
const args = process.argv.slice(2);
// Handle precache subcommand
if (args[0] === 'precache') {
await handlePrecache(args.slice(1));
return;
}
// Normal MCP server mode — parse flags
let defaultWorkdir: string | undefined;
let noApiFallback = !!process.env.SUPERMODEL_NO_API_FALLBACK;
let precache = false;
for (const arg of args) {
if (arg === '--no-api-fallback') {
noApiFallback = true;
} else if (arg === '--precache') {
precache = true;
} else if (!arg.startsWith('--')) {
defaultWorkdir = arg;
}
}
if (defaultWorkdir) {
logger.debug('Default workdir:', defaultWorkdir);
}
if (noApiFallback) {
logger.debug('API fallback disabled (cache-only mode)');
}
if (precache) {
logger.debug('Startup precaching enabled');
}
const server = new Server(defaultWorkdir, { noApiFallback, precache });
await server.start();
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does main() do?
main() is a function in the mcp codebase, defined in src/index.ts.
Where is main() defined?
main() is defined in src/index.ts at line 14.
What does main() call?
main() calls 3 function(s): debug, handlePrecache, start.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free