README.md•13.9 kB
# MCP Cloud Services Server
[](https://www.typescriptlang.org/)
[](https://nodejs.org/)
[](https://modelcontextprotocol.io/)
[](https://www.npmjs.com/package/mcp-cloud-services)
Comprehensive MCP (Model Context Protocol) server for cloud services management. Supports AWS, Azure, and GCP with resource management, cost analysis, monitoring, and security features.
## 🎯 Ne İşe Yarar?
MCP Cloud Services Server, AI asistanlarının (Cursor, Claude Desktop, vb.) cloud kaynaklarını yönetmesi, maliyetleri analiz etmesi, monitoring yapması ve güvenlik kontrolleri gerçekleştirmesi için kapsamlı bir MCP server'dır.
### Temel Özellikler
- **☁️ Multi-Cloud Desteği**: AWS, Azure, GCP desteği
- **📊 Resource Management**: List, create, delete, start, stop operations
- **💰 Cost Analysis**: Cost breakdown, trends, billing analysis
- **📈 Monitoring**: Metrics, alarms, health checks
- **🔒 Security**: Security scanning, compliance checks, encryption analysis
- **🔐 Credential Management**: Secure credential storage and management
## 🚀 Nasıl Çalışır?
MCP Cloud Services Server, Model Context Protocol (MCP) standardını kullanarak AI asistanlarına cloud yönetim yetenekleri sağlar. Server, MCP protokolü üzerinden tool'ları expose eder ve AI asistanları bu tool'ları kullanarak cloud işlemlerini gerçekleştirebilir.
### Mimari
```
AI Assistant (Cursor/Claude)
↓ (MCP Protocol)
MCP Cloud Services Server
↓ (SDK Calls)
Cloud Provider APIs (AWS/Azure/GCP)
```
Server, her cloud provider için adapter pattern kullanarak SDK çağrılarını yönetir. Credentials güvenli bir şekilde saklanır ve yönetilir.
## 📦 Kurulum
### Gereksinimler
- Node.js 18 veya üzeri
- npm veya yarn
- TypeScript (dev dependency)
- Cloud provider credentials (AWS, Azure, or GCP)
### Adımlar
1. **Repository'yi klonlayın:**
```bash
git clone https://github.com/code-alchemist01/Cloud-mcp_server.git
cd Cloud-mcp_server
```
2. **Bağımlılıkları yükleyin:**
```bash
npm install
```
3. **Projeyi derleyin:**
```bash
npm run build
```
4. **Cloud Credentials Yapılandırın** (aşağıdaki bölüme bakın)
5. **Test edin:**
```bash
npm start
```
## 🔐 Credentials Yapılandırması
### Neden Credentials Gerekiyor?
Cloud provider'lar (AWS, Azure, GCP) güvenlik nedeniyle tüm API çağrılarında authentication gerektirir. Bu credentials, kimlik doğrulama ve yetkilendirme için kullanılır. Server, bu credentials'ları kullanarak cloud API'lerine güvenli bir şekilde bağlanır.
### AWS Credentials
AWS için **Access Key ID** ve **Secret Access Key** gereklidir. Bu credentials, AWS IAM'de oluşturulur ve gerekli izinlere sahip olmalıdır.
**Yöntem 1: Environment Variables (Önerilen)**
```bash
export AWS_ACCESS_KEY_ID=your_access_key_id
export AWS_SECRET_ACCESS_KEY=your_secret_access_key
export AWS_REGION=us-east-1
```
**Yöntem 2: AWS Credentials Dosyası**
```
~/.aws/credentials (Linux/Mac)
C:\Users\YourUsername\.aws\credentials (Windows)
[default]
aws_access_key_id = your_access_key_id
aws_secret_access_key = your_secret_access_key
```
**Yöntem 3: MCP Config İçinde**
```json
{
"mcpServers": {
"cloud-services": {
"command": "node",
"args": ["..."],
"env": {
"AWS_ACCESS_KEY_ID": "your_access_key_id",
"AWS_SECRET_ACCESS_KEY": "your_secret_access_key",
"AWS_REGION": "us-east-1"
}
}
}
}
```
**Gerekli IAM İzinleri:**
- `ec2:DescribeInstances`, `ec2:StartInstances`, `ec2:StopInstances`
- `s3:ListBuckets`, `s3:GetBucketLocation`
- `lambda:ListFunctions`, `lambda:GetFunction`
- `rds:DescribeDBInstances`
- `cloudwatch:GetMetricStatistics`
- `ce:GetCostAndUsage`
### Azure Credentials
Azure için **Service Principal** (Client ID, Client Secret, Tenant ID) veya **Azure CLI login** gereklidir. Ayrıca **Subscription ID** zorunludur.
**Yöntem 1: Environment Variables**
```bash
export AZURE_CLIENT_ID=your_client_id
export AZURE_CLIENT_SECRET=your_client_secret
export AZURE_TENANT_ID=your_tenant_id
export AZURE_SUBSCRIPTION_ID=your_subscription_id
```
**Yöntem 2: Azure CLI Login (En Kolay)**
```bash
az login
# Bu DefaultAzureCredential kullanır
export AZURE_SUBSCRIPTION_ID=your_subscription_id
```
**Yöntem 3: MCP Config İçinde**
```json
{
"mcpServers": {
"cloud-services": {
"command": "node",
"args": ["..."],
"env": {
"AZURE_CLIENT_ID": "your_client_id",
"AZURE_CLIENT_SECRET": "your_secret",
"AZURE_TENANT_ID": "your_tenant_id",
"AZURE_SUBSCRIPTION_ID": "your_subscription_id"
}
}
}
}
```
**Service Principal Oluşturma:**
```bash
az ad sp create-for-rbac --name "mcp-cloud-services" --role contributor
```
**Gerekli RBAC İzinleri:**
- `Reader` (kaynakları listeleme için)
- `Virtual Machine Contributor` (VM yönetimi için)
- `Storage Account Contributor` (storage yönetimi için)
### GCP Credentials
GCP için **Service Account JSON** dosyası veya **gcloud CLI** gereklidir. Ayrıca **Project ID** zorunludur.
**Yöntem 1: Service Account JSON (Önerilen)**
```bash
export GCP_PROJECT_ID=your_project_id
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-key.json
```
**Yöntem 2: gcloud CLI**
```bash
gcloud auth application-default login
gcloud config set project YOUR_PROJECT_ID
export GCP_PROJECT_ID=$(gcloud config get-value project)
```
**Yöntem 3: MCP Config İçinde**
```json
{
"mcpServers": {
"cloud-services": {
"command": "node",
"args": ["..."],
"env": {
"GCP_PROJECT_ID": "your_project_id",
"GOOGLE_APPLICATION_CREDENTIALS": "C:\\path\\to\\service-account-key.json"
}
}
}
}
```
**Service Account Oluşturma:**
1. GCP Console → IAM & Admin → Service Accounts
2. Create Service Account
3. Grant roles: `Compute Viewer`, `Storage Viewer`, `Cloud Functions Viewer`
4. Create JSON key ve indir
**Gerekli IAM Rolleri:**
- `Compute Viewer` (compute instance'ları görüntüleme)
- `Storage Viewer` (storage bucket'ları görüntüleme)
- `Cloud Functions Viewer` (function'ları görüntüleme)
- `Monitoring Viewer` (metrics için)
- `Billing Account Viewer` (cost analysis için)
## 📦 MCP Client'lara Kurulum
### Cursor IDE
#### 1. MCP Config Dosyasını Oluştur/Düzenle
**Windows:**
```
%APPDATA%\Cursor\User\globalStorage\mcp.json
```
**macOS/Linux:**
```
~/.config/Cursor/User/globalStorage/mcp.json
```
**Workspace-specific (Önerilen):**
```
<project-root>/.cursor/mcp.json
```
#### 2. Config İçeriği
```json
{
"mcpServers": {
"cloud-services": {
"command": "node",
"args": [
"C:\\Users\\YourUsername\\path\\to\\Cloud-mcp_server\\dist\\index.js"
],
"env": {
"AWS_ACCESS_KEY_ID": "your_key",
"AWS_SECRET_ACCESS_KEY": "your_secret",
"AWS_REGION": "us-east-1"
}
}
}
}
```
#### 3. Cursor'u Yeniden Başlatın
### Claude Desktop
#### 1. MCP Config Dosyasını Oluştur/Düzenle
**Windows:**
```
%APPDATA%\Claude\claude_desktop_config.json
```
**macOS:**
```
~/Library/Application Support/Claude/claude_desktop_config.json
```
**Linux:**
```
~/.config/Claude/claude_desktop_config.json
```
#### 2. Config İçeriği
```json
{
"mcpServers": {
"cloud-services": {
"command": "node",
"args": [
"/absolute/path/to/Cloud-mcp_server/dist/index.js"
],
"env": {
"AWS_ACCESS_KEY_ID": "your_key",
"AWS_SECRET_ACCESS_KEY": "your_secret"
}
}
}
}
```
### Diğer MCP Client'lar
Herhangi bir MCP protokolü destekleyen client için, server'ı stdio transport ile başlatın:
```json
{
"mcpServers": {
"cloud-services": {
"command": "node",
"args": ["/path/to/dist/index.js"],
"env": {
"AWS_ACCESS_KEY_ID": "...",
"AWS_SECRET_ACCESS_KEY": "..."
}
}
}
}
```
## 🛠️ Kullanım
### MCP Client'larda Kullanım
MCP server kurulduktan sonra, client'ınızın chat arayüzünde doğal dil komutları kullanarak cloud işlemlerini gerçekleştirebilirsiniz.
### Örnek Kullanımlar
**AWS:**
```
AWS'deki tüm EC2 instance'ları listele
S3 bucket'ları göster
i-1234567890abcdef0 instance'ını başlat
Lambda function'larını listele
```
**Azure:**
```
Azure'daki tüm virtual machine'leri listele
Storage account'ları göster
```
**GCP:**
```
GCP'deki tüm compute instance'ları listele
Storage bucket'ları göster
Cloud function'ları listele
```
**Cost Analysis:**
```
AWS maliyetlerini analiz et: 2024-01-01 ile 2024-01-31 arası
Servis bazlı maliyet dökümünü göster
```
**Monitoring:**
```
i-1234567890abcdef0 instance'ının CPU kullanımını göster
AWS alarm'larını listele
```
**Security:**
```
AWS kaynaklarında güvenlik açıklarını tara
CIS compliance kontrolü yap
Encryption durumunu kontrol et
```
## 📋 MCP Tools (26 Araç)
### AWS Tools (6)
- `aws_list_ec2_instances` - EC2 instance'ları listele
- `aws_list_s3_buckets` - S3 bucket'ları listele
- `aws_list_lambda_functions` - Lambda function'ları listele
- `aws_list_rds_instances` - RDS instance'ları listele
- `aws_start_ec2_instance` - EC2 instance başlat
- `aws_stop_ec2_instance` - EC2 instance durdur
### Azure Tools (2)
- `azure_list_virtual_machines` - Virtual machine'leri listele
- `azure_list_storage_accounts` - Storage account'ları listele
### GCP Tools (3)
- `gcp_list_compute_instances` - Compute instance'ları listele
- `gcp_list_storage_buckets` - Storage bucket'ları listele
- `gcp_list_cloud_functions` - Cloud function'ları listele
### Resource Management Tools (5)
- `list_resources` - Tüm cloud kaynaklarını listele
- `get_resource` - Kaynak detaylarını getir
- `start_resource` - Kaynağı başlat
- `stop_resource` - Kaynağı durdur
- `delete_resource` - Kaynağı sil (dikkatli kullanın)
### Cost Analysis Tools (3)
- `analyze_costs` - Maliyet analizi yap
- `get_cost_by_service` - Servis bazlı maliyet dökümü
- `estimate_monthly_cost` - Aylık maliyet tahmini
### Monitoring Tools (3)
- `get_metrics` - Resource metrics'lerini getir
- `list_alarms` - Monitoring alarm'larını listele
- `get_resource_health` - Resource health durumunu kontrol et
### Security Tools (4)
- `scan_security_issues` - Güvenlik açıklarını tara
- `check_compliance` - Compliance kontrolü yap
- `analyze_permissions` - IAM permission analizi
- `check_encryption` - Encryption durumunu kontrol et
## 📁 Proje Yapısı
```
Cloud-mcp_server/
├── src/
│ ├── index.ts # MCP server ana giriş noktası
│ ├── server.ts # MCP server implementasyonu
│ ├── tools/ # MCP tools
│ │ ├── aws-tools.ts # AWS specific tools
│ │ ├── azure-tools.ts # Azure specific tools
│ │ ├── gcp-tools.ts # GCP specific tools
│ │ ├── resource-management.ts # Resource management tools
│ │ ├── cost-analysis.ts # Cost analysis tools
│ │ ├── monitoring.ts # Monitoring tools
│ │ └── security.ts # Security tools
│ ├── adapters/ # Cloud provider adapters
│ │ ├── aws-adapter.ts # AWS SDK adapter
│ │ ├── azure-adapter.ts # Azure SDK adapter
│ │ └── gcp-adapter.ts # GCP SDK adapter
│ ├── utils/ # Yardımcı fonksiyonlar
│ │ ├── credential-manager.ts
│ │ ├── formatters.ts
│ │ └── validators.ts
│ └── types/ # TypeScript tip tanımları
│ └── index.ts
├── dist/ # Derlenmiş JavaScript dosyaları
├── package.json
├── tsconfig.json
└── README.md
```
## 🔧 Geliştirme
### Development Modu
```bash
npm run dev
```
### Build
```bash
npm run build
```
### Test
```bash
npm test
```
## 🔒 Güvenlik
- Credentials güvenli saklanır (~/.cloud-services-mcp/credentials.json)
- Environment variables desteği
- Input validation ve sanitization
- Error handling
- Secure credential management
**Önemli:** Credentials'ları asla kod içine hardcode etmeyin. Her zaman environment variables veya güvenli credential store kullanın.
## 📊 Çıktı Formatları
- **JSON** - Structured data responses
- **Markdown** - Raporlar ve dokümantasyon
- **Text** - Plain text output
## 🤝 Katkıda Bulunma
1. Fork edin
2. Feature branch oluşturun (`git checkout -b feature/amazing-feature`)
3. Commit edin (`git commit -m 'Add amazing feature'`)
4. Push edin (`git push origin feature/amazing-feature`)
5. Pull Request açın
## 📄 Lisans
MIT License - Detaylar için [LICENSE](LICENSE) dosyasına bakın.
## 🔗 MCP Client Desteği
Bu MCP server aşağıdaki client'lar ile uyumludur:
- ✅ **Cursor IDE** - Tam destek
- ✅ **Claude Desktop** - Tam destek
- ✅ **Anthropic API** - MCP protokolü üzerinden
- ✅ **Diğer MCP Client'lar** - Standart MCP protokolü destekleyen tüm client'lar
## 🙏 Teşekkürler
- [Model Context Protocol](https://modelcontextprotocol.io/) - MCP standardı için
- [AWS SDK](https://aws.amazon.com/sdk-for-javascript/) - AWS desteği için
- [Azure SDK](https://github.com/Azure/azure-sdk-for-js) - Azure desteği için
- [Google Cloud SDK](https://cloud.google.com/nodejs) - GCP desteği için
## 📞 İletişim
Sorularınız veya önerileriniz için issue açabilirsiniz.
---
**⭐ Bu projeyi beğendiyseniz yıldız vermeyi unutmayın!**