- Home
- MCP servers
- Pymssql-mcp
Pymssql-mcp
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"bpamiri-pymssql-mcp": {
"command": "pymssql-mcp",
"args": [
"--http",
"--host",
"0.0.0.0",
"--port",
"8080"
],
"env": {
"MSSQL_HOST": "your-server.example.com",
"MSSQL_USER": "your-username",
"MSSQL_DATABASE": "your-database",
"MSSQL_PASSWORD": "your-password",
"MSSQL_READ_ONLY": "true"
}
}
}
}You run an MCP server that lets an AI assistant interact with your Microsoft SQL Server databases through a standardized, safe interface. This enables natural language queries, schema discovery, CRUD operations, stored procedures, and more, all while giving you control over safety and access.
How to use
You will run the MCP server locally or as a shared HTTP service, then connect your AI assistant client to it. Start by configuring the MCP server with your SQL Server connection details, including host, user, password, and database. You can run the server in HTTP mode to serve multiple users or use the standard local mode for development and Claude integration.
How to install
pip install pymssql-mcp
Next, start the MCP server. For a local/development setup, run the MCP process directly. For HTTP access, expose the server on your network.
Configuration and operation
Configure your client (Claude Desktop or your MCP client) to point to the MCP server. Provide the SQL Server connection details as environment variables in the client configuration so the MCP server can connect on your behalf.
MSSQL_HOST=your-server.example.com
MSSQL_USER=your-username
MSSQL_PASSWORD=your-password
MSSQL_DATABASE=your-database
MSSQL_READ_ONLY=true
Run modes and examples
Local development mode runs the MCP server as a local process. To enable an HTTP server that can handle multiple users, start the server with HTTP options. To enable a streamable HTTP endpoint suitable for Claude.ai integration with SSO, use the streamable HTTP option.
pymssql-mcp --http --host 0.0.0.0 --port 8080
pymssql-mcp --streamable-http --host 0.0.0.0 --port 8080
Configuration reference
The MCP server uses a set of environment variables to control connectivity, safety, and behavior. You typically provide these in the environment where the MCP server runs or in the client configuration that connects to it.
Safety and ownership
Safety features help prevent accidental data exposure or modification. Use read-only mode, block unsafe commands, and apply schema or database restrictions as needed. Always validate queries before execution and prefer parameterized queries to defend against injection.
Troubleshooting
If the server cannot reach SQL Server, verify network access, credentials, and that the target database is reachable from the MCP host. Check that the MCP server process is running and listening on the expected port. Review environment variables for correctness.
Notes
This MCP server provides a comprehensive interface to SQL Server, including schema discovery, CRUD operations, and transaction management, with safety controls and knowledge persistence to help Claude remember learned insights about your data.
Available tools
connect
Establish a connection to the SQL Server database.
disconnect
Close all active connections to the database.
list_databases
List available databases on the server.
switch_database
Switch the active database context.
execute_query
Run a SELECT query and return results.
validate_query
Check if a query is safe to execute.
list_tables
List tables and views in the current database.
describe_table
Retrieve column information for a table.
read_rows
Read rows by ID or filter criteria.
insert_row
Insert a new row into a table.
update_row
Update an existing row.
delete_row
Delete a row from a table.
list_stored_procs
List available stored procedures.
describe_stored_proc
Get parameters for a stored procedure.
call_stored_proc
Execute a stored procedure with parameters.
export_to_json
Export query results to JSON.
export_to_csv
Export query results to CSV.
begin_transaction
Start a database transaction.
commit_transaction
Commit the current transaction.
rollback_transaction
Rollback the current transaction.
save_knowledge
Persist learned knowledge about the database.
get_all_knowledge
Retrieve all persisted knowledge.
search_knowledge
Search saved database knowledge.