AI Optimizer MCP
A multi-task MCP server for AI code optimization and testing that integrates with VSCode/Cursor, CLI tools, and autonomous agents. It provides tools for running tests, generating code improvements, and managing objectives across different environments.
README
AI Optimizer MCP đź§ đź”§ - Multi-Task MCP Server
Développer par Barack Ndenga ♥️
Détails
Multi-tâche MCP Server pour VSCode/Cursor, CLI, agents autonomes. Optimisation code IA + tests + extensible.
- Transports: Stdio (VSCode), subprocess, HTTP (futur)
- Use Cases: VSCode chat, agent loops, CI/CD, remote servers
- Sécurité: Env vars, sandbox exec
Manifeste (Multi-Task Capabilities)
- 🛠️ 3+ Tools: Code test/optimize/objective (+extensibles)
- 🔌 VSCode/Cursor: mcp.json natif
- 🖥️ CLI Standalone:
ai-optimizer-mcp run - 🤖 Agents: examples/agent.py loop
- ⚙️ Multi-Env: Local/dev/prod via .env
- 📊 Memory/History: JSON persistent
- 🔄 Boucles Itératives: Auto-improve
Configuration Multi-Plateforme
1. VSCode/Cursor (Recommandé)
Fichier .vscode/mcp.json (multi-servers):
{
"servers": {
"ai-optimizer": {
"command": "python",
"args": ["-m", "ai_optimizer_mcp.server"]
},
"ai-optimizer-dev": {
"command": "python",
"args": ["-m", "ai_optimizer_mcp.cli", "run", "--dev"]
}
}
}
Multi-task: Switch servers en chat!
2. CLI / Scripts / Agents
ai-optimizer-mcp run # Stdio server (pipes)
ai-optimizer-mcp run --dev # Debug
ai-optimizer-mcp --install-mcp # Print mcp.json
3. Agents Autonomes / Subprocess
# examples/agent.py
import asyncio
from mcp.client.stdio import stdio_client
async def agent_loop():
async with stdio_client(command=["python", "-m", "ai_optimizer_mcp.server"]) as client:
# Multi-task calls
score = await client.call_tool("run_tests", {"code_snippet": code})
improved = await client.call_tool("generate_improvement", {"code": code, "test_result": score})
Prérequis (.env)
cp .env.example .env
# OPENAI_API_KEY=sk-...
# OBJECTIVE="Your custom goal"
Usage Multi-Tâche
- VSCode Chat:
use_mcp_tool("ai-optimizer", "run_tests", ...) - CLI Pipe:
echo code | ai-optimizer-mcp run - Agent Loop:
python examples/agent.py - CI/CD: Subprocess dans GitHub Actions/Jenkins
Exemple Réponse Tool:
run_tests → "Tests passed: score=4/4 (f(2)=4)"
generate_improvement → "def f(x): return 2 * x"
Troubleshooting Multi-Env
- VSCode: Reload window après mcp.json
- No API Key: ValueError → Check .env
- Timeout:
TEST_TIMEOUT=10in .env - Memory:
rm memory.json - Logs:
--devouLOG_LEVEL=DEBUG
Développement
pip install -e .[dev]
pre-commit install
pytest
Tools MCP (Extensibles)
| Tool | Args | Use Case |
|---|---|---|
run_tests |
code_snippet: str |
VSCode/CLI test code |
generate_improvement |
code, test_result |
Auto-optimize |
get_objective |
- | Read goal any context |
Apache 2.0 - Multi-task ready! VSCode, CLI, Agents, CI. Contribute!
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.