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β:
npx -y @smithery/cli install @madhukarkumar/singlestore-mcp-server --client claude
- Clone the repository:
git clone <repository-url>
cd mcp-server-singlestore
- Install dependencies:
npm install
- Build the server:
npm run build
Configuration
The server requires the following environment variables:
SINGLESTORE_HOST=your-host.singlestore.com
SINGLESTORE_PORT=3306
SINGLESTORE_USER=your-username
SINGLESTORE_PASSWORD=your-password
SINGLESTORE_DATABASE=your-database
Configuration Methods
-
Environment Variables: Set the variables in your shell:
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-database
-
MCP Settings Configuration: Add to your MCP settings file (e.g.,
cline_mcp_settings.json
orclaude_desktop_config.json
):{ "mcpServers": { "singlestore": { "command": "node", "args": ["path/to/mcp-server-singlestore/build/index.js"], "env": { "SINGLESTORE_HOST": "your-host.singlestore.com", "SINGLESTORE_PORT": "3306", "SINGLESTORE_USER": "your-username", "SINGLESTORE_PASSWORD": "your-password", "SINGLESTORE_DATABASE": "your-database" } } } }
Usage
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" } })
Running Standalone
- Build the server:
npm run build
- Run the server:
node build/index.js
Installing in Claude Desktop App
- Add the server configuration to
~/Library/Application Support/Claude/claude_desktop_config.json
:
{
"mcpServers": {
"singlestore": {
"command": "node",
"args": ["path/to/mcp-server-singlestore/build/index.js"],
"env": {
"SINGLESTORE_HOST": "your-host.singlestore.com",
"SINGLESTORE_PORT": "your-port",
"SINGLESTORE_USER": "your-username",
"SINGLESTORE_PASSWORD": "your-password",
"SINGLESTORE_DATABASE": "your-database"
}
}
}
}
- Restart the Claude Desktop App
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
mcp-server-singlestore/
βββ src/
β βββ index.ts # Main server implementation
βββ package.json
βββ tsconfig.json
βββ README.md
βββ CHANGELOG.md
Building
npm run build
Testing
npm test
Troubleshooting
-
Connection Issues
- Verify credentials and host information
- Check SSL configuration
- Ensure database is accessible from your network
-
Build Issues
- Clear node_modules and reinstall dependencies
- Verify TypeScript configuration
- Check Node.js version compatibility
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
Last updated on