#!/usr/bin/env node
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
// Import tools
import { inspectProject, inspectProjectSchema } from './src/tools/inspectProject.js';
import { detectStack, detectStackSchema } from './src/tools/detectStack.js';
import { listKeyFiles, listKeyFilesSchema } from './src/tools/listKeyFiles.js';
const server = new McpServer({
name: "project-inspector",
version: "1.0.0",
});
/**
* Tool 1: inspect_project
* Complete project snapshot - language, framework, structure, dependencies
*/
server.registerTool(
"inspect_project",
{
title: "Inspect Project",
description: "Analyze a project directory and return a complete snapshot including detected languages, frameworks, entry points, structure summary, and dependencies. This is the primary tool for understanding a project.",
inputSchema: inspectProjectSchema
},
async (params) => {
const result = await inspectProject(params);
return {
content: [
{
type: "text",
text: JSON.stringify(result, null, 2),
},
],
};
}
);
/**
* Tool 2: detect_stack
* Lightweight and fast stack detection
*/
server.registerTool(
"detect_stack",
{
title: "Detect Stack",
description: "Quickly detect the technology stack of a project. Faster and lighter than inspect_project, returns runtime, framework, database hints, and frontend info.",
inputSchema: detectStackSchema
},
async (params) => {
const result = await detectStack(params);
return {
content: [
{
type: "text",
text: JSON.stringify(result, null, 2),
},
],
};
}
);
/**
* Tool 3: list_key_files
* List categorized key files
*/
server.registerTool(
"list_key_files",
{
title: "List Key Files",
description: "List key files in a project, categorized by purpose: entry points, config files, and documentation.",
inputSchema: listKeyFilesSchema
},
async (params) => {
const result = await listKeyFiles(params);
return {
content: [
{
type: "text",
text: JSON.stringify(result, null, 2),
},
],
};
}
);
/**
* Start server via stdio transport
*/
const transport = new StdioServerTransport();
await server.connect(transport);