Portable MCP Toolkit
Provides AI-powered code intelligence for any codebase using local LLMs and vector search, enabling semantic code search, pattern analysis, and context-optimized code generation with 90% token savings.
README
<div align="center">
π AIStack-MCP
Enterprise-Grade MCP Orchestration for Modern Development
Dual-mode MCP orchestration that solves the isolation vs. coordination dilemmaβlocal-first, production-ready, and 90% cheaper than cloud-only approaches.
</div>
π‘ Why This Matters
The Problem: MCP servers require careful isolation for security, but modern development often spans multiple repositories. You're forced to choose between safe isolation (one repo at a time) or productivity (cross-repo intelligence).
The Solution: AIStack-MCP provides dual-mode orchestrationβswitch between isolated single-repo mode and coordinated multi-repo mode with a single command. Get the best of both worlds.
Key Differentiators
| What Makes This Different | Why It Matters |
|---|---|
| π One-command mode switching | Switch context in seconds, not minutes |
| ποΈ 2025 proven patterns | Git multi-repo support, MCP coordination |
| π Production-ready security | Workspace isolation, explicit permissions |
| π° 90% cost reduction | Local LLM + vector search = FREE intelligence |
| β Enterprise validation | CI-ready scripts, health checks, monitoring |
π Table of Contents
- β¨ Features
- ποΈ Architecture
- π Quick Start
- π¦ Installation
- π Operating Modes
- π Usage Guide
- π Project Structure
- π οΈ Tools Reference
- β‘ Performance & Cost
- π§ Troubleshooting
- β FAQ
- π Advanced Topics
- πΊοΈ Roadmap
- π€ Contributing
- π License
β¨ Features
Core Capabilities
| Feature | Description |
|---|---|
| π Single-Repo Isolation | Portable ${workspaceFolder} configs, maximum security, per-project permissions |
| π Multi-Repo Orchestration | Cross-repo semantic search, unified context, CORE workspace coordination |
| β‘ One-Command Switching | switch_to_single_repo.ps1 / switch_to_multi_repo.ps1 with automatic validation |
| π©Ί Health Monitoring | Real-time service checks, dependency validation, configuration verification |
| π§ Local-First AI | Ollama (LLM inference) + Qdrant (vector search) = 100% local, 100% private |
| π° 90% Cost Reduction | Pre-process with local AI, send only compressed context to Claude |
| π Universal Compatibility | Works with Python, TypeScript, Rust, Go, Javaβany language, any framework |
Developer Experience
| Feature | Description |
|---|---|
| π§ Interactive Setup Wizard | quickstart.ps1 guides new users through complete setup |
| π CI-Ready Validation | validate_mcp_config.py with --strict mode for zero-warning builds |
| π Dev Environment Dashboard | dev_all.ps1 shows service status, models, collections at a glance |
| π Comprehensive Documentation | Troubleshooting guides, best practices, real-world examples |
| π Production-Tested Patterns | Battle-tested configurations from enterprise deployments |
ποΈ Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β YOUR CODEBASE β
β (Any Language β’ Any Framework β’ Any Size) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AISTACK-MCP ORCHESTRATION LAYER β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββββββ β
β β Filesystem β β Git β β Code Intelligence β β
β β MCP β β MCP β β MCP β β
β β (Read/Write) β β (History/Diff) β β (Search/Analyze) β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββββββ β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Mode Orchestrator: Single-Repo ββ Multi-Repo Switching β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LOCAL AI STACK (FREE) β
β β
β βββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββ β
β β OLLAMA β β QDRANT β β
β β β’ LLM Inference β β β’ Vector Search β β
β β β’ Pattern Analysis β β β’ Semantic Indexing β β
β β β’ Code Generation β β β’ 90% Token Compression β β
β βββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CURSOR + CLAUDE β
β (Final Generation Only β’ Minimal Token Usage) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Data Flow & Cost Savings
- You ask a question β Cursor receives your prompt
- Local search first β Qdrant finds relevant code chunks (FREE)
- Local compression β Ollama summarizes context (FREE)
- Minimal transmission β Only 500-1000 tokens sent to Claude
- Final generation β Claude generates with full understanding
Result: 90% fewer tokens, same quality, 100% privacy for local processing.
π Quick Start
Path 1: New Users (Recommended)
# Clone and run the interactive wizard
git clone https://github.com/mjdevaccount/AIStack-MCP.git
cd AIStack-MCP
.\scripts\quickstart.ps1
The wizard automatically:
- β Checks all dependencies
- β Guides mode selection
- β Configures services
- β Validates setup
Path 2: Experienced Users
<details> <summary>π Click to expand manual setup</summary>
# 1. Clone repository
git clone https://github.com/mjdevaccount/AIStack-MCP.git
cd AIStack-MCP
# 2. Install Python dependencies
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
# 3. Start services
ollama serve # Terminal 1
docker run -d -p 6333:6333 qdrant/qdrant # Terminal 2
# 4. Pull required models
ollama pull mxbai-embed-large
ollama pull qwen2.5:7b
# 5. Configure mode
.\scripts\switch_to_single_repo.ps1
# 6. Open in Cursor
cursor .
</details>
Path 3: CI/CD Integration
# .github/workflows/validate.yml
- name: Validate MCP Configuration
run: |
python scripts/validate_mcp_config.py --test-generation --strict
π Community Tools (v1.2.0)
Browse 500+ MCP Servers
Search for tools
.\scripts\list_registry_tools.ps1 -Search "database"
Popular servers
.\scripts\list_registry_tools.ps1 -Popular
Install Community Tools
Install PostgreSQL server
.\scripts\install_community_tool.ps1 -ServerId "io.modelcontextprotocol/server-postgres"
Install Slack integration
.\scripts\install_community_tool.ps1 -ServerId "io.modelcontextprotocol/server-slack"
Apply Templates
Minimal (search only)
.\scripts\apply_template.ps1 -Template minimal
Standard (recommended)
.\scripts\apply_template.ps1 -Template standard
Full (all features)
.\scripts\apply_template.ps1 -Template full
See Registry Documentation for full guide.
π¦ Installation
System Requirements
| Requirement | Minimum | Recommended |
|---|---|---|
| OS | Windows 10 | Windows 11 |
| Python | 3.8 | 3.11+ |
| Node.js | 18.x | 20.x LTS |
| RAM | 8 GB | 16 GB |
| Disk | 10 GB | 20 GB (for models) |
| Docker | Optional | Recommended |
Step 1: Prerequisites
# Install Node.js (for MCP community servers)
winget install OpenJS.NodeJS
# Install Python (if not present)
winget install Python.Python.3.11
# Verify installations
node --version # Should show v18+
python --version # Should show 3.8+
Step 2: Python Dependencies
cd C:\AIStack-MCP
# Create virtual environment
python -m venv .venv
.\.venv\Scripts\Activate.ps1
# Install dependencies
pip install -r requirements.txt
Step 3: Local AI Services
<details> <summary>π¦ Ollama Setup</summary>
- Download from ollama.ai
- Install and start the service
- Pull required models:
ollama pull mxbai-embed-large # Required: embeddings
ollama pull qwen2.5:7b # Recommended: analysis
ollama pull phi4:14b # Optional: code generation
- Verify:
ollama list
</details>
<details> <summary>π Qdrant Setup</summary>
Option A: Docker (Recommended)
docker run -d -p 6333:6333 -v qdrant_storage:/qdrant/storage qdrant/qdrant
Option B: Native Installation
- Download from qdrant.tech
Verify:
curl http://localhost:6333/collections
</details>
Step 4: Configuration
# Run the quickstart wizard (recommended)
.\scripts\quickstart.ps1
# Or manually configure single-repo mode
.\scripts\switch_to_single_repo.ps1
π‘ Tip: If Cursor hangs on startup, ensure you're using the
cmd /cwrapper pattern. See Windows MCP Fix.
π Operating Modes
Mode Comparison
| Feature | Single-Repo Mode | Multi-Repo Mode |
|---|---|---|
| Isolation | β Maximum (per-repo) | β οΈ Shared (CORE access) |
| Portability | β
${workspaceFolder} |
β Relative paths |
| Security | β Explicit permissions | β οΈ CORE has all access |
| Cross-repo search | β One repo only | β All linked repos |
| Setup complexity | β Simple | ββ Requires linking |
| Best for | Focused work, security | Multi-package, microservices |
Switching Modes
# Switch to single-repo (isolated, portable)
.\scripts\switch_to_single_repo.ps1
# Switch to multi-repo (orchestrated)
.\scripts\switch_to_multi_repo.ps1
# Check current mode
Get-Content .cursor\ACTIVE_MODE.txt
Multi-Repo Setup
# 1. Link repositories (requires Admin for symlinks)
.\scripts\link_repo.ps1 -TargetPath "C:\Projects\backend-api"
.\scripts\link_repo.ps1 -TargetPath "C:\Projects\frontend-app"
# 2. Or clone directly (no Admin required)
.\scripts\link_repo.ps1 -TargetPath "https://github.com/org/repo" -Clone
# 3. Activate multi-repo mode
.\scripts\switch_to_multi_repo.ps1
# 4. Restart Cursor
π Usage Guide
Scenario 1: First-Time Setup
# 1. Run quickstart wizard
.\scripts\quickstart.ps1
# 2. Open project in Cursor
cursor C:\AIStack-MCP
# 3. In Cursor chat, index your workspace
Use code-intelligence to index_workspace
# 4. Verify setup
Use code-intelligence to validate_workspace_config
Expected Output:
β
Workspace: C:\AIStack-MCP (accessible)
β
Ollama: Connected (3 models available)
β
Qdrant: Connected (1 collection indexed)
β
Configuration: Valid
Scenario 2: Daily Development
# Semantic search (find code by meaning)
Use code-intelligence to semantic_search for "error handling patterns"
# Pattern analysis (extract patterns with LLM)
Use code-intelligence to analyze_patterns for "async"
# Get optimized context for a file
Use code-intelligence to get_context for src/utils.py with task "add retry logic"
# Generate code matching project style
Use code-intelligence to generate_code for src/api.py with task "add pagination"
Scenario 3: Multi-Repo Development
# Morning: Link all related repos
.\scripts\link_repo.ps1 -TargetPath "C:\Projects\shared-libs"
.\scripts\link_repo.ps1 -TargetPath "C:\Projects\backend"
.\scripts\link_repo.ps1 -TargetPath "C:\Projects\frontend"
# Activate multi-repo mode
.\scripts\switch_to_multi_repo.ps1
# Now in Cursor: search across ALL linked repos
Use code-intelligence to semantic_search for "authentication flow"
Scenario 4: Team Onboarding
Share these commands with new team members:
# Complete setup in one command
git clone https://github.com/your-org/AIStack-MCP.git
cd AIStack-MCP
.\scripts\quickstart.ps1
Reference: docs/BEST_PRACTICES.md
π Project Structure
AIStack-MCP/
βββ .cursor/
β βββ mcp.json # π― Active MCP configuration
β βββ ACTIVE_MODE.txt # π Current mode indicator
β
βββ docs/
β βββ WORKSPACE_PATTERN.md # π Isolation best practices
β βββ BEST_PRACTICES.md # π₯ Team usage guidelines
β βββ SETUP.md # π Detailed setup guide
β βββ troubleshooting/ # π§ Platform-specific fixes
β βββ WINDOWS_MCP_FIX.md
β βββ MCP_TROUBLESHOOTING.md
β
βββ scripts/
β βββ quickstart.ps1 # π Interactive setup wizard
β βββ switch_to_single_repo.ps1 # π Activate isolated mode
β βββ switch_to_multi_repo.ps1 # π Activate orchestration mode
β βββ link_repo.ps1 # π Repository linking helper
β βββ validate_mcp_config.py # β
CI-ready validation
β βββ validate_workspace.py # π©Ί Workspace diagnostics
β βββ dev_all.ps1 # π Dev environment status
β βββ mcp_config_builder.py # ποΈ Config generator
β
βββ workspaces/ # π Multi-repo links (gitignored)
β βββ README.md
β
βββ python_agent/ # π€ Agent implementation
β βββ agents/
β βββ tools/
β βββ mcp_production_server.py
β
βββ mcp_intelligence_server.py # π§ Main MCP server
βββ requirements.txt # π¦ Python dependencies
βββ docker-compose.yml # π³ Service orchestration
βββ README.md # π You are here
π οΈ Tools Reference
Available MCP Tools
| Tool | Description | Example | Cost |
|---|---|---|---|
semantic_search |
Find code by meaning using vector similarity | semantic_search for "retry logic" |
FREE |
analyze_patterns |
Extract patterns using local LLM | analyze_patterns for "error handling" |
FREE |
get_context |
Get optimized context for a task | get_context for utils.py |
FREE |
generate_code |
Generate code matching project style | generate_code for api.py |
FREE |
index_workspace |
Build vector index (run once) | index_workspace |
FREE |
validate_workspace_config |
Health check and diagnostics | validate_workspace_config |
FREE |
When to Use Each Tool
| Task | Recommended Tool | Why |
|---|---|---|
| "Where is X implemented?" | semantic_search |
Finds by meaning, not exact text |
| "What patterns exist for Y?" | analyze_patterns |
LLM extracts and summarizes |
| "I need to modify file Z" | get_context |
Provides optimized context |
| "Add feature to file W" | generate_code |
Matches existing style |
| "Is my setup correct?" | validate_workspace_config |
Comprehensive diagnostics |
β‘ Performance & Cost
Real-World Metrics
| Metric | Without AIStack | With AIStack | Improvement |
|---|---|---|---|
| Tokens per request | 50,000 | 5,000 | 90% reduction |
| Monthly API cost | $100-150 | $20 | $80-130 saved |
| Search latency | N/A | <100ms | Instant results |
| Context accuracy | Variable | Optimized | Better responses |
| Data privacy | Cloud-processed | Local-first | 100% private |
Cost Breakdown
WITHOUT AISTACK-MCP:
βββ Cursor reads 5,000 tokens/file
βββ 10 files per request = 50,000 tokens
βββ ~100 requests/day = 5M tokens
βββ Monthly cost: $100-150
WITH AISTACK-MCP:
βββ Local search finds relevant code (FREE)
βββ Local LLM compresses to 500 tokens (FREE)
βββ Only compressed context sent to Claude
βββ Monthly cost: ~$20 (Cursor subscription only)
SAVINGS: $80-130/month per developer
Memory Footprint
| Component | Memory Usage |
|---|---|
| Ollama (idle) | ~500 MB |
| Ollama (inference) | 4-8 GB |
| Qdrant | ~200 MB |
| MCP Servers | ~100 MB total |
π§ Troubleshooting
Issue: Cursor Crashes or Hangs on Startup (Windows)
Symptoms: Cursor freezes when MCP servers start, or crashes immediately.
Cause: Windows STDIO transport incompatibility with Python.
Solution:
// Use cmd /c wrapper in .cursor/mcp.json
{
"command": "cmd",
"args": ["/c", "python", "..."]
}
Verification: .\scripts\switch_to_single_repo.ps1 generates correct config.
Issue: MCP Servers Not Appearing
Symptoms: No MCP tools available in Cursor chat.
Cause: Cursor didn't load the configuration.
Solution:
- Restart Cursor completely (close all windows)
- Check
.cursor/mcp.jsonexists - View logs: Help β Toggle Developer Tools β Console
Verification:
python scripts\validate_mcp_config.py
Issue: Semantic Search Returns Empty
Symptoms: semantic_search returns no results.
Cause: Workspace not indexed.
Solution:
Use code-intelligence to index_workspace
Verification: Check Qdrant collections at http://localhost:6333/dashboard
Issue: Ollama Connection Failed
Symptoms: "Cannot connect to Ollama" errors.
Cause: Ollama service not running.
Solution:
# Start Ollama
ollama serve
# Verify
ollama list
Issue: Mode Switch Not Taking Effect
Symptoms: Config changes don't apply.
Cause: Cursor caches MCP configuration.
Solution:
- Run
.\scripts\switch_to_*.ps1 - Completely restart Cursor (not just reload)
- Check
.cursor/ACTIVE_MODE.txt
β FAQ
<details> <summary><strong>How is this different from GitHub Copilot?</strong></summary>
Copilot provides inline completions. AIStack-MCP provides:
- Semantic search across your entire codebase
- Pattern analysis using local LLMs
- Cross-repo intelligence in multi-repo mode
- 90% cost reduction through local preprocessing
- 100% privacy for local processing
They complement each otherβuse both! </details>
<details> <summary><strong>Why local-first instead of cloud-only?</strong></summary>
- Cost: Local LLM inference is FREE
- Privacy: Code never leaves your machine for search/analysis
- Speed: Vector search is <100ms vs. network latency
- Availability: Works offline once indexed </details>
<details> <summary><strong>Can I use this with VS Code?</strong></summary>
Currently optimized for Cursor IDE. VS Code support is on the roadmap (v1.1). </details>
<details> <summary><strong>What languages are supported?</strong></summary>
All of them! The system works with any text-based code:
- Python, JavaScript, TypeScript
- Rust, Go, Java, C#, C++
- Ruby, PHP, Swift, Kotlin
- And more... </details>
<details> <summary><strong>Is this production-ready?</strong></summary>
Yes. AIStack-MCP includes:
- CI-ready validation scripts
- Comprehensive error handling
- Health monitoring
- Production-tested configurations
- Enterprise security patterns </details>
<details> <summary><strong>What about security?</strong></summary>
- Single-repo mode: Maximum isolation, per-project permissions
- Multi-repo mode: Explicit linking required, CORE workspace controlled
- Local processing: Sensitive code never leaves your machine
- Audit trail:
.cursor/ACTIVE_MODE.txttracks mode changes
See docs/BEST_PRACTICES.md for security guidelines. </details>
<details> <summary><strong>Can teams use this?</strong></summary>
Absolutely! Share the repository and have team members run:
.\scripts\quickstart.ps1
See docs/BEST_PRACTICES.md for team workflows. </details>
<details> <summary><strong>How do I update to new versions?</strong></summary>
git pull origin main
pip install -r requirements.txt --upgrade
.\scripts\switch_to_single_repo.ps1 # Regenerate config
</details>
π Advanced Topics
1. Multi-Repo Orchestration Patterns
When to use multi-repo mode:
- Python multi-package projects
- Microservices architecture
- Monorepo-style development with separate repos
Linking strategies:
- Symlinks: Best for local development (requires Admin)
- Clones: No Admin required, independent copies
- Submodules: Version-controlled links
2. CI/CD Integration
# .github/workflows/validate.yml
name: Validate MCP Config
on: [push, pull_request]
jobs:
validate:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: pip install -r requirements.txt
- run: python scripts/validate_mcp_config.py --test-generation --strict
3. Custom Tool Development
Extend mcp_intelligence_server.py:
@mcp.tool()
async def my_custom_tool(query: str) -> str:
"""Your custom tool description."""
# Implementation
return result
4. Team Workflows
Decision tree for mode selection:
Working on ONE repo? β Single-repo mode
Working on 2-5 related repos? β Multi-repo mode
Working on 6+ repos? β Split into focused workspaces
5. Production Deployment
# docker-compose.yml (included)
services:
qdrant:
image: qdrant/qdrant
ports:
- "6333:6333"
volumes:
- qdrant_storage:/qdrant/storage
πΊοΈ Roadmap
v1.0.0 β Current Release β
- β Dual-mode orchestration (single/multi-repo)
- β Complete validation suite
- β Interactive setup wizard
- β Production-ready patterns
- β Comprehensive documentation
v1.1.0 β Planned
- π² VS Code extension support
- π² Additional LLM backends (Claude local, GPT4All)
- π² Enhanced caching layer
- π² Performance dashboard
v2.0.0 β Future
- π² Optional cloud sync
- π² Team collaboration features
- π² Admin dashboard
- π² Usage analytics
π€ Contributing
We welcome contributions! Here's how to get started:
Reporting Bugs
Open an issue with:
- Clear description of the problem
- Steps to reproduce
- Expected vs. actual behavior
- System information (OS, Python version, etc.)
Feature Requests
Open a discussion to propose new features.
Development Setup
# Fork and clone
git clone https://github.com/YOUR_USERNAME/AIStack-MCP.git
cd AIStack-MCP
# Install dependencies
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
# Run validation
python scripts\validate_mcp_config.py --test-generation
Pull Request Process
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run validation (
python scripts\validate_mcp_config.py --strict) - Commit (
git commit -m 'feat: Add amazing feature') - Push (
git push origin feature/amazing-feature) - Open a Pull Request
Coding Standards
- Python: Follow PEP 8, use Black formatter
- PowerShell: Follow PSScriptAnalyzer rules
- Commits: Use Conventional Commits
π Acknowledgments
This project stands on the shoulders of giants:
- Model Context Protocol β The foundation for AI-IDE integration
- MCP Community Servers β Filesystem, Git, GitHub implementations
- Ollama β Local LLM inference made simple
- Qdrant β High-performance vector search
- Cursor β The AI-first IDE
π Related Projects
- MCP Specification β Protocol documentation
- MCP Servers β Official server implementations
- Ollama β Run LLMs locally
- Qdrant β Vector similarity search
π License
This project is licensed under the MIT License β see the LICENSE file for details.
MIT License
Copyright (c) 2025 AIStack-MCP Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software...
<div align="center">
β Star this repo if it helped you!
Made with β€οΈ for the MCP community
Report Bug Β· Request Feature Β· Documentation
</div>
<!-- This README follows FAANG-grade documentation standards:
- Clear visual hierarchy
- Scannable structure
- Real-world examples
- Comprehensive troubleshooting
- Performance metrics
- Production-ready guidance -->
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Neon Database
MCP server for interacting with Neon Management API and databases