Sling as an MCP Connector: Query Databases and Move Data from Any AI Assistant


Introduction
The Model Context Protocol (MCP) is an open standard that lets AI assistants connect to external tools through a standardized interface. Instead of copy-pasting schema outputs or writing ad hoc scripts, an MCP-connected AI can query your database directly, discover tables, run a replication, or copy files between cloud storage systems — all from a chat prompt.
Sling CLI ships a built-in MCP server. One command, sling mcp, exposes Sling’s full data-movement capability to any MCP-compatible client: Claude Desktop, Claude Code, GitHub Copilot in VSCode, or any other host that supports the protocol.
This article covers what the Sling MCP server exposes, how to wire it up in each client, and what you can actually do with it once it is running.
What the Sling MCP Server Exposes
Running sling mcp starts a stdio-based MCP server with six tools:
| Tool | What it does |
|---|---|
connection | List, test, discover, and create connections |
database | Execute SQL queries, inspect schemas and columns |
file_system | List files, copy between storage systems, inspect file metadata |
api_spec | Parse, test, and debug REST API specifications |
replication | Parse, compile, and run replication YAML files |
pipeline | Parse and run data pipeline configurations |
Each tool accepts an action parameter and an input object. The AI assistant constructs these calls from your natural-language prompt and executes them through the MCP layer — you see the result, not the JSON plumbing.
The server also ships three guided prompts for API spec workflows:
api_spec_create_spec— builds a full API spec from documentationapi_spec_add_endpoint— adds one endpoint to an existing specapi_spec_debug_endpoint— diagnoses and fixes a broken endpoint
Installing Sling
If you have not installed Sling yet:
# macOS / Linux
curl -fsSL https://slingdata.io/install.sh | bash
# Windows
irm https://slingdata.io/install.ps1 | iex
# Python
pip install sling
Confirm the install:
sling --version
Then set up your connections. Sling reads from ~/.sling/env.yaml:
connections:
MY_PG:
type: postgres
host: db.example.com
user: analyst
password: "{{ env.DB_PASSWORD }}"
database: production
MY_S3:
type: s3
bucket: my-data-bucket
access_key_id: "{{ env.AWS_ACCESS_KEY_ID }}"
secret_access_key: "{{ env.AWS_SECRET_ACCESS_KEY }}"
region: us-east-1
Test that your connections work before wiring up MCP:
sling conns test MY_PG
sling conns test MY_S3
Wiring Sling into Your AI Client
All clients use the same MCP config shape: point at the sling binary with args: ["mcp"] and pass your CLI Pro token as an environment variable.
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"sling": {
"command": "sling",
"args": ["mcp"],
"env": {
"SLING_CLI_TOKEN": "your-cli-pro-token"
}
}
}
}
Restart Claude Desktop. The MCP indicator (🔌) will appear in the bottom-right corner of the chat input when the server is connected.
Claude Code
Add the server at user scope (available in all projects) or project scope (team-shared via .mcp.json):
# User scope — global, for personal use
claude mcp add sling --scope user --args "mcp" --env SLING_CLI_TOKEN=your-token
# Project scope — team-shared
# Create .mcp.json in project root:
{
"servers": {
"sling": {
"type": "stdio",
"command": "sling",
"args": ["mcp"],
"env": {
"SLING_CLI_TOKEN": "${SLING_CLI_TOKEN}"
}
}
}
}
With ${SLING_CLI_TOKEN} the token is read from the environment at runtime, so it never lands in the config file committed to source control.
Verify the connection:
claude mcp logs sling
VSCode with GitHub Copilot
Create .vscode/mcp.json in your project root:
{
"servers": {
"sling": {
"type": "stdio",
"command": "sling",
"args": ["mcp"],
"env": {
"SLING_CLI_TOKEN": "your-cli-pro-token"
}
}
}
}
Open GitHub Copilot Chat, select Agent mode from the dropdown, then click the Tools button. The Sling connection, database, file_system, replication, and pipeline tools will appear in the list.
What You Can Do: Concrete Examples
Once the MCP server is running, you interact with it through natural-language prompts. Here are representative use cases with the actual tool calls the AI assistant constructs underneath.
Query a Database
Your prompt:
Use sling connection MY_PG to show me the top 10 products by revenue this month from the sales table
What the assistant executes:
{
"action": "query",
"input": {
"connection": "MY_PG",
"query": "SELECT product_id, SUM(revenue) AS total_revenue FROM sales WHERE date >= date_trunc('month', current_date) GROUP BY product_id ORDER BY total_revenue DESC LIMIT 10"
}
}
Discover What Tables Exist
Your prompt:
Using sling, show me all tables in MY_PG that start with "customer_"
What the assistant executes:
{
"action": "discover",
"input": {
"connection": "MY_PG",
"pattern": "*.customer_*"
}
}
The assistant can also call get_schemata to fetch full column-level metadata for a table before writing a query — useful when you do not have the schema memorized.
Compare Two Tables
Your prompt:
Use sling to compare MY_PG.dbt_dev.core_transactions (dev) with MY_PG.finance.core_transactions (prod) — row counts, null counts, distinct counts
The assistant calls database.query twice and returns a diff summary. This replaces a manual psql session with a single sentence.
Copy Files Between Cloud Storage Systems
Your prompt:
Use sling to copy all CSV files from MY_S3 folder raw/2025/ to MY_AZURE processed/ folder
What the assistant executes:
{
"action": "copy",
"input": {
"source_location": "MY_S3/raw/2025/*.csv",
"target_location": "MY_AZURE/processed/",
"recursive": true
}
}
Run a Replication
Your prompt:
Use sling to run the replication defined in /data/pipelines/users_replication.yaml
What the assistant executes:
{
"action": "run",
"input": {
"file_path": "/data/pipelines/users_replication.yaml"
}
}
If the YAML has a syntax error, the assistant can also call replication.parse first to validate it before running.
Build an API Spec from Scratch
This is where the guided prompts shine. Tell the assistant:
Use the api_spec_create_spec prompt with spec_name="stripe_custom", connection_name="MY_STRIPE",
api_docs_url="https://docs.stripe.com/api", endpoint_names="customers,charges,subscriptions"
The MCP prompt fetches Sling’s spec documentation, browses the Stripe docs, creates the YAML file, creates the connection, and iterates until all three endpoints return data successfully. What would take 30-60 minutes of manual work runs in under 5 minutes.
A Note on the Demo Video
The Sling team recorded a full walkthrough of the MCP server in action. It covers the Claude Desktop setup, a live database query, and a replication run end-to-end:
Debugging and Logs
If a tool call fails or returns unexpected results, check the MCP logs before assuming a connection issue:
| Client | Log location |
|---|---|
| Claude Desktop | ~/Library/Logs/Claude/ (macOS) or %APPDATA%\Claude\logs\ (Windows) |
| Claude Code | claude mcp logs sling |
| VSCode | Command Palette → MCP: Show Logs |
For trace-level output from Sling itself, add DEBUG: TRACE to the env block in your MCP config:
{
"mcpServers": {
"sling": {
"command": "sling",
"args": ["mcp"],
"env": {
"SLING_CLI_TOKEN": "your-token",
"DEBUG": "TRACE"
}
}
}
}
This logs every tool action and its parameters to stderr, which the MCP client captures in the log file above.
Requirements
- Sling CLI installed and on
PATH - A valid CLI Pro token (
SLING_CLI_TOKEN) — the MCP server requires a token to authorize tool calls. Tokens are available at app.slingdata.io. - At least one connection configured in
~/.sling/env.yaml - An MCP-compatible client (Claude Desktop, Claude Code, VSCode + Copilot)
