vba-mcp-server

AlexisTrouve/vba-mcp-server

3.2

If you are the rightful owner of vba-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The VBA MCP Server is a tool designed to extract and analyze VBA code from Microsoft Office files, facilitating interaction with VBA macros in Excel, Access, and Word files.

Tools
3
Resources
0
Prompts
0

VBA MCP Server

License: MIT Python 3.8+

Model Context Protocol (MCP) server for VBA extraction and analysis in Microsoft Office files.

MCP enables Claude to interact with Office files through specialized tools. Extract, analyze, and understand VBA code from Excel, Word, and Access files.

Features

Lite (Free - MIT)

  • Extract VBA code from Office files (.xlsm, .xlsb, .docm, .accdb)
  • List all VBA modules and procedures
  • Analyze code structure and complexity metrics

Pro (Commercial)

  • All Lite features, plus:
  • Inject VBA code back into Office files
  • Run macros with parameters
  • Read/write data from Excel and Access
  • Access Forms - Create, export, import forms programmatically
  • VBA compilation check - Detect errors before running
  • Backup/restore with automatic rollback

See vba-mcp-server-pro for the commercial version.

Quick Start

Installation

pip install vba-mcp-server

Claude Desktop Configuration

Add to your Claude Desktop config (%APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "vba": {
      "command": "python",
      "args": ["-m", "vba_mcp_server"]
    }
  }
}

Restart Claude Desktop.

MCP Tools

ToolDescription
extract_vbaExtract VBA code from a specific module
list_modulesList all VBA modules in a file
analyze_structureAnalyze code structure and complexity

Usage Examples

Extract VBA Code

Extract the VBA code from the "Module1" module in C:\path\to\file.xlsm

List All Modules

List all VBA modules in C:\path\to\workbook.xlsm

Analyze Code Structure

Analyze the VBA code structure in C:\path\to\file.xlsm

Supported File Types

ExtensionApplicationSupport
.xlsmExcel (macro-enabled)Full
.xlsbExcel (binary)Full
.xlsExcel (legacy)Full
.docmWord (macro-enabled)Full
.docWord (legacy)Full
.accdbAccessPartial*

*For full Access support including VBA extraction via COM, see the Pro version.

Development

Setup

# Clone the repository
git clone https://github.com/AlexisTrouve/vba-mcp-server.git
cd vba-mcp-server

# Create virtual environment
python -m venv venv
source venv/bin/activate  # or venv\Scripts\activate on Windows

# Install in editable mode
pip install -e packages/core
pip install -e packages/lite

Project Structure

vba-mcp-server/
├── packages/
│   ├── core/       # vba-mcp-core - Shared extraction library
│   └── lite/       # vba-mcp-server - MCP server (this package)
├── docs/           # Documentation
├── examples/       # Example files
└── tests/          # Tests

Running Tests

pytest packages/lite/tests/

Requirements

  • Python 3.8+
  • oletools (for VBA extraction)

Known Limitations

  1. oletools doesn't fully support .accdb files - some Access features require COM (Pro version)
  2. Read-only operations - for VBA injection, see the Pro version

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see for details.

Author

Alexis Trouve - alexistrouve.pro@gmail.com

See Also