ts-project-indexer-mcp
Version:
A powerful MCP (Model Context Protocol) server that indexes and analyzes TypeScript/JavaScript projects, providing intelligent code exploration, dependency tracking, method discovery, and project structure analysis for AI assistants and development tools.
80 lines • 2.03 kB
TypeScript
export interface TsConfig {
compilerOptions?: {
baseUrl?: string;
rootDir?: string;
outDir?: string;
paths?: Record<string, string[]>;
};
}
export interface PackageJson {
imports?: Record<string, string>;
}
export declare class PathResolver {
private projectRoot;
private tsConfig;
private packageJson;
private pathMappings;
constructor(projectRoot: string);
initialize(): Promise<void>;
/**
* Resolve an import path to absolute file path
*/
resolveImportPath(importPath: string, fromFile: string): string | null;
/**
* Normalize a file path to the project-relative format
*/
normalizeFilePath(filePath: string): string;
/**
* Get possible file extensions for resolution
*/
private getPossibleExtensions;
/**
* Resolve package imports like #root/*
*/
private resolvePackageImport;
/**
* Resolve relative imports like ../../config
*/
private resolveRelativeImport;
/**
* Resolve absolute imports
*/
private resolveAbsoluteImport;
/**
* Resolve TypeScript path mappings
*/
private resolvePathMapping;
/**
* Try to find existing file with different extensions
*/
private resolveToExistingFile;
/**
* Check if import path matches a pattern like "#root/*"
*/
private matchesPattern;
/**
* Replace pattern wildcards with actual values
*/
private replacePattern;
/**
* Load TypeScript configuration
*/
private loadTsConfig;
/**
* Load package.json configuration
*/
private loadPackageJson;
/**
* Search for a file in project directory and limited parent directories
*/
private findFileInParentDirs;
/**
* Build internal path mappings for quick lookup
*/
private buildPathMappings;
/**
* Debug method to inspect current configuration
*/
getDebugInfo(): any;
}
//# sourceMappingURL=path-resolver.d.ts.map