The SingleStore MCP Server is a tool for interacting with SingleStore databases via MCP or SSE protocols, providing various database management capabilities:
Execute SQL queries: Run arbitrary SQL, including read-only SELECT queries
List tables: Retrieve all tables in the database
Describe table schema: Get detailed information about table structures
Generate ER diagrams: Create Mermaid ER diagrams of the database schema
Create tables: Define new tables with specified columns and constraints
Generate synthetic data: Populate tables with test data using flexible generators
Optimize SQL: Analyze queries and provide optimization recommendations
Allows querying and interacting with SingleStore databases, including listing tables, executing SQL queries, getting table information, generating ER diagrams, and optimizing SQL queries
SingleStore MCP Server
A Model Context Protocol (MCP) server for interacting with SingleStore databases. This server provides tools for querying tables, describing schemas, and generating ER diagrams.
Features
List all tables in the database
Execute custom SQL queries
Get detailed table information including schema and sample data
Generate Mermaid ER diagrams of database schema
SSL support with automatic CA bundle fetching
Proper error handling and TypeScript type safety
Prerequisites
Node.js 16 or higher
npm or yarn
Access to a SingleStore database
SingleStore CA bundle (automatically fetched from portal)
Installation
Installing via Smithery
To install SingleStore MCP Server for Claude Desktop automatically via Smithery:
Clone the repository:
Install dependencies:
Build the server:
Environment Variables
Required Environment Variables
The server requires the following environment variables for database connection:
All these environment variables are required for the server to establish a connection to your SingleStore database. The connection uses SSL with the SingleStore CA bundle, which is automatically fetched from the SingleStore portal.
Optional Environment Variables
For SSE (Server-Sent Events) protocol support:
Setting Environment Variables
In Your Shell: Set the variables in your terminal before running the server:
export SINGLESTORE_HOST=your-host.singlestore.com export SINGLESTORE_PORT=3306 export SINGLESTORE_USER=your-username export SINGLESTORE_PASSWORD=your-password export SINGLESTORE_DATABASE=your-databaseIn Client Configuration Files: Add the variables to your MCP client configuration file as shown in the integration sections below.
Usage
Protocol Support
This server supports two protocols for client integration:
MCP Protocol: The standard Model Context Protocol using stdio communication, used by Claude Desktop, Windsurf, and Cursor.
SSE Protocol: Server-Sent Events over HTTP for web-based clients and applications that need real-time data streaming.
Both protocols expose the same tools and functionality, allowing you to choose the best integration method for your use case.
Available Tools
list_tables
Lists all tables in the database
No parameters required
use_mcp_tool({ server_name: "singlestore", tool_name: "list_tables", arguments: {} })query_table
Executes a custom SQL query
Parameters:
query: SQL query string
use_mcp_tool({ server_name: "singlestore", tool_name: "query_table", arguments: { query: "SELECT * FROM your_table LIMIT 5" } })describe_table
Gets detailed information about a table
Parameters:
table: Table name
use_mcp_tool({ server_name: "singlestore", tool_name: "describe_table", arguments: { table: "your_table" } })generate_er_diagram
Generates a Mermaid ER diagram of the database schema
No parameters required
use_mcp_tool({ server_name: "singlestore", tool_name: "generate_er_diagram", arguments: {} })run_read_query
Executes a read-only (SELECT) query on the database
Parameters:
query: SQL SELECT query to execute
use_mcp_tool({ server_name: "singlestore", tool_name: "run_read_query", arguments: { query: "SELECT * FROM your_table LIMIT 5" } })create_table
Create a new table in the database with specified columns and constraints
Parameters:
table_name: Name of the table to create
columns: Array of column definitions
table_options: Optional table configuration
use_mcp_tool({ server_name: "singlestore", tool_name: "create_table", arguments: { table_name: "new_table", columns: [ { name: "id", type: "INT", nullable: false, auto_increment: true }, { name: "name", type: "VARCHAR(255)", nullable: false } ], table_options: { shard_key: ["id"], sort_key: ["name"] } } })generate_synthetic_data
Generate and insert synthetic data into an existing table
Parameters:
table: Name of the table to insert data into
count: Number of rows to generate (default: 100)
column_generators: Custom generators for specific columns
batch_size: Number of rows to insert in each batch (default: 1000)
use_mcp_tool({ server_name: "singlestore", tool_name: "generate_synthetic_data", arguments: { table: "customers", count: 1000, column_generators: { "customer_id": { "type": "sequence", "start": 1000 }, "status": { "type": "values", "values": ["active", "inactive", "pending"] }, "signup_date": { "type": "formula", "formula": "NOW() - INTERVAL FLOOR(RAND() * 365) DAY" } }, batch_size: 500 } })optimize_sql
Analyze a SQL query using PROFILE and provide optimization recommendations
Parameters:
query: SQL query to analyze and optimize
use_mcp_tool({ server_name: "singlestore", tool_name: "optimize_sql", arguments: { query: "SELECT * FROM customers JOIN orders ON customers.id = orders.customer_id WHERE region = 'west'" } })The response includes:
Original query
Performance profile summary (total runtime, compile time, execution time)
List of detected bottlenecks
Optimization recommendations with impact levels (high/medium/low)
Suggestions for indexes, joins, memory usage, and other optimizations
Running Standalone
Build the server:
Run the server with MCP protocol only:
Run the server with both MCP and SSE protocols:
Using the SSE Protocol
When SSE is enabled, the server exposes the following HTTP endpoints:
Root Endpoint
GET /Returns server information and available endpoints.
Health Check
GET /healthReturns status information about the server.
SSE Connection
GET /sseEstablishes a Server-Sent Events connection for real-time updates.
List Tools
GET /toolsReturns a list of all available tools, same as the MCP
list_tools
functionality.Also supports POST requests for MCP Inspector compatibility:
POST /tools Content-Type: application/json { "jsonrpc": "2.0", "id": "request-id", "method": "mcp.list_tools", "params": {} }Call Tool
POST /call-tool Content-Type: application/json { "name": "tool_name", "arguments": { "param1": "value1", "param2": "value2" }, "client_id": "optional_sse_client_id_for_streaming_response" }Executes a tool with the provided arguments.
If
client_id
is provided, the response is streamed to that SSE client.If
client_id
is omitted, the response is returned directly in the HTTP response.
Also supports standard MCP format for MCP Inspector compatibility:
POST /call-tool Content-Type: application/json { "jsonrpc": "2.0", "id": "request-id", "method": "mcp.call_tool", "params": { "name": "tool_name", "arguments": { "param1": "value1", "param2": "value2" }, "_meta": { "client_id": "optional_sse_client_id_for_streaming_response" } } }
SSE Event Types
When using SSE connections, the server sends the following event types:
message (unnamed event): Sent when an SSE connection is successfully established.
open: Additional connection established event.
message: Used for all MCP protocol messages including tool start, result, and error events.
All events follow the JSON-RPC 2.0 format used by the MCP protocol. The system uses the standard message
event type for compatibility with the MCP Inspector and most SSE client libraries.
Example JavaScript Client
Using with MCP Inspector
The MCP Inspector is a browser-based tool for testing and debugging MCP servers. To use it with this server:
Start both the server and MCP inspector in one command:
npm run inspectorOr start just the server with:
npm run start:inspectorTo install and run the MCP Inspector separately:
npx @modelcontextprotocol/inspectorThe inspector will open in your default browser.
When the MCP Inspector opens:
a. Enter the URL in the connection field:
http://localhost:8081Note: The actual port may vary depending on your configuration. Check the server startup logs for the actual port being used. The server will output:
MCP SingleStore SSE server listening on port XXXXb. Make sure "SSE" is selected as the transport type
c. Click "Connect"
If you encounter connection issues, try these alternatives:
a. Try connecting to a specific endpoint:
http://localhost:8081/streamb. Try using your machine's actual IP address:
http://192.168.1.x:8081c. If running in Docker:
http://host.docker.internal:8081Debugging connection issues:
a. Verify the server is running by visiting http://localhost:8081 in your browser
b. Check the server logs for connection attempts
c. Try restarting both the server and inspector
d. Make sure no other service is using port 8081
e. Test SSE connection with the provided script:
npm run test:sseOr manually with curl:
curl -N http://localhost:8081/ssef. Verify your firewall settings allow connections to port 8081
Once connected, the inspector will show all available tools and allow you to test them interactively.
⚠️ Note: When using the MCP Inspector, you must use the full URL, including the http://
prefix.
MCP Client Integration
Installing in Claude Desktop
Add the server configuration to your Claude Desktop config file located at:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Windows:
%APPDATA%\Claude\claude_desktop_config.json
The SSE_ENABLED and SSE_PORT variables are optional. Include them if you want to enable the HTTP server with SSE support alongside the standard MCP protocol.
Restart the Claude Desktop App
In your conversation with Claude, you can now use the SingleStore MCP server with:
Installing in Windsurf
Add the server configuration to your Windsurf config file located at:
macOS:
~/Library/Application Support/Windsurf/config.json
Windows:
%APPDATA%\Windsurf\config.json
The SSE_ENABLED and SSE_PORT variables are optional, but enable additional functionality through the SSE HTTP server.
Restart Windsurf
In your conversation with Claude in Windsurf, the SingleStore MCP tools will be available automatically when Claude needs to access database information.
Installing in Cursor
Add the server configuration to your Cursor settings:
Open Cursor
Go to Settings (gear icon) > Extensions > Claude AI > MCP Servers
Add a new MCP server with the following configuration:
The SSE_ENABLED and SSE_PORT variables allow web applications to connect to the server via HTTP and receive real-time updates through Server-Sent Events.
Restart Cursor
When using Claude AI within Cursor, the SingleStore MCP tools will be available for database operations.
Security Considerations
Never commit credentials to version control
Use environment variables or secure configuration management
Consider using a connection pooling mechanism for production use
Implement appropriate access controls and user permissions in SingleStore
Keep the SingleStore CA bundle up to date
Development
Project Structure
Building
Testing
Troubleshooting
Connection Issues
Verify credentials and host information in your environment variables
Check SSL configuration
Ensure database is accessible from your network
Check your firewall settings to allow outbound connections to your SingleStore database
Build Issues
Clear node_modules and reinstall dependencies
Verify TypeScript configuration
Check Node.js version compatibility (should be 16+)
MCP Integration Issues
Verify the path to the server's build/index.js file is correct in your client configuration
Check that all environment variables are properly set in your client configuration
Restart your client application after making configuration changes
Check client logs for any error messages related to the MCP server
Try running the server standalone first to validate it works outside the client
Contributing
Fork the repository
Create a feature branch
Commit your changes
Push to the branch
Create a Pull Request
License
MIT License - see LICENSE file for details
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
A server for interacting with SingleStore databases, enabling table querying, schema descriptions, and ER diagram generation with secure SSL support and TypeScript safety.
- Features
- Prerequisites
- Installation
- Environment Variables
- Usage
- MCP Client Integration
- Security Considerations
- Development
- Troubleshooting
- Contributing
- License
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityA server that enables running SQL queries against IoTDB databases, providing data reading capabilities and schema information through a Model Context Protocol interface.Last updated -428Apache 2.0
- AsecurityAlicenseAqualityA server that connects to PostgreSQL databases and provides tools for safely exploring schemas, running read-only SQL queries, and performing data analysis with pre-built templates.Last updated -65291MIT License
- -securityAlicense-qualityA TypeScript-based server project with comprehensive development tooling including testing, linting, and build configurations.Last updated -MIT License
- -securityFlicense-qualityA server that exposes SQLite database operations as tools, allowing natural language interactions with a database through LlamaIndex and Ollama LLM integration.Last updated -1