simple-index-mcp
Provides semantic indexing and search of project files using Ollama embeddings, enabling AI agents to index, search, and retrieve context from codebases.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@simple-index-mcpsearch for files related to user authentication"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Simple-Index MCP Server
A Python Model Context Protocol (MCP) server for indexing projects, files, and folders using embeddings. Provides semantic search capabilities to help AI agents understand and navigate your codebase.
Features
Semantic Indexing: Uses embeddings (via Ollama) to create a searchable index of your project files
Single Index File: All indexes are stored in
projectIndex.si(in project root or global location)Incremental Updates: Only re-indexes files that have changed (based on content hash)
Extensible Provider System: Easy to add new embedding providers beyond Ollama
MCP Tools: Exposes powerful tools for indexing, searching, and retrieving context
Related MCP server: codeweave-mcp
Installation
Prerequisites
Python 3.10 or higher
Ollama installed and running locally
nomic-embed-textmodel pulled in Ollama:ollama pull nomic-embed-text
Setup
Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activateInstall dependencies:
pip install "mcp>=1.2.0" aiohttpPlace
simple_index_server.pyin your project directory
Configuration
Claude Desktop Configuration
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"simple-index": {
"command": "python",
"args": [
"/path/to/simple_index_server.py",
"/path/to/your/project"
],
"env": {
"OLLAMA_MODEL": "nomic-embed-text",
"OLLAMA_URL": "http://localhost:11434"
}
}
}
} }
}
} }
### Global Index Mode (Optional)
If you prefer to store the index file in a central location (instead of the project root), set the `SIMPLE_INDEX_ROOT` environment variable.
```json
{
"mcpServers": {
"simple-index": {
"command": "python",
"args": ["/path/to/simple_index_server.py"],
"env": {
"SIMPLE_INDEX_ROOT": "/path/to/central/indexes",
"OLLAMA_MODEL": "nomic-embed-text"
}
}
}
}Alternative Configuration Options
You can also specify the Ollama model and URL as command-line arguments:
{
"mcpServers": {
"simple-index": {
"command": "python",
"args": [
"/path/to/simple_index_server.py",
"/path/to/your/project",
"nomic-embed-text",
"http://localhost:11434"
]
}
}
}Available Tools
1. index_file
Index a single file with embeddings.
Parameters:
file_path(string, required): Path to the file to indexforce(boolean, optional): Force reindexing even if file hasn't changed
Example:
Claude, please index the file /path/to/my/script.py2. index_directory
Index all matching files in a directory recursively.
Parameters:
directory(string, required): Path to directory to indexpatterns(array of strings, optional): File patterns to match (default:["*.py", "*.js", "*.ts", "*.md", "*.txt"])exclude_patterns(array of strings, optional): Patterns to exclude (default:["*/node_modules/*", "*/.git/*", "*/venv/*"])
Example:
Claude, index all Python and JavaScript files in my project, excluding the tests directory3. search
Search for files similar to a query using semantic search.
Parameters:
query(string, required): Search query describing what you're looking fortop_k(integer, optional): Number of results to return (default: 10)
Example:
Claude, search for files related to "database connection logic"4. get_context
Get full file contents for the most relevant files to a query.
Parameters:
query(string, required): Query describing what context you needtop_k(integer, optional): Number of files to include in context (default: 5)
Example:
Claude, get context for "authentication implementation"5. list_indexed_files
List all files currently in the index.
Example:
Claude, show me all indexed files6. get_index_stats
Get statistics about the current index.
Example:
Claude, what are the index statistics?7. remove_file
Remove a file from the index.
Parameters:
file_path(string, required): Path to file to remove from index
Example:
Claude, remove the file /path/to/old/file.py from the indexIndex File Format
The projectIndex.si file is stored in JSON format with the following structure:
{
"version": "1.0",
"created_at": "2026-01-31T10:00:00Z",
"updated_at": "2026-01-31T12:30:00Z",
"project_root": "/path/to/project",
"metadata": {
"total_files": 42,
"total_size": 150000,
"embedding_model": "ollama:nomic-embed-text"
},
"files": {
"src/main.py": {
"path": "src/main.py",
"absolute_path": "/path/to/project/src/main.py",
"hash": "abc123...",
"embedding": [0.1, 0.2, ...],
"indexed_at": "2026-01-31T12:30:00Z",
"size": 1024,
"metadata": {
"extension": ".py",
"name": "main.py"
}
}
}
}Index Management
Atomic Writes: The index is written atomically using a temporary file to prevent corruption
Change Detection: Files are only re-indexed if their content hash changes
Incremental Updates: You can index new files without affecting existing entries
Usage Examples
Initial Project Indexing
You: Claude, index my entire project directory at /Users/me/myproject
Claude: [Uses index_directory tool]
I've indexed your project. Found 45 files, indexed 42, skipped 3 binary files.Searching for Relevant Files
You: Find files related to user authentication
Claude: [Uses search tool]
I found these relevant files:
1. src/auth/login.py (similarity: 0.89)
2. src/middleware/auth_check.py (similarity: 0.85)
3. tests/test_auth.py (similarity: 0.78)Getting Context for Development
You: I need to modify the payment processing logic. Show me the relevant code.
Claude: [Uses get_context tool]
Here's the relevant code from 3 files:
## File 1: src/payments/processor.py (similarity: 0.92)
[Full file contents...]
## File 2: src/payments/validators.py (similarity: 0.87)
[Full file contents...]Checking Index Status
You: What's the status of the index?
Claude: [Uses get_index_stats tool]
Index Statistics:
- Total files: 42
- Total size: 150 KB
- Last updated: 2026-01-31T12:30:00Z
- Embedding model: ollama:nomic-embed-textArchitecture
Components
EmbeddingProvider: Abstract base class for embedding providers
OllamaProvider: Implementation using Ollama APIEasy to extend with OpenAI, Cohere, etc.
ProjectIndex: Manages the
projectIndex.sifileLoading and saving with atomic writes
Adding, removing, and querying files
Computing statistics
SimpleIndexServer: Main MCP server implementation
File reading and hashing
Orchestrating indexing operations
Semantic search functionality
MCP Integration: Standard Model Context Protocol server
Tool registration and handling
STDIO transport for communication
Adding New Embedding Providers
To add a new provider (e.g., OpenAI):
class OpenAIProvider(EmbeddingProvider):
def __init__(self, api_key: str, model: str = "text-embedding-3-small"):
self.api_key = api_key
self.model = model
async def embed(self, text: str) -> List[float]:
# Implementation using OpenAI API
passThen modify the main() function to support the new provider.
Best Practices
Index Regularly: Run indexing after significant code changes
Use Exclude Patterns: Exclude
node_modules,venv, build artifactsSemantic Queries: Use descriptive queries like "error handling for API requests" rather than just "error"
Monitor Index Size: Large projects may need chunking strategies for very large files
Troubleshooting
Ollama Connection Issues
# Check if Ollama is running
curl http://localhost:11434/api/version
# Pull the embedding model if not available
ollama pull nomic-embed-textIndex Corruption
If projectIndex.si becomes corrupted, simply delete it and re-index:
rm projectIndex.si
# Then ask Claude to re-index the directoryLogging
The server uses Python's logging module and writes to stderr (MCP requirement). Check your MCP client's logs for debugging information.
Performance Considerations
Embedding Generation: ~100-500ms per file depending on size
Index Size: ~4KB per file (768-dim embeddings + metadata)
Search Speed: <100ms for typical project sizes (hundreds of files)
License
MIT License - Feel free to use and modify as needed.
Contributing
This is a reference implementation. Feel free to fork and extend with:
Additional embedding providers
Chunking strategies for large files
Multi-language support
Custom metadata extraction
Integration with other tools
Credits
Built with:
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/asyncDefi/simple-index-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server