A Model Context Protocol (MCP) server that provides context optimization tools for AI coding assistants including GitHub Copilot, Cursor AI, Claude Desktop, and other MCP-compatible assistants enabling them to extract targeted information rather than processing large terminal outputs and files wasting their context.
git clone https://github.com/malaksedarous/context-optimizer-mcp-server.gitA Model Context Protocol (MCP) server that provides context optimization tools for AI coding assistants including GitHub Copilot, Cursor AI, Claude Desktop, and other MCP-compatible assistants enabling them to extract targeted information rather than processing large terminal outputs and files wasting their context.
[{"step":"Install and configure the context-optimizer-mcp-server in your MCP-compatible environment (GitHub Copilot, Cursor AI, or Claude Desktop).","action":"Follow the server's installation guide to set up the MCP connection. Ensure your IDE or terminal has access to the repository you want to analyze."},{"step":"Specify your target information using the prompt template. Replace [TARGET_INFORMATION] with what you need (e.g., 'error handling logic', 'API endpoints', 'database schema').","action":"Be specific about what you're looking for. For example: 'Find all error handling patterns in the authentication module' or 'Extract the database schema for the orders table'."},{"step":"Run the optimized context extraction and review the structured output.","action":"The server will return context in JSON format with relevant functions, variables, and recent changes. Use this as input for your AI coding assistant to ensure it focuses on the right parts of your codebase."},{"step":"Iterate with follow-up queries if needed. Use the output to refine your next query.","action":"If the initial output is too broad, add more specific criteria like 'only functions that handle 404 errors' or 'variables declared in the last 30 days'."},{"step":"Integrate the optimized context into your development workflow.","action":"Paste the output directly into your AI coding assistant's context window or save it as a reference file. This prevents the assistant from wasting context on irrelevant code."}]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/malaksedarous/context-optimizer-mcp-serverCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Use the context-optimizer-mcp-server to extract the most relevant [TARGET_INFORMATION] from [SOURCE]. Focus on [SPECIFIC_CRITERIA] and ignore unrelated noise. Return only the optimized context in a structured format suitable for direct use by an AI coding assistant.
```json
{
"relevant_functions": [
{
"name": "calculateTax",
"file": "src/utils/taxCalculator.js",
"lines": "12-25",
"description": "Computes tax based on income brackets and deductions",
"parameters": ["income", "deductions", "filingStatus"],
"return_type": "number"
},
{
"name": "applyDiscount",
"file": "src/services/orderService.js",
"lines": "45-60",
"description": "Applies percentage discount to order total",
"parameters": ["orderId", "discountPercent"],
"return_type": "Promise<Order>"
}
],
"key_variables": [
{
"name": "TAX_BRACKETS",
"file": "src/constants/taxConstants.js",
"value": "{ 'single': [0, 10275, 0.1], 'married': [0, 20550, 0.12] }",
"usage": "Referenced in calculateTax function"
}
],
"recent_changes": [
{
"file": "src/models/User.js",
"change": "Added 'lastLogin' field to track user activity",
"date": "2024-05-15",
"author": "dev-team"
}
]
}
```
The optimized context above was extracted from a 500-line repository containing 47 files. The MCP server identified 2 relevant functions, 1 key constant, and 1 recent change that directly relate to tax calculation and order processing - the exact areas the user was debugging. By filtering out 95% of the repository's content, the AI coding assistant can now focus its context on these critical elements rather than processing irrelevant files like configuration settings, test suites, or documentation.The AI Code Editor for productive developers
Let’s build from here, together
Unlock data insights with interactive dashboards and collaborative analytics capabilities.
We create engaging workshops for companies and private events centred around plants, flowers and all things botanical.
AI assistant built for thoughtful, nuanced conversation
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan