MCP-Server-Excel-VBA-Macro-Converter-Python-2

raoagbajdos/MCP-Server-Excel-VBA-Macro-Converter-Python-2

3.2

If you are the rightful owner of MCP-Server-Excel-VBA-Macro-Converter-Python-2 and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A Model Context Protocol (MCP) server built with FastMCP that converts Excel files containing VBA macros into equivalent Python code.

Tools
  1. convert_vba_file

    Convert a single Excel file with VBA

  2. extract_vba_code

    Extract VBA code from Excel file

  3. analyze_vba_complexity

    Analyze VBA code complexity

  4. batch_convert_files

    Convert multiple Excel files

  5. generate_python_equivalent

    Generate Python code from VBA

Excel VBA to Python Converter using FastMCP

A Model Context Protocol (MCP) server built with FastMCP that converts Excel files containing VBA macros into equivalent Python code.

Features

  • šŸ”„ Convert VBA macros to Python code
  • šŸ“Š Extract Excel data and structure
  • šŸ Generate clean, readable Python code
  • šŸ› ļø Support for common VBA constructs
  • šŸ“ Batch processing capabilities
  • šŸ” Code analysis and optimization suggestions

Installation

  1. Clone the repository:
git clone <repository-url>
cd python-mcp-vba-conversion
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt

Usage

As MCP Server

Start the FastMCP server:

python src/mcp_server.py

Standalone Usage

Convert a single Excel file:

python src/converter.py path/to/your/file.xlsm

Convert multiple files:

python src/batch_converter.py path/to/excel/files/

Project Structure

python-mcp-vba-conversion/
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ mcp_server.py          # FastMCP server implementation
│   ā”œā”€ā”€ converter.py           # Main VBA to Python converter
│   ā”œā”€ā”€ vba_parser.py          # VBA code parsing utilities
│   ā”œā”€ā”€ python_generator.py    # Python code generation
│   ā”œā”€ā”€ excel_extractor.py     # Excel file processing
│   └── batch_converter.py     # Batch processing utilities
ā”œā”€ā”€ tests/
│   ā”œā”€ā”€ test_converter.py
│   ā”œā”€ā”€ test_vba_parser.py
│   └── sample_files/
ā”œā”€ā”€ examples/
│   ā”œā”€ā”€ sample_macro.xlsm
│   └── converted_output.py
ā”œā”€ā”€ requirements.txt
ā”œā”€ā”€ setup.py
└── README.md

MCP Tools Available

  • convert_vba_file: Convert a single Excel file with VBA
  • extract_vba_code: Extract VBA code from Excel file
  • analyze_vba_complexity: Analyze VBA code complexity
  • batch_convert_files: Convert multiple Excel files
  • generate_python_equivalent: Generate Python code from VBA

Examples

See the examples/ directory for sample Excel files and their Python conversions.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License

MIT License