extras-mcp

A powerful extension for the Model Context Protocol (MCP) that enhances AI development assistance with context awareness, issue tracking, and intelligent tooling recommendations.

GitHub Stars

4

User Rating

Not Rated

Forks

0

Issues

0

Views

2

Favorites

0

README
DevContext: An MCP Extension for Development Context

A powerful extension for the Model Context Protocol (MCP) that enhances AI development assistance with context awareness, issue tracking, and intelligent tooling recommendations.

Features
  • Project Analysis: Automatic detection of project structure and dependencies
  • Command Safety: Validation and normalization of commands across platforms
  • Issue Tracking: Smart tracking of errors and debugging attempts
  • MCP Tools Integration: Intelligent recommendations for development tools
  • Context Management: Sophisticated handling of development context
Installation
npm install mcp-devcontext
Quick Integration Guides
1. Roocode Integration
// Install dependencies
npm install mcp-devcontext @roocode/api

// roocode-integration.ts
import { DevContextClient } from 'mcp-devcontext';
import { RooCodeAPI } from '@roocode/api';

export class RoocodeEnhancer {
  private devContext: DevContextClient;
  private roocode: RooCodeAPI;

  constructor() {
    this.roocode = new RooCodeAPI();
    this.devContext = new DevContextClient({
      async sendMessage(message) {
        return await this.roocode.enhance(message);
      }
    });
  }

  // Enhance Roocode completions with safety checks
  async getCompletion(prompt: string) {
    const suggestion = await this.roocode.getCompletion(prompt);
    const isValid = await this.devContext.validateAISuggestion(suggestion);
    
    if (!isValid) {
      return this.getSafeAlternative(suggestion);
    }
    return suggestion;
  }

  // Add safety checks to code modifications
  async modifyCode(file: string, changes: string) {
    const safetyCheck = await this.devContext.validateAndProcessCommand(
      `modify ${file}`
    );

    if (!safetyCheck.safe) {
      console.warn('Safety warnings:', safetyCheck.warnings);
      return null;
    }

    return await this.roocode.modifyCode(file, changes);
  }

  // Track and handle issues
  async handleError(error: Error) {
    const tracking = await this.devContext.trackError(error);
    console.log('Development hints:', tracking.hints);
    return tracking;
  }
}

// Usage
const enhancer = new RoocodeEnhancer();

// In your Roocode extension
vscode.commands.registerCommand('roocode.enhance', async () => {
  const editor = vscode.window.activeTextEditor;
  if (editor) {
    const document = editor.document;
    const selection = editor.selection;
    const text = document.getText(selection);
    
    try {
      const enhanced = await enhancer.getCompletion(text);
      if (enhanced) {
        editor.edit(editBuilder => {
          editBuilder.replace(selection, enhanced);
        });
      }
    } catch (error) {
      await enhancer.handleError(error);
    }
  }
});
2. Cursor Integration
// Install dependencies
npm install mcp-devcontext @cursor/api

// cursor-integration.ts
import { DevContextClient } from 'mcp-devcontext';
import { CursorAPI } from '@cursor/api';

export class CursorEnhancer {
  private devContext: DevContextClient;
  private cursor: CursorAPI;

  constructor() {
    this.cursor = new CursorAPI();
    this.devContext = new DevContextClient({
      async sendMessage(message) {
        return await this.cursor.enhance(message);
      }
    });
  }

  // Enhance Cursor's code generation
  async generateCode(prompt: string) {
    const generated = await this.cursor.generate(prompt);
    const isValid = await this.devContext.validateAISuggestion(generated);

    if (!isValid) {
      return this.getValidAlternative(generated);
    }
    return generated;
  }

  // Add safety to refactoring operations
  async refactorCode(file: string, refactoring: string) {
    const projectContext = await this.devContext.getProjectContext(
      process.cwd()
    );

    const safetyCheck = await this.devContext.validateAndProcessCommand(
      `refactor ${file}`
    );

    if (!safetyCheck.safe) {
      console.warn('Safety warnings:', safetyCheck.warnings);
      return null;
    }

    return await this.cursor.refactor(file, refactoring);
  }

  // Provide development assistance
  async getAssistance(context: string) {
    const tools = await this.devContext.getToolRecommendations(context);
    return {
      suggestions: await this.cursor.getSuggestions(context),
      tools: tools.recommendations
    };
  }
}

// Usage in Cursor extension
const enhancer = new CursorEnhancer();

// Register with Cursor's command system
cursor.commands.registerCommand('cursor.enhance', async (context) => {
  try {
    const enhanced = await enhancer.generateCode(context.prompt);
    if (enhanced) {
      await context.editor.insert(enhanced);
    }
  } catch (error) {
    const tracking = await enhancer.devContext.trackError(error);
    cursor.window.showErrorMessage(`Error: ${tracking.issue.errorType}`);
  }
});
Quick Start
  1. Install the package:
# For Roocode
npm install mcp-devcontext @roocode/api

# For Cursor
npm install mcp-devcontext @cursor/api
  1. Import and initialize:
// For Roocode
import { RoocodeEnhancer } from './roocode-integration';
const roocode = new RoocodeEnhancer();

// For Cursor
import { CursorEnhancer } from './cursor-integration';
const cursor = new CursorEnhancer();
  1. Start using:
// Roocode example
const enhancedCode = await roocode.getCompletion('Create a React component');

// Cursor example
const generatedCode = await cursor.generateCode('Create an API endpoint');
Features Available in Both Integrations
  • ✅ Code safety validation
  • ✅ Project context awareness
  • ✅ Intelligent tool recommendations
  • ✅ Error tracking and resolution
  • ✅ Performance monitoring
  • ✅ Safe refactoring operations
Configuration
// devcontext.config.ts
module.exports = {
  safety: {
    strictMode: true,
    allowedPaths: ['src/', 'tests/'],
  },
  features: {
    autoFix: true,
    suggestionValidation: true,
    issueTracking: true
  }
};
Support

For issues specific to:

Editor Integration Guides
VS Code Extensions
1. Roocode Integration
// roocode-extension.ts
import { DevContextClient } from 'mcp-devcontext';
import * as vscode from 'vscode';

export class RoocodeDevContextProvider {
  private devContext: DevContextClient;

  constructor(roocodeClient: any) {
    this.devContext = new DevContextClient({
      sendMessage: async (message) => {
        // Convert MCP message to Roocode format
        const roocodeMessage = this.convertToRoocodeFormat(message);
        return await roocodeClient.sendMessage(roocodeMessage);
      }
    });
  }

  // Add to Roocode's command processing
  async processCommand(command: string) {
    const result = await this.devContext.validateAndProcessCommand(command);
    if (!result.safe) {
      vscode.window.showWarningMessage(`Safety warning: ${result.warnings.join(', ')}`);
    }
    return result;
  }

  // Add to Roocode's suggestion handling
  async validateSuggestion(suggestion: string) {
    return await this.devContext.validateAISuggestion(suggestion);
  }
}
2. Cursor Integration
// cursor-extension.ts
import { DevContextClient } from 'mcp-devcontext';

export class CursorDevContextIntegration {
  private devContext: DevContextClient;

  constructor(cursorApi: any) {
    this.devContext = new DevContextClient({
      async sendMessage(message) {
        return await cursorApi.enhance(message);
      }
    });
  }

  // Add to Cursor's completion provider
  async provideCompletions(document: TextDocument, position: Position) {
    const suggestion = await this.getCursorSuggestion();
    const isValid = await this.devContext.validateAISuggestion(suggestion);
    
    if (!isValid) {
      return this.getAlternativeSuggestion();
    }
    return suggestion;
  }
}
JetBrains IDEs Integration
// jetbrains-plugin.ts
import { DevContextClient } from 'mcp-devcontext';

export class JetBrainsIntegration {
  private devContext: DevContextClient;

  constructor() {
    this.devContext = new DevContextClient({
      // Configure with JetBrains API
    });
  }

  // Add to action handler
  async handleAction(action: string, context: any) {
    const projectContext = await this.devContext.getProjectContext(context.projectPath);
    // Integrate with JetBrains action system
  }
}
Sublime Text Integration
# sublime-plugin.py
from mcp_devcontext import DevContextClient

class DevContextSublimeIntegration:
    def __init__(self):
        self.dev_context = DevContextClient()

    def on_query_completions(self, view, prefix, locations):
        # Integrate with Sublime Text completions
        suggestions = self.get_suggestions()
        return [s for s in suggestions if self.dev_context.validate_suggestion(s)]
Neovim Integration
-- neovim-plugin.lua
local devcontext = require('mcp-devcontext')

local M = {}

M.setup = function(opts)
  M.dev_context = devcontext.new(opts)
  
  -- Add to completion sources
  require('cmp').setup({
    sources = {
      {
        name = 'devcontext',
        entry_filter = function(entry)
          return M.dev_context:validate_suggestion(entry.completion_item.text)
        end
      }
    }
  })
end

return M
API Integration Examples
GitHub Copilot Integration
// copilot-extension.ts
import { DevContextClient } from 'mcp-devcontext';

export class CopilotDevContextProvider {
  private devContext: DevContextClient;

  constructor(copilotClient: any) {
    this.devContext = new DevContextClient({
      async sendMessage(message) {
        // Convert MCP message to Copilot format
        return await copilotClient.provideSuggestions(message);
      }
    });
  }

  async validateCopilotSuggestion(suggestion: string) {
    return await this.devContext.validateAISuggestion(suggestion);
  }
}
Codeium Integration
// codeium-extension.ts
import { DevContextClient } from 'mcp-devcontext';

export class CodeiumDevContextIntegration {
  private devContext: DevContextClient;

  constructor(codeiumApi: any) {
    this.devContext = new DevContextClient({
      // Configure with Codeium API
    });
  }

  async enhanceCompletion(completion: any) {
    const isValid = await this.devContext.validateAISuggestion(completion.text);
    if (!isValid) {
      return this.getAlternativeCompletion();
    }
    return completion;
  }
}
Configuration Options
// devcontext.config.ts
module.exports = {
  safety: {
    strictMode: true,
    allowedPaths: ['src/', 'tests/'],
    restrictedCommands: ['rm -rf', 'sudo'],
  },
  integration: {
    editor: 'vscode', // or 'intellij', 'sublime', 'neovim'
    aiProviders: ['copilot', 'codeium', 'roocode'],
  },
  features: {
    autoFix: true,
    suggestionValidation: true,
    issueTracking: true,
  }
};
Development
  1. Install dependencies:

    npm install
    
  2. Run in development mode:

    npm run dev
    
  3. Build:

    npm run build
    
Project Structure

DevContext consists of several core modules:

  • ProjectScanner: Analyzes project structure and dependencies
  • CommandValidator: Ensures safe command execution across platforms
  • UserProfiler: Tracks user skill level and explained concepts
  • DevContextClient: Main client that integrates all modules
Contributing
  1. Fork the repository
  2. Create your feature branch
  3. Add your integration
  4. Submit a pull request
Support

For help integrating with specific editors or AI providers, please open an issue or check our documentation.

License

ISC

Author Information
BRIAN
minneapolis

16

Followers

67

Repositories

0

Gists

1

Total Contributions

Top Contributors

Threads