start() — mcp Function Reference
Architecture documentation for the start() function in server.ts from the mcp codebase.
Entity Profile
Dependency Diagram
graph TD a9363f44_0cfc_87dc_a76a_4eeb9d75c684["start()"] 6f266567_35d5_7334_0233_87d521cf347b["main()"] 6f266567_35d5_7334_0233_87d521cf347b -->|calls| a9363f44_0cfc_87dc_a76a_4eeb9d75c684 c038b2a8_9211_043e_36bd_8ccef7d18ab5["constructor()"] c038b2a8_9211_043e_36bd_8ccef7d18ab5 -->|calls| a9363f44_0cfc_87dc_a76a_4eeb9d75c684 1f1e3342_1a9b_64a4_0615_96437ddf8cb2["injectOverviewInstructions()"] a9363f44_0cfc_87dc_a76a_4eeb9d75c684 -->|calls| 1f1e3342_1a9b_64a4_0615_96437ddf8cb2 f49e8b0d_0aa2_864b_8309_ab4164c3e67c["cleanupOldZips()"] a9363f44_0cfc_87dc_a76a_4eeb9d75c684 -->|calls| f49e8b0d_0aa2_864b_8309_ab4164c3e67c 69fc7a46_28f6_6b72_2725_66c381e53322["debug()"] a9363f44_0cfc_87dc_a76a_4eeb9d75c684 -->|calls| 69fc7a46_28f6_6b72_2725_66c381e53322 4def3ca5_c0bf_fbae_1c00_3a7385fe0264["loadCacheFromDisk()"] a9363f44_0cfc_87dc_a76a_4eeb9d75c684 -->|calls| 4def3ca5_c0bf_fbae_1c00_3a7385fe0264 09c7f624_4fd7_1375_9a06_22a0fffde922["setRepoMap()"] a9363f44_0cfc_87dc_a76a_4eeb9d75c684 -->|calls| 09c7f624_4fd7_1375_9a06_22a0fffde922 e5352615_c5fb_64a2_cc5c_a248578cbc8a["warn()"] a9363f44_0cfc_87dc_a76a_4eeb9d75c684 -->|calls| e5352615_c5fb_64a2_cc5c_a248578cbc8a df6e0585_94bc_eb51_256f_f5c95dbbd57f["info()"] a9363f44_0cfc_87dc_a76a_4eeb9d75c684 -->|calls| df6e0585_94bc_eb51_256f_f5c95dbbd57f 9003922a_3c12_9d09_182b_1d8c2e1893be["precacheForDirectory()"] a9363f44_0cfc_87dc_a76a_4eeb9d75c684 -->|calls| 9003922a_3c12_9d09_182b_1d8c2e1893be 21547bc6_93e4_4db8_5c19_25b6d1fb9a44["setNoApiFallback()"] a9363f44_0cfc_87dc_a76a_4eeb9d75c684 -->|calls| 21547bc6_93e4_4db8_5c19_25b6d1fb9a44 style a9363f44_0cfc_87dc_a76a_4eeb9d75c684 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/server.ts lines 235–275
async start() {
// Clean up any stale ZIP files from previous sessions
await cleanupOldZips(ZIP_CLEANUP_AGE_MS);
// Load pre-computed graphs from cache directory
const cacheDir = process.env.SUPERMODEL_CACHE_DIR;
if (cacheDir) {
try {
logger.debug('Loading pre-computed graphs from:', cacheDir);
const repoMap = await loadCacheFromDisk(cacheDir, graphCache);
setRepoMap(repoMap);
logger.debug(`Loaded ${repoMap.size} repo mappings`);
this.injectOverviewInstructions(repoMap);
} catch (err: any) {
logger.warn('Failed to load cache directory:', err.message || err);
}
}
// Connect transport FIRST so the MCP handshake completes immediately.
// This prevents Claude Code from timing out the server (MCP_TIMEOUT=60s)
// when precaching requires a slow API call.
const transport = new StdioServerTransport();
await this.server.connect(transport);
logger.info('Supermodel MCP Server running on stdio');
// Precache the workdir's repo if --precache flag is set.
// Runs AFTER connect but BEFORE noApiFallback so the API is available.
// This is fire-and-forget from the MCP client's perspective — tools
// that arrive before precaching finishes will use on-demand API calls.
if (this.options?.precache && this.defaultWorkdir) {
try {
await precacheForDirectory(this.client, this.defaultWorkdir, cacheDir);
} catch (err: any) {
// Non-fatal: if precaching fails, tools fall back to on-demand API
logger.warn('Startup precache failed:', err.message || err);
}
}
// NOW enable no-api-fallback (after precaching had its chance)
setNoApiFallback(!!this.options?.noApiFallback);
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does start() do?
start() is a function in the mcp codebase.
What does start() call?
start() calls 9 function(s): cleanupOldZips, debug, info, injectOverviewInstructions, loadCacheFromDisk, precacheForDirectory, setNoApiFallback, setRepoMap, and 1 more.
What calls start()?
start() is called by 2 function(s): constructor, main.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free