Skip to content

trosinde/mcp_python

Repository files navigation

MCP Python Server

A powerful Model Context Protocol (MCP) server that enables Claude Desktop to execute Python code, create visualizations, analyze Excel files, and perform file operations.

🚀 Quick Start

Installation

Run the setup script:

setup.bat

This will:

  • Create a virtual environment
  • Install all dependencies
  • Configure Claude Desktop

Configuration

Update Claude Desktop config (if needed):

update_claude_config.bat

📁 Project Structure

mcp_python/
├── mcp_python_server/     # Server implementation
├── examples/              # Usage examples and sample data
├── tests/                 # Test scripts
├── docs/                  # Documentation
├── scripts/               # Runtime scripts (created by server)
├── outputs/               # Generated outputs (created by server)
├── README.md              # This file
└── setup.bat              # Setup script

📊 Examples

Excel Visualization Examples

Transform Excel data into beautiful visualizations with natural language prompts.

Data: small_business_sales_2023_2024.xlsx

Prompt:

Analyze the small business sales data and create visualizations showing:
- Monthly revenue trends comparing 2023 vs 2024
- Product category performance breakdown
- Regional sales distribution

Output:

Small Business Sales Analysis


Data: Multiple campaign CSV files in examples/data/

  • Q1_Email_Marketing_Campaign.csv
  • Q1_Social_Media_Campaign.csv
  • Q2_Email_Marketing_Campaign.csv
  • Q2_PPC_Campaign.csv
  • Q2_Influencer_Campaign.csv
  • Q2_Social_Media_Campaign.csv

Prompt:

Compare all marketing campaigns across Q1 and Q2:
- Show campaign performance metrics (CTR, conversion rate, ROI)
- Compare different campaign types
- Identify best performing channels

Output:

Marketing Campaigns Analysis


Data: Lab experiment Excel files

Prompt:

Analyze the enzyme activity experiments:
- Show how temperature affects enzyme activity
- Compare pH impact on enzyme performance
- Visualize substrate concentration effects

Output:

Research Experiments Analysis


More Examples

For detailed usage examples and prompts:

🛠️ Features

Python Execution

Execute Python code with support for:

  • NumPy, Pandas, Matplotlib, Seaborn
  • Data analysis and scientific computing
  • Custom libraries and packages

Excel Processing

  • Analyze Excel file structure
  • Load and process Excel data
  • Create visualizations directly from Excel files
  • Support for multiple sheets and complex data

File Operations

  • Read/write single or multiple files
  • Pattern matching (*.py, *.json, etc.)
  • Recursive directory operations
  • Batch file processing

Data Visualization

  • Create charts with Matplotlib
  • Statistical plots with Seaborn
  • Pandas built-in plotting
  • Multiple chart types (line, bar, scatter, heatmap, etc.)

📚 Documentation

Usage Documentation:

Technical Documentation:

🧪 Testing

Run tests:

cd tests
test_server.bat

🔧 Troubleshooting

Common Issues

  1. Claude Desktop not recognizing server

    • Run update_claude_config.bat
    • Restart Claude Desktop
  2. Missing dependencies

    • Run install_requirements.bat
    • Or: install_viz_dependencies.bat for visualization libraries
  3. File access issues

    • Check file paths are correct
    • Ensure proper permissions

📝 Usage Examples

Simple Python Execution

User: "Calculate the factorial of 10"
Claude: [Executes Python code and returns result]

Excel Analysis

User: "Analyze sales_data.xlsx and show monthly trends"
Claude: [Reads Excel file, creates visualization]

File Operations

User: "Read all Python files in the src folder"
Claude: [Reads multiple files and shows content]

Data Visualization

User: "Create a bar chart comparing Q1 vs Q2 sales"
Claude: [Generates and displays chart]

🤝 Contributing

This server is designed to work seamlessly with Claude Desktop. Simply describe what you want to do in natural language, and Claude will use the appropriate tools automatically.

📄 License

MIT License - see LICENSE file for details

🔗 Related Resources


Ready to get started? Run setup.bat and start analyzing data with Claude!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published