MCP-SERVER

sparsh3104/MCP-SERVER

3.2

If you are the rightful owner of 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.

This is a stateless Model Context Protocol (MCP) server that provides MySQL database tools over various transport protocols using the FastMCP Python SDK.

Tools
4
Resources
0
Prompts
0

# MySQL MCP Server (Stateless, Multi-Tenant)

This is a **stateless Model Context Protocol (MCP) server** that exposes MySQL database tools over STDIO / SSE / HTTP using the official Python MCP SDK (FastMCP).

The server is **multi-tenant aware** and uses tenant\_id to select the database for each request. All tools are **stateless**: they receive all context (API key, tenant id, arguments) on every call, and the server does not store per-session state.


## Features

- ✅ Platform: **MySQL**

- ✅ Tech stack: **Python + MCP FastMCP**

- ✅ 4 functional tools:

  - list\_tables

  - get\_table\_schema

  - run\_select

  - insert\_row

- ✅ Stateless by design (stateless\_http=True, no in-memory sessions)

- ✅ Multi-tenant support via tenant\_id

- ✅ API key authentication on all tools

- ✅ Transport selectable via CLI:

  - stdio

  - sse

  - streamable-http (HTTP)


## Project Structure


D:\\MCP SERVER\\

  ├─ server.py       # Main MCP server entrypoint

  ├─ db.py           # MySQL helpers and tool implementations

  ├─ auth.py         # API key auth logic

  ├─ config.py       # Env loading, tenant configuration

  ├─ test\_client.py  # Small script to test MCP HTTP endpoint

  ├─ .env            # Local environment configuration (not committed)

  ├─ .env.example    # Example env file for others

  ├─ requirements.txt

  └─ README.md