Skip to main content
Glama
damian-pramparo

Enterprise Code Search MCP Server

search_codebase

Search enterprise codebases using semantic AI to find relevant code snippets across local projects and Git repositories based on natural language queries.

Instructions

Search the indexed codebase using semantic search

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of results
project_filterNoFilter by specific project name
queryYesSearch query

Implementation Reference

  • The core handler function that executes the 'search_codebase' tool. Performs semantic search query on ChromaDB vector store, handles project filtering, formats results with similarity scores, file metadata, and code snippets in Markdown.
    async searchCodebase(args: { query: string; limit?: number; project_filter?: string; }) { const { query, limit = 10, project_filter } = args; const collection = await this.getOrCreateCollection(); let whereClause: any = {}; if (project_filter) { whereClause.project_id = { "$eq": project_filter }; } const results = await collection.query({ queryTexts: [query], nResults: limit, where: Object.keys(whereClause).length > 0 ? whereClause : undefined }); if (!results.documents[0] || results.documents[0].length === 0) { return { content: [ { type: "text", text: "No results found for your query." } ] }; } const formattedResults = results.documents[0] .map((doc, i) => { const metadata = results.metadatas?.[0]?.[i] as any; const distance = results.distances?.[0]?.[i] || 0; const similarity = (1 - distance).toFixed(3); return `## Result ${i + 1} (Similarity: ${similarity})\n` + `**File:** ${metadata?.file_path}\n` + `**Project:** ${metadata?.project_name}\n\n` + `\`\`\`${metadata?.file_type}\n${doc}\n\`\`\`\n`; }) .join('\n---\n\n'); return { content: [ { type: "text", text: `Found ${results.documents[0].length} results for: "${query}"\n\n${formattedResults}` } ] }; }
  • Input schema definition for the 'search_codebase' tool, specifying parameters: query (required string), limit (optional number, default 10), project_filter (optional string).
    inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query" }, limit: { type: "number", description: "Maximum number of results", default: 10 }, project_filter: { type: "string", description: "Filter by specific project name" } }, required: ["query"] }
  • src/index.ts:64-86 (registration)
    Registration of the 'search_codebase' tool in the ListTools response, including name, description, and input schema.
    { name: "search_codebase", description: "Search the indexed codebase using semantic search", inputSchema: { type: "object", properties: { query: { type: "string", description: "Search query" }, limit: { type: "number", description: "Maximum number of results", default: 10 }, project_filter: { type: "string", description: "Filter by specific project name" } }, required: ["query"] } },
  • src/index.ts:114-115 (registration)
    Dispatch/registration in the CallToolRequestSchema handler switch statement, routing tool calls to the searchCodebase method.
    case "search_codebase": return await this.searchCodebase(args as any);

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/damian-pramparo/semantic-context-mcp'

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