Home / File/ index.ts — mcp Source File

index.ts — mcp Source File

Architecture documentation for index.ts, a typescript file in the mcp codebase. 3 imports, 0 dependents.

File typescript McpServer ToolRegistry 3 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  a8b6f9ab_3b5e_37b9_6276_9a5fda5bb2c4["index.ts"]
  54581714_e921_5e5e_17c6_d2040cdc3b55["server.ts"]
  a8b6f9ab_3b5e_37b9_6276_9a5fda5bb2c4 --> 54581714_e921_5e5e_17c6_d2040cdc3b55
  50dc88e1_e79b_8a97_364b_4502057dd58f["Server"]
  a8b6f9ab_3b5e_37b9_6276_9a5fda5bb2c4 --> 50dc88e1_e79b_8a97_364b_4502057dd58f
  c78d0ed7_0af5_dfcf_6bfb_aff1a1d68fb1["logger.ts"]
  a8b6f9ab_3b5e_37b9_6276_9a5fda5bb2c4 --> c78d0ed7_0af5_dfcf_6bfb_aff1a1d68fb1
  style a8b6f9ab_3b5e_37b9_6276_9a5fda5bb2c4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

#!/usr/bin/env node
/**
 * Entry point for the Supermodel MCP Server.
 *
 * Usage:
 *   node dist/index.js [workdir] [--no-api-fallback]  -- Start MCP server
 *   node dist/index.js precache <dir> [--output-dir <dir>]  -- Pre-compute graph for a repo
 *
 * @module index
 */
import { Server } from './server';
import * as logger from './utils/logger';

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();
}

async function handlePrecache(args: string[]) {
  if (args.length === 0) {
    console.error('Usage: supermodel-mcp precache <directory> [--output-dir <dir>] [--name <repo-name>]');
    console.error('');
    console.error('Pre-compute a code graph for a repository and save it to disk.');
    console.error('');
    console.error('Options:');
    console.error('  --output-dir <dir>   Directory to save the cache file (default: ./supermodel-cache)');
    console.error('  --name <name>        Repository name for the cache key (default: directory basename)');
// ... (157 more lines)

Domain

Subdomains

Frequently Asked Questions

What does index.ts do?
index.ts is a source file in the mcp codebase, written in typescript. It belongs to the McpServer domain, ToolRegistry subdomain.
What functions are defined in index.ts?
index.ts defines 2 function(s): handlePrecache, main.
What does index.ts depend on?
index.ts imports 3 module(s): Server, logger.ts, server.ts.
Where is index.ts in the architecture?
index.ts is located at src/index.ts (domain: McpServer, subdomain: ToolRegistry, directory: src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free