constructor() — mcp Function Reference
Architecture documentation for the constructor() function in server.ts from the mcp codebase.
Entity Profile
Dependency Diagram
graph TD 65787d30_1025_d531_cde5_ded3572607bd["constructor()"] 50dc88e1_e79b_8a97_364b_4502057dd58f["Server"] 65787d30_1025_d531_cde5_ded3572607bd -->|defined in| 50dc88e1_e79b_8a97_364b_4502057dd58f 6471f5ca_fcb9_6e5d_af84_17b245dc7c0f["setupHandlers()"] 65787d30_1025_d531_cde5_ded3572607bd -->|calls| 6471f5ca_fcb9_6e5d_af84_17b245dc7c0f 6b8403ed_3225_353c_2302_260d0a18d1db["constructor()"] 65787d30_1025_d531_cde5_ded3572607bd -->|calls| 6b8403ed_3225_353c_2302_260d0a18d1db 9d72a623_8b26_a485_5797_5f53c18e4294["start()"] 65787d30_1025_d531_cde5_ded3572607bd -->|calls| 9d72a623_8b26_a485_5797_5f53c18e4294 33bb86df_1268_373b_a74a_77412144612c["debug()"] 65787d30_1025_d531_cde5_ded3572607bd -->|calls| 33bb86df_1268_373b_a74a_77412144612c style 65787d30_1025_d531_cde5_ded3572607bd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/server.ts lines 52–104
constructor(defaultWorkdir?: string, options?: ServerOptions) {
this.defaultWorkdir = defaultWorkdir;
this.options = options;
// Note: noApiFallback is deferred to start() so startup precaching can use the API
this.server = new McpServer(
{
name: 'supermodel_api',
version: '0.0.1',
},
{
capabilities: { tools: {}, logging: {} },
instructions: `# Supermodel: Codebase Intelligence
Two tools for instant codebase understanding. Pre-computed graphs enable sub-second responses.
## Recommended workflow
1. \`overview\` first to learn architecture and key symbols (1 call)
2. \`symbol_context\` on 1-2 symbols from the issue to see source, callers, callees (1-2 calls)
3. Stop calling MCP tools. Use the results to make your fix.
## Anti-patterns
- >3 MCP calls total = diminishing returns. Aim for 1 overview + 1-2 symbol lookups.
- Chasing callers-of-callers burns iterations without helping.
## After fixing
Run the project's existing test suite (e.g. pytest). Do NOT write standalone test scripts.
## Tool reference
- \`overview\`: Architecture map, domains, hub functions, file counts. Zero-arg, sub-second.
- \`symbol_context\`: Source, callers, callees, domain for any function/class/method. Supports "Class.method" and partial matching.`,
},
);
const config = new Configuration({
basePath: process.env.SUPERMODEL_BASE_URL || 'https://api.supermodeltools.com',
apiKey: process.env.SUPERMODEL_API_KEY,
fetchApi: fetchWithTimeout,
});
logger.debug('Server configuration:');
logger.debug('Base URL:', config.basePath);
logger.debug('API Key set:', !!process.env.SUPERMODEL_API_KEY);
if (this.defaultWorkdir) {
logger.debug('Default workdir:', this.defaultWorkdir);
}
const api = new DefaultApi(config);
this.client = {
graphs: new SupermodelClient(api),
};
this.setupHandlers();
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does constructor() do?
constructor() is a function in the mcp codebase, defined in src/server.ts.
Where is constructor() defined?
constructor() is defined in src/server.ts at line 52.
What does constructor() call?
constructor() calls 4 function(s): constructor, debug, setupHandlers, start.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free