Jarred-ZA/azure-synapse-mcp-server
If you are the rightful owner of azure-synapse-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
Azure Synapse MCP Server provides secure access to Azure Synapse Analytics workspaces, enabling SQL query execution, data exploration, and pipeline management through Claude Desktop or any MCP-compatible client.
Azure Synapse MCP Server
A comprehensive Model Context Protocol (MCP) server for Azure Synapse Analytics workspace management. This server enables AI agents to interact with Azure Synapse workspaces through a standardized protocol, providing capabilities for pipeline management, artifact development, monitoring, and debugging.
Features
🚀 Pipeline Management
- Create, Update, Delete Pipelines: Full lifecycle management of Synapse pipelines
- Run Pipelines: Execute pipelines with custom parameters
- Pipeline Monitoring: Real-time monitoring of pipeline execution status
- Debug Runs: Support for debugging pipeline runs with detailed logging
📝 Artifact Management
- Notebooks: Create, update, delete, and manage Synapse notebooks
- SQL Scripts: Manage SQL scripts and stored procedures
- Datasets: Configure and manage dataset definitions
- Linked Services: Handle connections to external data sources
- Data Flows: Manage data transformation flows
📊 Monitoring & Debugging
- Pipeline Run Monitoring: Track pipeline execution status and performance
- Activity Run Details: Monitor individual activity execution within pipelines
- Trigger Monitoring: Monitor scheduled and event-based triggers
- Error Analysis: Detailed error reporting and troubleshooting capabilities
🏢 Workspace Operations
- Pool Management: Manage Spark pools and SQL pools
- Integration Runtime: Monitor and manage integration runtimes
- Access Control: View and manage workspace permissions
- Resource Monitoring: Track workspace resource usage
Installation
Prerequisites
- Node.js 18.0.0 or higher
- Azure Synapse Analytics workspace
- Azure service principal with appropriate permissions
Setup
-
Clone the repository:
git clone https://github.com/yourusername/azure-synapse-mcp-server.git cd azure-synapse-mcp-server -
Install dependencies:
npm install -
Configure environment:
cp .env.example .env # Edit .env with your Azure Synapse configuration -
Build the project:
npm run build
Configuration
Environment Variables
Create a .env file with the following configuration:
# Azure Authentication
AZURE_TENANT_ID=your-tenant-id-here
AZURE_CLIENT_ID=your-client-id-here
AZURE_CLIENT_SECRET=your-client-secret-here
# Azure Synapse Workspace
SYNAPSE_WORKSPACE_NAME=your-workspace-name
SYNAPSE_WORKSPACE_URL=https://your-workspace-name.dev.azuresynapse.net
AZURE_SUBSCRIPTION_ID=your-subscription-id
AZURE_RESOURCE_GROUP=your-resource-group
# MCP Server Configuration
MCP_SERVER_NAME=azure-synapse-mcp-server
MCP_SERVER_VERSION=1.0.0
LOG_LEVEL=info
Azure Service Principal Setup
-
Create a service principal:
az ad sp create-for-rbac --name "synapse-mcp-server" --role "Contributor" --scopes "/subscriptions/{subscription-id}/resourceGroups/{resource-group}" -
Assign Synapse permissions:
- Navigate to your Synapse workspace in Azure Portal
- Go to Access Control (IAM)
- Add role assignment: "Synapse Contributor" or "Synapse Administrator"
Usage
Running the Server
Local development:
npm run dev
Production:
npm start
With MCP Inspector (for testing):
npm run inspector
Claude Desktop Integration
Add the server to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"azure-synapse": {
"command": "node",
"args": ["/path/to/azure-synapse-mcp-server/dist/index.js"],
"env": {
"AZURE_TENANT_ID": "your-tenant-id",
"AZURE_CLIENT_ID": "your-client-id",
"AZURE_CLIENT_SECRET": "your-client-secret",
"SYNAPSE_WORKSPACE_NAME": "your-workspace-name",
"SYNAPSE_WORKSPACE_URL": "https://your-workspace-name.dev.azuresynapse.net",
"AZURE_SUBSCRIPTION_ID": "your-subscription-id",
"AZURE_RESOURCE_GROUP": "your-resource-group"
}
}
}
}
Available Tools
Pipeline Operations
create_pipeline- Create a new pipelineupdate_pipeline- Update an existing pipelinedelete_pipeline- Delete a pipelineget_pipeline- Retrieve pipeline definitionlist_pipelines- List all pipelines in workspacerun_pipeline- Execute a pipelineget_pipeline_run- Get pipeline run detailslist_pipeline_runs- List pipeline execution historycancel_pipeline_run- Cancel a running pipeline
Artifact Management
create_notebook- Create a new notebookupdate_notebook- Update notebook contentdelete_notebook- Delete a notebookget_notebook- Retrieve notebook definitionlist_notebooks- List all notebookscreate_sql_script- Create a SQL scriptupdate_sql_script- Update SQL script contentdelete_sql_script- Delete a SQL scriptget_sql_script- Retrieve SQL scriptlist_sql_scripts- List all SQL scriptscreate_dataset- Create a dataset definitionupdate_dataset- Update dataset configurationdelete_dataset- Delete a datasetget_dataset- Retrieve dataset definitionlist_datasets- List all datasetscreate_linked_service- Create a linked serviceupdate_linked_service- Update linked service configurationdelete_linked_service- Delete a linked serviceget_linked_service- Retrieve linked service definitionlist_linked_services- List all linked services
Monitoring Tools
get_activity_runs- Get activity run details for a pipelineget_trigger_runs- Monitor trigger executionslist_active_pipeline_runs- List currently running pipelinesget_pipeline_metrics- Get pipeline performance metricsget_workspace_status- Get overall workspace health status
Workspace Management
list_spark_pools- List Spark poolsget_spark_pool- Get Spark pool detailslist_sql_pools- List SQL poolsget_sql_pool- Get SQL pool detailslist_integration_runtimes- List integration runtimesget_integration_runtime- Get integration runtime details
Example Usage
Creating and Running a Pipeline
// Ask Claude in Desktop:
"Create a simple copy pipeline in Azure Synapse that copies data from a blob storage source to a SQL sink, then run it"
// The MCP server will:
// 1. Use create_pipeline to define the pipeline
// 2. Use run_pipeline to execute it
// 3. Use get_pipeline_run to monitor progress
Monitoring Pipeline Execution
// Ask Claude:
"Show me the status of all running pipelines and any failed runs from the last 24 hours"
// The MCP server will:
// 1. Use list_active_pipeline_runs to get current executions
// 2. Use list_pipeline_runs with filters for failed runs
// 3. Use get_activity_runs for detailed failure analysis
Managing Notebooks
// Ask Claude:
"Create a new Synapse notebook for data exploration with sample Spark code for reading from a data lake"
// The MCP server will:
// 1. Use create_notebook to create the notebook
// 2. Include sample PySpark code for data lake access
Development
Project Structure
src/
├── index.ts # Entry point
├── server.ts # Main MCP server setup
├── config/
│ └── config.ts # Configuration management
├── handlers/
│ ├── pipeline.handler.ts # Pipeline operation handlers
│ ├── artifact.handler.ts # Artifact operation handlers
│ ├── monitoring.handler.ts # Monitoring handlers
│ └── workspace.handler.ts # Workspace management handlers
├── services/
│ ├── azure-auth.service.ts # Azure authentication
│ ├── pipeline.service.ts # Pipeline API calls
│ ├── artifact.service.ts # Artifact API calls
│ ├── monitoring.service.ts # Monitoring API calls
│ └── workspace.service.ts # Workspace API calls
├── types/
│ ├── index.ts # Exported types
│ └── synapse.types.ts # Azure Synapse type definitions
└── utils/
├── logger.ts # Logging utility
└── error-handler.ts # Error handling utility
Available Scripts
npm run build- Build the TypeScript projectnpm run watch- Watch for changes and rebuildnpm run start- Start the MCP servernpm run dev- Build and start in development modenpm run inspector- Start with MCP inspector for testingnpm run lint- Run ESLintnpm run lint:fix- Fix ESLint issuesnpm run test- Run testsnpm run clean- Clean build artifacts
Adding New Tools
- Define the tool schema in the appropriate handler
- Implement the tool logic in the corresponding service
- Add proper error handling and logging
- Update this README with tool documentation
Authentication
Supported Authentication Methods
- Service Principal (recommended for production)
- Managed Identity (for Azure-hosted scenarios)
- Azure CLI (for development)
Required Permissions
The service principal needs the following permissions:
Azure RBAC:
ContributororReaderon the resource groupStorage Blob Data Contributor(if accessing storage)
Synapse RBAC:
Synapse ContributororSynapse AdministratorSynapse Artifact Publisher(for creating/updating artifacts)Synapse Artifact User(for reading artifacts)
Troubleshooting
Common Issues
-
Authentication Failed
- Verify service principal credentials
- Check Azure AD token expiration
- Ensure proper RBAC assignments
-
Pipeline Run Failed
- Check activity run details using
get_activity_runs - Verify linked service connections
- Review integration runtime status
- Check activity run details using
-
Artifact Not Found
- Verify artifact name spelling
- Check workspace permissions
- Ensure artifact exists in the specified workspace
Debug Mode
Enable detailed logging by setting DEBUG_MODE=true in your .env file.
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run linting and tests
- Submit a pull request
License
This project is licensed under the MIT License - see the file for details.
Support
For issues and questions:
- Create an issue in the GitHub repository
- Check the troubleshooting section
- Review Azure Synapse documentation