Skip to main content
Glama
TheAlchemist6

CodeCompass MCP

analyze_dependencies

Analyze GitHub repository dependencies to identify external packages, internal dependencies, security vulnerabilities, version conflicts, and outdated packages for comprehensive project insights.

Instructions

📦 Comprehensive dependency analysis including external packages, internal dependencies, security vulnerabilities, and version conflicts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
optionsNo
urlYesGitHub repository URL

Implementation Reference

  • Tool schema definition and registration in consolidated tools list, defining input parameters for analyzing dependencies.
    { name: 'analyze_dependencies', description: '📦 Comprehensive dependency analysis including external packages, internal dependencies, security vulnerabilities, and version conflicts.', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'GitHub repository URL', }, options: { type: 'object', properties: { include_dev_dependencies: { type: 'boolean', description: 'Include development dependencies', default: true, }, include_security_scan: { type: 'boolean', description: 'Include security vulnerability scanning', default: true, }, include_version_analysis: { type: 'boolean', description: 'Include version conflict analysis', default: true, }, check_outdated: { type: 'boolean', description: 'Check for outdated packages', default: true, }, }, }, }, required: ['url'], }, },
  • Main handler function for the 'analyze_dependencies' tool, extracting URL from args and calling GitHubService.analyzeDependencies, then formatting response.
    async function handleAnalyzeDependencies(args: any) { try { const { url, options = {} } = args; const dependencies = await githubService.analyzeDependencies(url); const response = createResponse(dependencies); return formatToolResponse(response); } catch (error) { const response = createResponse(null, error); return formatToolResponse(response); }
  • Switch case registration in main tool dispatcher that routes 'analyze_dependencies' calls to the specific handler.
    case 'analyze_dependencies': result = await handleAnalyzeDependencies(args); break;
  • Core helper function implementing dependency analysis logic: parses package.json (dependencies, devDependencies, peerDependencies) and requirements.txt, collects DependencyInfo objects.
    async analyzeDependencies(url: string): Promise<DependencyInfo[]> { const dependencies: DependencyInfo[] = []; try { // Check for package.json try { const packageJson = await this.getFileContent(url, 'package.json'); const pkg = JSON.parse(packageJson); // Add regular dependencies if (pkg.dependencies) { for (const [name, version] of Object.entries(pkg.dependencies)) { dependencies.push({ name, version: version as string, type: 'dependency', source: 'package.json', }); } } // Add dev dependencies if (pkg.devDependencies) { for (const [name, version] of Object.entries(pkg.devDependencies)) { dependencies.push({ name, version: version as string, type: 'devDependency', source: 'package.json', }); } } // Add peer dependencies if (pkg.peerDependencies) { for (const [name, version] of Object.entries(pkg.peerDependencies)) { dependencies.push({ name, version: version as string, type: 'peerDependency', source: 'package.json', }); } } } catch (error) { // package.json not found, continue with other dependency files } // Check for requirements.txt try { const requirementsTxt = await this.getFileContent(url, 'requirements.txt'); const lines = requirementsTxt.split('\n').filter(line => line.trim() && !line.startsWith('#')); for (const line of lines) { const match = line.match(/^([^=><]+)([=><]=?.*)?$/); if (match) { dependencies.push({ name: match[1].trim(), version: match[2] || '*', type: 'dependency', source: 'requirements.txt', }); } } } catch (error) { // requirements.txt not found } // Add more dependency file parsers as needed (Gemfile, Cargo.toml, etc.) } catch (error: any) { console.error('Error analyzing dependencies:', error.message); } return dependencies; }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TheAlchemist6/codecompass-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server