# VME MCP Server

An intelligent Model Context Protocol (MCP) server that transforms HPE VM Essentials (VME) infrastructure management into natural language conversations. Provision VMs, manage resources, and control your infrastructure through simple English commands with Claude Code.

## Quick Start

### Installation

```bash
npm install -g vme-mcp-server
```

### Prerequisites

- Claude Desktop
- Node.js 18+ and npm  
- Access to an HPE VM Essentials (VME) instance

### 2. Configure VME API Access

**Option A: Command Line Arguments (Recommended)**

```bash
vme-mcp-server --endpoint https://your-vme-instance.com/api --token your-bearer-token
# Or use short forms:
vme-mcp-server -e https://your-vme-instance.com/api -t your-bearer-token
```

**Option B: Environment Variables**

```bash
export VME_ENDPOINT=https://your-vme-instance.com/api
export VME_TOKEN=your-bearer-token-here
```

**Option C: Configuration File**

Create a `.env` file:
```env
VME_ENDPOINT=https://your-vme-instance.com/api
VME_TOKEN=your-bearer-token-here
```

**Priority Order**: Command line arguments → Environment variables → .env files

### 3. Add to Claude Code

**Option A: Using Claude Code CLI (Recommended)**

```bash
claude mcp add vme-server -- vme-mcp-server --endpoint https://your-vme-instance.com/api --token your-bearer-token
```

**Option B: Manual Configuration**

Add to your Claude Code configuration file:

```json
{
  "mcpServers": {
    "vme-server": {
      "command": "vme-mcp-server",
      "args": ["--endpoint", "https://your-vme-instance.com/api", "--token", "your-bearer-token"]
    }
  }
}
```

**Option C: Using Environment Variables**

```json
{
  "mcpServers": {
    "vme-server": {
      "command": "vme-mcp-server",
      "env": {
        "VME_ENDPOINT": "https://your-vme-instance.com/api",
        "VME_TOKEN": "your-bearer-token"
      }
    }
  }
}
```

### 4. Restart Claude Code

```bash
claude --restart
```

### 5. Verify Installation

```bash
claude mcp list
```

You should see `vme-server` in the list of active servers.

## Usage Examples

### Basic VM Creation
```
Create a VM named "web-server-01" in the production group using Ubuntu 22.04 with 4GB memory
```

### Multi-VM Creation
```
Create VMs web01->web03 running on each node of the cluster. OS is not important. Small VMs
Provision web01 through web05 spread across all cluster nodes with Ubuntu and 4GB memory
```

### Advanced VM Provisioning
```
Provision 3 small Ubuntu VMs for testing in the dev environment on tc-lab cloud
Create VMs db01->db03 on specific nodes 1,2,3 respectively with Rocky Linux
```

## Key Features

### Natural Language Processing
- **Flexible terminology**: Use "zone" or "cloud", "small" or "4GB" interchangeably
- **Smart template matching**: "Ubuntu", "ubuntu", "Ubuntu 22.04" all work
- **Multi-VM patterns**: "web01->web03" creates web01, web02, web03

### Intelligent Distribution
- **Auto-placement**: VME cluster load balancing (default)
- **Spread strategy**: Distribute VMs across all cluster nodes
- **Specific targeting**: Assign VMs to particular nodes

### Resource Resolution
- Automatically finds the latest OS versions (Ubuntu 24.04, Rocky 9, etc.)
- Intelligent size matching (small → 4GB, medium → 8GB)
- Fallback handling for unknown resources

## Testing

```bash
# Verify API connectivity (optional)
npm run test:api

# Run comprehensive test suite
npm test
```

## Troubleshooting

### Server Not Loading
```bash
claude mcp get vme-server
claude --debug
```

### Authentication Issues
```bash
npm run test:api
```

### VM Creation Problems
Check your VME permissions and resource availability.

## Documentation

- **[CONTRIBUTING.md](./CONTRIBUTING.md)** - Development setup, testing, and contribution guidelines
- **[TESTING.md](./TESTING.md)** - Comprehensive test documentation and coverage
- **[CLAUDE.md](./CLAUDE.md)** - Architecture vision and AI-driven development roadmap

## License

ISC License - see LICENSE file for details.

---

**Need help?** Check the [troubleshooting guide](./CONTRIBUTING.md#troubleshooting) or open an issue.