main() — mcp Function Reference
Architecture documentation for the main() function in index.ts from the mcp codebase.
Entity Profile
Dependency Diagram
graph TD 6f266567_35d5_7334_0233_87d521cf347b["main()"] a7551c40_ae18_02d5_7ca4_311e0ad1edb9["handlePrecache()"] 6f266567_35d5_7334_0233_87d521cf347b -->|calls| a7551c40_ae18_02d5_7ca4_311e0ad1edb9 69fc7a46_28f6_6b72_2725_66c381e53322["debug()"] 6f266567_35d5_7334_0233_87d521cf347b -->|calls| 69fc7a46_28f6_6b72_2725_66c381e53322 a9363f44_0cfc_87dc_a76a_4eeb9d75c684["start()"] 6f266567_35d5_7334_0233_87d521cf347b -->|calls| a9363f44_0cfc_87dc_a76a_4eeb9d75c684 style 6f266567_35d5_7334_0233_87d521cf347b 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
Source
Frequently Asked Questions
What does main() do?
main() is a function in the mcp codebase.
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