A powerful extension for the Model Context Protocol (MCP) that enhances AI development assistance with context awareness, issue tracking, and intelligent tooling recommendations.
- 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
npm install mcp-devcontext
// 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);
}
}
});
// 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}`);
}
});
- Install the package:
# For Roocode
npm install mcp-devcontext @roocode/api
# For Cursor
npm install mcp-devcontext @cursor/api
- 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();
- Start using:
// Roocode example
const enhancedCode = await roocode.getCompletion('Create a React component');
// Cursor example
const generatedCode = await cursor.generateCode('Create an API endpoint');
- âś… Code safety validation
- âś… Project context awareness
- âś… Intelligent tool recommendations
- âś… Error tracking and resolution
- âś… Performance monitoring
- âś… Safe refactoring operations
// devcontext.config.ts
module.exports = {
safety: {
strictMode: true,
allowedPaths: ['src/', 'tests/'],
},
features: {
autoFix: true,
suggestionValidation: true,
issueTracking: true
}
};
For issues specific to:
- Roocode integration: Roocode Support
- Cursor integration: Cursor Support
// 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);
}
}
// 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-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-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-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
// 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-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;
}
}
// 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,
}
};
-
Install dependencies:
npm install
-
Run in development mode:
npm run dev
-
Build:
npm run build
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
- Fork the repository
- Create your feature branch
- Add your integration
- Submit a pull request
For help integrating with specific editors or AI providers, please open an issue or check our documentation.
ISC