
Dataproc MCP Server
Enables AI assistants to manage Google Cloud Dataproc clusters and jobs through a standardized interface. Supports cluster creation/deletion, job submission (Spark, PySpark, Hive, etc.), and serverless batch operations.
README
Dataproc MCP Server
A Model Context Protocol (MCP) server that provides tools for managing Google Cloud Dataproc clusters and jobs. This server enables AI assistants to interact with Dataproc resources through a standardized interface.
Features
Cluster Management
- List Clusters: View all clusters in a project and region
- Create Cluster: Provision new Dataproc clusters with custom configurations
- Delete Cluster: Remove existing clusters
- Get Cluster: Retrieve detailed information about specific clusters
Job Management
- Submit Jobs: Run Spark, PySpark, Spark SQL, Hive, Pig, and Hadoop jobs
- List Jobs: View jobs across clusters with filtering options
- Get Job: Retrieve detailed job information and status
- Cancel Job: Stop running jobs
Batch Operations
- Create Batch Jobs: Submit serverless Dataproc batch jobs
- List Batch Jobs: View all batch jobs in a region
- Get Batch Job: Retrieve detailed batch job information
- Delete Batch Job: Remove batch jobs
Installation
Prerequisites
- Python 3.11 or higher
- Google Cloud SDK configured with appropriate permissions
- Dataproc API enabled in your Google Cloud project
Install from Source
# Clone the repository
git clone <repository-url>
cd dataproc-mcp
# Install with uv (recommended)
uv pip install --system -e .
# Or install with pip
pip install -e .
# Install development dependencies
uv pip install --system -e ".[dev]"
Configuration
Authentication
The server supports multiple authentication methods:
-
Service Account Key (Recommended for production):
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
-
Application Default Credentials:
gcloud auth application-default login
-
Compute Engine Service Account (when running on GCE)
Required Permissions
Ensure your service account or user has the following IAM roles:
roles/dataproc.editor
- For cluster and job managementroles/storage.objectViewer
- For accessing job files in Cloud Storageroles/compute.networkUser
- For VPC network access (if using custom networks)
Usage
Running the Server
The server supports multiple transport protocols:
# STDIO (default) - for command-line tools and MCP clients
python -m dataproc_mcp_server
# HTTP - REST API over HTTP using streamable-http transport
DATAPROC_MCP_TRANSPORT=http python -m dataproc_mcp_server
# SSE - Server-Sent Events for real-time communication
DATAPROC_MCP_TRANSPORT=sse python -m dataproc_mcp_server
# Run with entry point script (STDIO only)
dataproc-mcp-server
Transport Configuration
- STDIO (default): Standard input/output communication for command-line tools and MCP clients
- HTTP: REST API over HTTP using streamable-http transport
- Server URL:
http://localhost:8000/mcp
- Accessible via web clients and HTTP-based MCP clients
- Server URL:
- SSE: Server-Sent Events for real-time bidirectional communication
- Server URL:
http://localhost:8000/sse
- Supports streaming responses and live updates
- Server URL:
Environment Variables
# Transport type (stdio, http, sse)
export DATAPROC_MCP_TRANSPORT=http
# Server host (for HTTP/SSE transports)
export DATAPROC_MCP_HOST=0.0.0.0
# Server port (for HTTP/SSE transports)
export DATAPROC_MCP_PORT=8080
# Authentication
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
MCP Client Configuration
Add to your MCP client configuration:
{
"mcpServers": {
"dataproc": {
"command": "python",
"args": ["-m", "dataproc_mcp_server"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account.json"
}
}
}
}
Testing with MCP Inspector
You can test the server using the official MCP Inspector:
# Test STDIO transport
npx @modelcontextprotocol/inspector python -m dataproc_mcp_server
# Test HTTP transport
DATAPROC_MCP_TRANSPORT=http python -m dataproc_mcp_server &
npx @modelcontextprotocol/inspector --transport http --server-url http://127.0.0.1:8000/mcp
# Test SSE transport
DATAPROC_MCP_TRANSPORT=sse python -m dataproc_mcp_server &
npx @modelcontextprotocol/inspector --transport sse --server-url http://127.0.0.1:8000/sse
The MCP Inspector provides a web interface to:
- Browse available tools and resources
- Test tool calls with custom parameters
- View real-time protocol messages
- Debug server responses
Example Tool Usage
Create a Cluster
{
"name": "create_cluster",
"arguments": {
"project_id": "my-project",
"region": "us-central1",
"cluster_name": "my-cluster",
"num_instances": 3,
"machine_type": "n1-standard-4",
"disk_size_gb": 100,
"image_version": "2.1-debian11"
}
}
Submit a PySpark Job
{
"name": "submit_job",
"arguments": {
"project_id": "my-project",
"region": "us-central1",
"cluster_name": "my-cluster",
"job_type": "pyspark",
"main_file": "gs://my-bucket/my-script.py",
"args": ["--input", "gs://my-bucket/input", "--output", "gs://my-bucket/output"],
"properties": {
"spark.executor.memory": "4g",
"spark.executor.instances": "3"
}
}
}
Create a Batch Job
{
"name": "create_batch_job",
"arguments": {
"project_id": "my-project",
"region": "us-central1",
"batch_id": "my-batch-job",
"job_type": "pyspark",
"main_file": "gs://my-bucket/batch-script.py",
"service_account": "my-service-account@my-project.iam.gserviceaccount.com"
}
}
Development
Setup Development Environment
# Install development dependencies
uv pip install --system -e ".[dev]"
# Or with pip
pip install -e ".[dev]"
Running Tests
# Run all tests
pytest
# Run with coverage
python -m pytest --cov=src/dataproc_mcp_server tests/
# Run specific test file
pytest tests/test_dataproc_client.py -v
Code Quality
# Format code
ruff format src/ tests/
# Lint code
ruff check src/ tests/
# Type checking (with VS Code + Pylance or mypy)
mypy src/
Project Structure
dataproc-mcp/
├── src/dataproc_mcp_server/
│ ├── __init__.py
│ ├── __main__.py # Entry point
│ ├── server.py # MCP server implementation
│ ├── dataproc_client.py # Dataproc cluster/job operations
│ └── batch_client.py # Dataproc batch operations
├── tests/
│ ├── __init__.py
│ ├── test_server.py
│ └── test_dataproc_client.py
├── examples/
│ ├── mcp_server_config.json
│ └── example_usage.py
├── pyproject.toml
├── CLAUDE.md # Development guide
└── README.md
Troubleshooting
Common Issues
-
Authentication Errors:
- Verify
GOOGLE_APPLICATION_CREDENTIALS
is set correctly - Ensure service account has required permissions
- Check that Dataproc API is enabled
- Verify
-
Network Errors:
- Verify VPC/subnet configurations for custom networks
- Check firewall rules for cluster communication
- Ensure clusters are in the correct region
-
Job Submission Failures:
- Verify file paths in Cloud Storage are accessible
- Check cluster has sufficient resources
- Validate job configuration parameters
Debug Mode
Enable debug logging:
export PYTHONPATH=/path/to/dataproc-mcp/src
python -c "
import logging
logging.basicConfig(level=logging.DEBUG)
from dataproc_mcp_server import __main__
import asyncio
asyncio.run(__main__.main())
"
API Reference
Tools
Cluster Management
list_clusters(project_id, region)
- List all clusterscreate_cluster(project_id, region, cluster_name, ...)
- Create clusterdelete_cluster(project_id, region, cluster_name)
- Delete clusterget_cluster(project_id, region, cluster_name)
- Get cluster details
Job Management
submit_job(project_id, region, cluster_name, job_type, main_file, ...)
- Submit joblist_jobs(project_id, region, cluster_name?, job_states?)
- List jobsget_job(project_id, region, job_id)
- Get job detailscancel_job(project_id, region, job_id)
- Cancel job
Batch Operations
create_batch_job(project_id, region, batch_id, job_type, main_file, ...)
- Create batch joblist_batch_jobs(project_id, region, page_size?)
- List batch jobsget_batch_job(project_id, region, batch_id)
- Get batch job detailsdelete_batch_job(project_id, region, batch_id)
- Delete batch job
Resources
dataproc://clusters
- Access cluster informationdataproc://jobs
- Access job information
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run the test suite and linting
- Submit a pull request
License
MIT License - see LICENSE file for details.
Support
For issues and questions:
- Check the troubleshooting section
- Review Google Cloud Dataproc documentation
- Open an issue in the repository
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。