Skip to main content
Glama
damian-pramparo

Enterprise Code Search MCP Server

Enterprise Code Search MCP Server

A powerful Model Context Protocol (MCP) server for semantic code search with shared vector database. Supports both OpenAI and Ollama for embeddings, and can index local projects or Git repositories.

šŸš€ Features

  • Semantic code search using AI embeddings

  • Dual provider support: OpenAI or Ollama (local, private)

  • Flexible indexing: Local projects or Git repositories

  • Shared vector database with ChromaDB

  • Multi-project management: Handle multiple projects simultaneously

  • Automatic project structure analysis

  • Similar code search based on code snippets

  • Enterprise-ready: Private, secure, self-hosted

Related MCP server: MCP Codebase Index

šŸ“‹ Requirements

  • Node.js 18+

  • Docker and Docker Compose

  • Git (for repository indexing)

šŸ› ļø Quick Start

1. Clone the repository

git clone https://github.com/your-username/semantic-context-mcp.git
cd semantic-context-mcp

2. Install dependencies

npm install

3. Configure environment

cp .env.example .env
# Edit .env with your configuration

4. Start services

# Start ChromaDB and Ollama
docker-compose up -d

# Wait for Ollama to download models
docker-compose logs -f ollama-setup

5. Build and run

npm run build
npm start

āš™ļø Configuration

# .env
EMBEDDING_PROVIDER=ollama
OLLAMA_HOST=http://localhost:11434
OLLAMA_MODEL=nomic-embed-text
CHROMA_HOST=localhost
CHROMA_PORT=8000

Using OpenAI

# .env
EMBEDDING_PROVIDER=openai
OPENAI_API_KEY=your-api-key
OPENAI_MODEL=text-embedding-3-small

šŸ”§ Claude Desktop Integration

To use this MCP server with Claude Desktop, add to your claude_desktop_config.json:

{
  "mcpServers": {
    "enterprise-code-search": {
      "command": "node",
      "args": ["/path/to/semantic-context-mcp/dist/index.js"],
      "env": {
        "EMBEDDING_PROVIDER": "ollama",
        "OLLAMA_HOST": "http://localhost:11434",
        "OLLAMA_MODEL": "nomic-embed-text",
        "CHROMA_HOST": "localhost",
        "CHROMA_PORT": "8000",
        "COMPANY_NAME": "YourCompany"
      }
    }
  }
}

šŸŽÆ Usage Examples

1. Index a local project

Index my local project at /home/user/my-app with the name "frontend-app"

2. Search in code

Search for "main application function" in all indexed projects

3. Find similar code

Find code similar to:
```python
def authenticate_user(username, password):
    return check_credentials(username, password)

4. Analyze project structure

Analyze the structure of project "frontend-app"

šŸ› ļø Available Tools

Tool

Description

index_local_project

Index a local directory

search_codebase

Semantic search in code

list_indexed_projects

List all indexed projects

get_embedding_provider_info

Get embedding provider information

šŸ“Š Example Queries

Functional searches

  • "Where is the authentication logic?"

  • "Functions that handle database operations"

  • "Environment variable configuration"

  • "Unit tests for the API"

Code analysis

  • "What design patterns are used?"

  • "Most complex functions in the project"

  • "Error handling in the code"

  • "Code using React hooks"

  • "PostgreSQL queries"

  • "Docker configuration"

šŸ”§ Advanced Configuration

# For code embeddings
ollama pull nomic-embed-text    # Best for code (384 dims)
ollama pull all-minilm         # Lightweight alternative (384 dims)
ollama pull mxbai-embed-large  # Higher precision (1024 dims)

File Patterns

The server supports extensive file type recognition including:

  • Programming Languages: Python, JavaScript/TypeScript, Java, C/C++, Go, Rust, PHP, Ruby, Swift, Kotlin, Scala, and more

  • Web Technologies: HTML, CSS, SCSS, Vue, Svelte

  • Configuration: JSON, YAML, TOML, Docker, Terraform

  • Documentation: Markdown, reStructuredText, AsciiDoc

  • Database: SQL files

Performance Tuning

# Maximum chunk size (characters)
MAX_CHUNK_SIZE=1500

# Maximum file size (KB)
MAX_FILE_SIZE=500

# Batch size for indexing
BATCH_SIZE=100

šŸ¢ Enterprise Deployment

Option 1: Dedicated Server

# On enterprise server
docker-compose up -d

Option 2: Network Deployment

# Configure for network access
CHROMA_HOST=192.168.1.100
OLLAMA_HOST=http://192.168.1.100:11434

šŸ”’ Security Considerations

Key Benefits

  1. Private Data: Ollama keeps everything local

  2. No External APIs: When using Ollama, no data leaves your network

  3. Self-hosted: Full control over your code and embeddings

  4. Isolated Environment: Docker containers provide isolation

Security Best Practices

# Restrict ChromaDB access
CHROMA_SERVER_HOST=127.0.0.1  # Localhost only

# Use HTTPS for production
OLLAMA_HOST=https://ollama.company.com

šŸ“ˆ Monitoring & Troubleshooting

Useful Logs

# View indexing logs
docker-compose logs -f enterprise-mcp-server

# ChromaDB performance
docker-compose logs -f chromadb

# Monitor Ollama
curl http://localhost:11434/api/tags

Common Issues

Ollama not responding:

curl http://localhost:11434/api/tags
# If it fails: docker-compose restart ollama

ChromaDB slow:

# Check disk space
docker system df
# Clean if necessary
docker system prune

Poor embedding quality:

  • Try different model: all-minilm vs nomic-embed-text

  • Adjust chunk size

  • Verify source file quality

šŸ¤ Collaborative Workflow

Typical Enterprise Workflow

  1. DevOps indexes main projects

  2. Developers search code using Claude

  3. Automatic updates via CI/CD

  4. Code analysis for code reviews

Best Practices

  • Index after important merges

  • Use descriptive project names

  • Maintain project-specific search filters

  • Document naming conventions

šŸ› ļø Development

Project Structure

src/
ā”œā”€ā”€ index.ts          # Main MCP server
└── http-server.ts    # HTTP server variant

scripts/              # Setup and utility scripts
docker-compose.yml    # Service orchestration
package.json         # Dependencies and scripts

Available Scripts

npm run build        # Compile TypeScript
npm run dev          # Development mode
npm run start        # Production mode
npm run clean        # Clean build directory

šŸ“š API Reference

The MCP server implements the standard Model Context Protocol with these specific tools:

  • index_local_project: Index local directories with configurable file patterns

  • search_codebase: Semantic search with project filtering and similarity scoring

  • list_indexed_projects: Enumerate all indexed projects with metadata

  • get_embedding_provider_info: Get current provider status and configuration

Each tool includes detailed JSON schema with examples and validation.

For embeddings (Ollama)

  • nomic-embed-text: Optimized for code

  • all-minilm: Balanced, fast

  • mxbai-embed-large: High precision

For embeddings (OpenAI)

  • text-embedding-3-small: Cost-effective

  • text-embedding-3-large: Higher precision

🐳 Docker Support

The project includes a complete Docker setup:

  • ChromaDB: Vector database for embeddings

  • Ollama: Local embedding generation

  • PostgreSQL: Optional metadata storage

All services are orchestrated with Docker Compose for easy deployment.

ā˜• Support

If this project helps you with your development workflow, consider supporting it:

Buy Me A Coffee

šŸ“„ License

MIT License - see LICENSE file for details.

šŸ¤ Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the project

  2. Create your feature branch (git checkout -b feature/AmazingFeature)

  3. Commit your changes (git commit -m 'Add some AmazingFeature')

  4. Push to the branch (git push origin feature/AmazingFeature)

  5. Open a Pull Request

šŸ“ž Support & Issues

Available Tools

4 tools
get_embedding_provider_infoB

Get information about the current embedding provider

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states what the tool does without revealing any traits like whether it's read-only, if it requires authentication, what data it returns (e.g., provider name, configuration details), or potential errors. This leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that directly states the tool's purpose without any unnecessary words or fluff. It's front-loaded with the key action ('Get information'), making it easy to parse quickly. Every word earns its place, resulting in an efficient and well-structured description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a tool that retrieves provider information, the description is incomplete. With no annotations and no output schema, it fails to explain what information is returned (e.g., provider type, settings, status) or any behavioral aspects like error handling. This makes it inadequate for users to fully understand the tool's functionality and output.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and the schema description coverage is 100%, so there are no parameters to document. The description doesn't need to add parameter semantics, and it appropriately avoids mentioning any. This meets the baseline for tools with no parameters, as it doesn't mislead or omit necessary information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('information about the current embedding provider'), making it easy to understand what it does. However, it doesn't differentiate from sibling tools like 'list_indexed_projects' or 'search_codebase', which are unrelated to embedding providers, so it doesn't fully distinguish itself in context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, such as needing an embedding provider to be configured, or specify use cases like checking provider settings before performing operations. Without this context, users might struggle to determine its appropriate application.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

index_local_projectC

Index a local project directory into the vector database

ParametersJSON Schema
NameRequiredDescriptionDefault
exclude_patternsNoFile patterns to exclude (optional)
include_patternsNoFile patterns to include (optional)
project_nameYesName for the project (used as identifier)
project_pathYesAbsolute path to the local project directory

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the action ('index') but lacks critical behavioral details: it doesn't specify if this is a one-time or incremental operation, what happens if the project already exists (overwrite? error?), permission requirements, or any side effects like data persistence or performance impact. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and target, making it easy to understand at a glance. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of indexing a directory (a mutation operation with potential side effects), no annotations, and no output schema, the description is incomplete. It fails to address key contextual aspects like what 'indexing' entails (e.g., file parsing, embedding generation), error handling, or what the tool returns upon success/failure. This leaves significant gaps for an AI agent to use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all four parameters thoroughly. The description adds no additional meaning beyond what's in the schema—it doesn't explain parameter interactions, default behaviors, or usage examples. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('index') and target ('a local project directory into the vector database'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'list_indexed_projects' or 'search_codebase', which are related but serve different purposes (listing vs. indexing vs. searching).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing directory), exclusions (e.g., when not to index), or how it relates to siblings like 'list_indexed_projects' for checking existing indexes or 'search_codebase' for querying after indexing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_indexed_projectsB

List all projects currently indexed

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it's a list operation, implying read-only behavior, but doesn't specify details like pagination, rate limits, or what 'indexed' means in practice. This leaves gaps in understanding how the tool behaves beyond basic listing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words, making it highly concise and front-loaded. It efficiently conveys the core purpose without unnecessary elaboration, which is ideal for this simple tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no parameters, no annotations, and no output schema, the description is minimally adequate by stating what it does. However, it lacks context on behavior (e.g., return format, limitations) and usage relative to siblings, making it incomplete for optimal agent guidance.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate, earning a high score as it doesn't introduce confusion or redundancy.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('projects currently indexed'), making the purpose specific and understandable. However, it doesn't differentiate from sibling tools like 'search_codebase', which might also list projects in some context, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, such as 'search_codebase' for filtered searches or 'index_local_project' for adding projects. There's no mention of prerequisites, exclusions, or context for usage, leaving the agent without clear direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_codebaseC

Search the indexed codebase using semantic search

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

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool performs a 'semantic search' but doesn't explain what that entails (e.g., natural language understanding, relevance scoring), nor does it cover aspects like rate limits, authentication needs, or whether it's read-only (implied but not explicit). This leaves significant gaps for an agent to understand operational behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It is appropriately sized and front-loaded, making it easy for an agent to quickly grasp the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (semantic search with multiple parameters) and the lack of annotations and output schema, the description is insufficient. It doesn't explain what the search returns (e.g., code snippets, file paths), how results are ranked, or any limitations (e.g., indexing requirements). This leaves critical context gaps for effective tool use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with clear documentation for 'query', 'limit', and 'project_filter'. The description adds no additional parameter semantics beyond what's in the schema, such as query format examples or filter usage details. This meets the baseline of 3, as the schema adequately handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('search') and resource ('indexed codebase'), and it specifies the search method ('semantic search'). However, it doesn't explicitly differentiate from sibling tools like 'list_indexed_projects' or 'get_embedding_provider_info', which reduces its score from a perfect 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to prefer 'search_codebase' over 'list_indexed_projects' for browsing projects or 'get_embedding_provider_info' for understanding search capabilities, nor does it specify prerequisites like needing an indexed codebase first.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A3.5/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose with no overlap: get_embedding_provider_info retrieves configuration details, index_local_project handles indexing, list_indexed_projects enumerates existing projects, and search_codebase performs semantic queries. The descriptions clearly differentiate between setup, management, and query operations.

Naming Consistency5/5

All tools follow a consistent verb_noun naming pattern (e.g., get_embedding_provider_info, index_local_project, list_indexed_projects, search_codebase). The verbs (get, index, list, search) are appropriately descriptive and maintain a uniform snake_case style throughout.

Tool Count5/5

With 4 tools, this server is well-scoped for enterprise code search, covering essential operations: provider info retrieval, indexing, project listing, and semantic search. Each tool earns its place without redundancy, making the set manageable and focused on core functionality.

Completeness4/5

The toolset covers the primary workflows for code search: setup (get provider info), ingestion (index projects), management (list projects), and querying (search). A minor gap exists in update/delete operations for indexed projects (e.g., reindexing or removal), but agents can likely work around this with the provided tools.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides semantic code search capabilities that run 100% locally using EmbeddingGemma embeddings. Enables finding code by meaning across 15 file extensions and 9+ programming languages without API costs or sending code to the cloud.
    236
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables semantic search across your codebase using Google's Gemini embeddings and Qdrant Cloud vector storage. Supports 15+ programming languages with smart code chunking and real-time file change monitoring.
    28
    19
    MIT
  • A
    license
    A
    quality
    F
    maintenance
    Provides intelligent semantic code search using local AI embeddings, enabling natural language queries to find relevant code by meaning rather than exact keywords. Indexes codebases in the background with smart project detection and privacy-first local processing.
    6
    39
    199
    MIT

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