MCP ExplorerExplorer

Claude Mcp Server

@Seunopeon 17 days ago
1 MIT
FreeCommunity
AI Systems
A basic MCP Server but comprehensive platform that analyzes your Postgres, MySQL, and MongoDB databases.

Overview

What is Claude Mcp Server

claude-mcp-server is a comprehensive platform designed for analyzing various database types including Postgres, MySQL, and MongoDB. It integrates seamlessly with Claude Desktop, allowing for AI-assisted database analysis.

Use cases

Use cases for claude-mcp-server include monitoring database performance, generating reports, sending alerts for database changes, and conducting AI-assisted data analysis for decision-making.

How to use

To use claude-mcp-server, first ensure you have Python 3.12 or higher and the uv package manager installed. Clone the repository, set up a virtual environment, install dependencies, and configure your database connection in a .env file.

Key features

Key features include multi-database analysis, action logs for tracking interactions, LLM ethical safety integration for responsible queries, built-in communication tools for notifications, and seamless integration with Claude Desktop.

Where to use

claude-mcp-server can be utilized in various fields such as data analysis, business intelligence, software development, and any domain requiring efficient database management and insights.

Content

Basic MCP Server

Get dashboard metrics at the speed of thought.

Overview

Basic MCP Server is a comprehensive platform that analyzes your Postgres, MySQL, and MongoDB databases. The server integrates with Claude Desktop, enabling powerful AI-assisted database analysis through Claude’s interface.

Key Features

  • Database Analysis: Connect to and analyze multiple database types (Postgres, MySQL, MongoDB)
  • Action Logs: Track and monitor all database interactions
  • LLM Ethical Safety Integration: Ensure safe and responsible database queries
  • Communication Tools: Built-in functionality to send emails and SMS notifications
  • Claude Desktop Integration: Seamless interaction with Claude AI for database analysis

MCP Server Process Diagram

The diagram below illustrates how Claude Desktop interacts with MCP Server tools based on user prompts.

MCP Process Flow

Installation

Prerequisites

  1. Python 3.12 or higher:

    uv python install
    
  2. Install uv package manager:

    macOS and Linux

    curl -LsSf https://astral.sh/uv/install.sh | sh
    

    Windows

    powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
    

    For more installation options

    Visit https://docs.astral.sh/uv/getting-started/installation/

  3. Download Claude Desktop:
    https://claude.ai/download

Server Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/basic-mcp-server.git
    cd basic-mcp-server
    
  2. Create and activate virtual environment:

    rm -rf .venv
    uv venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    
  3. Install dependencies:

    uv run mcp
    
  4. Configure database connection:
    Create a .env file with the following parameters:

    # PostgreSQL configuration
    DB_HOST=your_db_host/ip
    DB_PORT=5432
    DB_NAME=your_db_name
    DB_USER=your_db_user    
    DB_PASSWORD=your_db_password
    
    # MySQL configuration
    MYSQL_DB_HOST=your_db_host/ip
    MYSQL_DB_PORT=3306
    MYSQL_DB_NAME=your_db_name
    MYSQL_DB_USER=your_db_user
    MYSQL_DB_PASSWORD=your_db_password
    
    # MongoDB configuration
    MONGODB_CONNECTION_STRING=your_mongodb_connection_string
    MONGODB_DATABASE=your_mongodb_database
    
    # OpenAI API configuration (for supplementary LLM features)
    OPENAI_API_KEY=sk-proj-...
    OPENAI_MODEL=gpt-4o-mini
    
    # Web notification URL
    BASE_URL=your_web_notification_url
    

Claude Desktop Integration

  1. Install MCP to Claude Desktop:

    uv run mcp install main.py
    
  2. Test with MCP Inspector (development mode):

    uv run mcp dev main.py
    
  3. Configure Claude Desktop settings:
    Add/review the following configuration of your Claude Desktop:

Security Considerations

  1. Restricted Database Permissions:

    • Only read operations (eg. SELECT, FIND) database are permitted for the LLM tools
  2. Secure Environment Variables:

    chmod 600 .env
    

Troubleshooting Claude Desktop Connection

If Claude Desktop cannot connect to your MCP server:

  1. Force Quit and Restart Claude Desktop

  2. Verify the MCP Path in Claude Settings:
    Ensure the path to your Python environment is correct:

  3. Hard-code the uv Path:

    • Run which uv to find the exact path
    • Update the Claude settings:

Usage Guide

Your knowledge of the database is key to make the best of this MCP server tools.

  1. Connect to Claude Desktop:

    • Open Claude Desktop
    • Select “Basic MCP Server” from the tools menu
  2. Query Your Databases:

    • Ask Claude to analyze data from your configured databases
    • Example: “Show me the top 10 users by transaction volume in the last month”
  3. Generate Reports:

    • Request various reports based on your database data
    • Example: “Generate a monthly financial report based on the transactions table”

Sample Analytics Prompt

Here’s a sample prompt you can use with Claude Desktop to analyze your database:

How many customers do we have in postgres database
Give the list of the most common  product from the transactions table
Send all these information as an email to [email protected]
You are an expert data analyst specializing in database and business intelligence. Your task is to provide a detailed, insightful, and actionable health analysis based on available database records.

**Key Notes for Analysis**: 
- Focus on the following transactional data:
   * **PostgreSQL**: Analyze the `transactions` table
      - Ignore any tables ending with `_table` (migration tables)
      - Ignore any records where `actionBy = 'system'`
   * **MongoDB**: For the `transactions` collection, use:
      * `inflow = credit`
      * `outflow = debit`

**Expected Output**: 
- Provide a markdown-formatted report
- Include KPIs such as:
   - Active users
   - Revenue inflow vs outflow (net cash position)
   - Transaction volume trends
   - Customer retention
   - Product usage distribution
   - Any potential anomalies or recommendations

Make your analysis structured and insightful enough for use in a business review or investor update.

Contributing

We welcome contributions to the Basic MCP Server project:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add some amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Buy Me A Coffee

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support and inquiries, please contact us at [email protected]

Tools

No tools

Comments