Content
# Jewei MSSQL MCP Server
## Project Introduction
This is an MCP server that connects to MSSQL, specifically designed for performing data queries and table structure queries on Microsoft SQL Server. The server provides a series of tools that enable clients to easily interact with SQL Server databases.
## Features
- **Data Query**: Execute SQL queries and return result sets
- **Table Structure Query**: Obtain database table structure information
- **Easy to Use**: Provides a standardized interface through the MCP protocol
- **Efficient and Reliable**: Optimized database connection management
## MCP Configuration
This project supports configuring the MCP server through various clients for integration with various IDEs or tools. Here are some configuration examples for common clients:
### Windsurf / Cursor / Claude
For clients based on the Windsurf framework (such as Cursor and Claude), you can configure the MCP server in the `~/.codeium/windsurf/mcp_config.json` file. Here is an example configuration:
```json
{
"mcpServers": {
"jewei-mssql": {
"disabled": false,
"command": "uvx",
"args": [
"jewei-mssql-mcp-server"
],
"env": {
"DB_HOST": "your_db_host",
"DB_USER": "your_db_user",
"DB_PASSWORD": "your_db_password",
"DB_NAME": "your_db_name",
"DB_PORT": "your_db_port"
}
}
}
}
```
Please replace `your_db_host`, `your_db_user`, `your_db_password`, and `your_db_name` with your actual database connection information.
### Cline
For Cline clients, you can add a similar MCP server configuration to its configuration file. Please refer to the official Cline documentation for specific configuration methods. Typically, you need to specify the server's name, command, arguments, and environment variables.
```json
// Cline 配置文件示例 (具体格式请参考 Cline 文档)
{
"mcpServers": {
"jewei-mssql": {
"command": "uvx",
"args": [
"jewei-mssql-mcp-server"
],
"env": {
"DB_HOST": "your_db_host",
"DB_USER": "your_db_user",
"DB_PASSWORD": "your_db_password",
"DB_NAME": "your_db_name",
"DB_PORT": "your_db_port"
}
}
}
}
```
Please replace the placeholders in the example with your actual database connection information and adjust according to Cline's specific configuration format.
## Other Installation and Configuration Methods
### Prerequisites
- Python 3.7+
- Permissions to access Microsoft SQL Server
- FastMCP library
### Installation Steps
#### Method 1: Install via PyPI (Recommended)
```bash
pip install jewei-mssql-mcp-server
```
#### Method 2: Install from Source Code
1. Clone this repository
```bash
git clone [仓库URL]
cd jewei-mssql-mcp-server
```
2. Install dependencies
```bash
pip install -r requirements.txt
```
3. Configure database connection
- Create a configuration file or set environment variables (see below for specific configuration methods)
## Usage
### Start the Server
```bash
python server.py
```
By default, the server uses the STDIO transport mechanism. To use HTTP transport, you can modify the relevant configuration in `server.py`.
### Client Call Example
Any client that supports the MCP protocol can connect to this server. Here is a basic call example:
```python
from fastmcp import Client
# 连接到MCP服务器
client = Client("http://localhost:9000")
# 执行SQL查询
result = client.call("query_sql", sql="SELECT * FROM users LIMIT 10")
print(result)
# 获取表结构
structure = client.call("get_table_structure", table_name="users")
print(structure)
```
## Configuration Options
Server configuration can be set in the following ways:
1. Environment Variables
2. Configuration File
3. Directly in the Code
4. Configure the MCP Server via uv
### Install and Manage Dependencies Using uv
This project supports using uv (a fast Python package manager) to install and manage dependencies. Using uv can significantly improve package installation speed and ensure environment consistency.
First, install uv:
```bash
# 安装uv
pip install uv
```
Then, use uv to create a virtual environment and install dependencies:
```bash
# 创建虚拟环境
uv venv
# 激活虚拟环境
# Windows
.venv\Scripts\activate
# Linux/macOS
source .venv/bin/activate
# 使用uv安装依赖
uv pip install -r requirements.txt
```
After installation, you can start the MCP server as follows:
```bash
python server.py
```
You can also configure the server in the `~/.codeium/windsurf/mcp_config.json` file for integration with Cascade. This project supports using the `uvx` command to configure the MCP server:
```json
{
"mcpServers": {
"jewei-mssql": {
"disabled": false,
"command": "uvx",
"args": [
"jewei-mssql-mcp-server"
],
"env": {
"DB_HOST": "your_db_host",
"DB_USER": "your_db_user",
"DB_PASSWORD": "your_db_password",
"DB_NAME": "your_db_name"
}
}
}
}
```
Where `uvx` is the command to run installed Python packages, and `jewei-mssql-mcp-server` is the package name. This ensures that the MCP server runs using the correct environment.
### Main Configuration Items
The main configuration items include:
- Database connection information (server address, username, password, database name)
- Server listening address and port
- Log level
## Contribution Guide
Contributions and suggestions for improvement are welcome! Please follow these steps:
1. Fork this 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. Create a Pull Request
## License
[Specify license type]
## Contact Information
If you have any questions or suggestions, please contact [Contact Information].
Connection Info
You Might Also Like
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
markitdown
Python tool for converting files and office documents to Markdown.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
Sequential Thinking
A structured MCP server for dynamic problem-solving and reflective thinking.
Fetch
Retrieve and process content from web pages by converting HTML into markdown format.
TrendRadar
TrendRadar: Your hotspot assistant for real news in just 30 seconds.