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.
38 lines • 1.51 kB
JavaScript
import { isAbsolute } from 'path';
export async function analyzeProjectTool(indexer, args) {
const { projectPath, includePatterns = ['**/*.ts', '**/*.js', '**/*.json'], excludePatterns = ['node_modules/**', 'dist/**', '**/*.d.ts'], forceReindex = false, } = args;
// Validate that projectPath is an absolute path
if (!isAbsolute(projectPath)) {
return {
content: [
{
type: 'text',
text: JSON.stringify({
success: false,
error: 'Project path must be an absolute path',
message: `Invalid project path: "${projectPath}". Please provide an absolute path (e.g., "/home/user/project" or "C:\\Users\\user\\project").`,
}, null, 2),
},
],
};
}
const result = await indexer.analyzeProject({
projectPath,
includePatterns,
excludePatterns,
forceReindex,
});
return {
content: [
{
type: 'text',
text: JSON.stringify({
success: true,
result,
message: `Project analysis complete! Found ${result.totalFiles} files, ${result.totalMethods} methods, ${result.totalPaths} paths, and ${result.totalDependencies} dependencies in ${result.duration}ms.`,
}, null, 2),
},
],
};
}
//# sourceMappingURL=analyze-project.js.map