rubberduck-mcp
Bridges AI assistants with Rubberduck VBA to enable code analysis, module management, and Git operations on VBA projects.
README
rubberduck-mcp
⚠️ Maintenance Mode — This project is no longer actively developed. It should still work with compatible versions of Rubberduck VBA, but there are no plans for new features or bug fixes. Pull requests from the community are welcome if you'd like to maintain a fork.
A TypeScript-based Model Context Protocol (MCP) server that bridges AI assistants with Rubberduck VBA's source control and code analysis functionality.
Overview
rubberduck-mcp enables AI systems to access, analyze, modify, and manage VBA codebases through standardized MCP interfaces. This bridge allows AI assistants like Claude to work directly with VBA projects using Rubberduck's powerful source control and code analysis features.
Features
- VBA Module Management: Export and import VBA modules as text
- Git Integration: Perform Git operations (commit, branch, push, pull) directly on VBA projects
- Code Analysis: Run Rubberduck's code analysis and get detailed results
- Automated Refactoring: Execute Rubberduck refactorings on VBA code
- Project Structure: Access and navigate VBA project structure
- Secure Authentication: API key validation for secure access
Prerequisites
- Node.js 16.0.0 or later
- Rubberduck VBA Add-in installed and configured
- Windows environment (for COM interoperability)
- VBA host application (Excel, Word, etc.) with a VBA project loaded
Installation
From npm (when published)
npm install -g rubberduck-mcp
From Source
git clone https://github.com/yourusername/rubberduck-mcp.git
cd rubberduck-mcp
npm install
npm run build
Usage
As a command-line tool:
rubberduck-mcp [options]
Available options:
--api-key <key>- API key for authentication (can also use env varRUBBERDUCK_API_KEY)--debug- Enable debug logging (can also use env varRUBBERDUCK_DEBUG=true)--com-timeout <ms>- Timeout for COM operations in ms (can also use env varRUBBERDUCK_COM_TIMEOUT)--max-retries <num>- Maximum retries for COM operations (can also use env varRUBBERDUCK_MAX_RETRIES)-h, --help- Show help information-v, --version- Show version information
With Claude Desktop:
- Add to your Claude Desktop configuration file (typically
~/.claude/config.jsonon macOS/Linux or%APPDATA%\Claude\config.jsonon Windows):
{
"mcpServers": {
"rubberduck": {
"command": "rubberduck-mcp",
"args": [],
"env": {
"RUBBERDUCK_API_KEY": "your-api-key-here",
"RUBBERDUCK_DEBUG": "true"
}
}
}
}
- In Claude, you can now use the following MCP tools to interact with your VBA projects:
- exportVBAModule: Export a VBA module to text format with optional attributes
- importVBAModule: Import VBA code back into a module, optionally creating it
- analyzeCode: Perform Rubberduck code analysis with configurable rulesets
- executeRefactoring: Execute Rubberduck refactorings on specified code
- gitCommit: Commit changes with a specified message and optional file selection
- gitBranch: Create and/or checkout Git branches
- gitSync: Perform Git synchronization operations (push, pull, fetch)
- You can also access these MCP resources:
- rubberduck://project-structure: JSON representation of VBA project hierarchy
- rubberduck://modules-list: Array of available modules with metadata
- rubberduck://git-status: Current repository status with staged/unstaged changes
- rubberduck://code-history/{moduleName}: Commit history for specific modules
- rubberduck://inspection-results/{moduleName}: Latest code analysis results
- rubberduck://refactoring-options: Available automated refactorings with descriptions
Example: Using rubberduck-mcp with Claude
Here are some examples of how you might use rubberduck-mcp with Claude:
- Export a VBA module:
I'd like to see the code from the "Module1" module in my VBA project.
Claude can use the exportVBAModule tool:
Let me get that code for you from Module1.
- Analyze code for issues:
Can you check my "ErrorHandler" module for any code quality issues?
Claude can use the analyzeCode tool:
I'll analyze your ErrorHandler module for potential issues.
- Commit changes to Git:
Please commit my recent changes to the repository with the message "Fix error handling in validation routines"
Claude can use the gitCommit tool:
I'll commit your changes to Git with that message.
Architecture
This project follows a layered architecture:
- Server Layer: Implements the Model Context Protocol server interface
- COM Interoperability Layer: Manages interactions with Rubberduck and VBE through COM
- Git Integration Layer: Provides Git operation capabilities
- Types: Strongly typed interfaces for all components
Project Structure
The project has the following structure:
- src/server/: MCP server implementation
- src/com/: COM interoperability layer
- src/git/: Git integration
- src/types/: TypeScript type definitions
Implementation Guidelines
The project adheres to strict implementation rules, ensuring:
- Proper COM resource management
- Robust error handling
- Strong type safety
- Comprehensive documentation
Development
Building
npm run build
Testing
npm test
ESLint
npm run lint
Formatting
npm run format
License
MIT
Acknowledgements
- Rubberduck VBA for their amazing VBA tooling
- Model Context Protocol for the protocol specification
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。