Back to Home
ajay-fitbit icon

MCP

by ajay-fitbit

Overview

Integrates Microsoft SQL Server databases with AI assistants (OpenAI, Claude Desktop) for natural language querying, automated database operations, and test suite generation.

Installation

Run Command
python server.py

Environment Variables

  • DB_SERVER
  • DB_NAME
  • DB_USER
  • DB_PASSWORD
  • OPENAI_API_KEY

Security Notes

CRITICAL VULNERABILITIES IDENTIFIED: 1. SQL Injection Vulnerabilities: - In `server.py:DatabaseService.execute_query`, parameter *keys* are directly substituted into the SQL query via `query.replace(f"@{key}", "?")`. If a malicious AI prompt or user input controls the `key` name, SQL injection is possible (e.g., `@{key}; DROP TABLE Users; --`). - Similarly, in `server.py:DatabaseService.execute_stored_procedure`, parameter *names* are concatenated into the `EXEC` statement (`@{key} = ?`). A malicious agent controlling `key` names could inject SQL. 2. Local File Inclusion (LFI): In `server.py:DatabaseService.generate_query_from_template`, arbitrary `template_file` names are used to read files from the file system. A malicious actor could specify paths to sensitive files (e.g., `/etc/passwd`, `.env` files, or other configuration) leading to information disclosure. 3. Insecure Communication: `httpx.Client(verify=False)` is explicitly used in `openai_client.py`, `server_client.py`, `direct_no_mcp.py`, `direct_database.py`, and `stored_proc_explorer.py` for OpenAI API communication. While intended as a workaround for corporate SSL environments, this bypasses critical SSL certificate verification, making communication vulnerable to Man-in-the-Middle (MITM) attacks and compromising the confidentiality and integrity of API keys and potentially sensitive query contexts. 4. Subprocess Execution: Multiple launcher scripts use `subprocess.run` to execute other Python scripts. While currently controlled within the repository, this pattern could introduce risks if arguments or script paths become controllable by untrusted input, especially in conjunction with the identified injection vulnerabilities. RECOMMENDATIONS: The identified vulnerabilities are critical. Running this code in a production environment or with untrusted input is NOT recommended without significant security hardening.

Similar Servers

Stats

Interest Score0
Security Score3
Cost ClassHigh
Avg Tokens1500
Stars0
Forks0
Last Update2025-11-19

Tags

SQL ServerAI AssistantNatural LanguageDatabase ToolsMCP