SAP on Azure MCP Server logo

SAP on Azure MCP Server

by ArchitectRavi

A TypeScript implementation of the Model Context Protocol (MCP) server for SAP on Azure. It provides tools for SAP HANA database management and Azure resource management.

View on GitHub

Last updated: N/A

SAP on Azure MCP Server (TypeScript Implementation)

A TypeScript implementation of the Model Context Protocol (MCP) server for SAP on Azure, providing tools for SAP HANA database management and Azure resource management.

Features

  • Multiple Transport Options: Supports STDIO, HTTP, and SSE transports
  • SAP HANA Integration: Tools for querying and managing SAP HANA databases
  • Azure VM Management: Tools for managing Azure VMs (start, stop, status)
  • Azure NSG Operations: Tools for Network Security Group management
  • Resource Monitoring: Tools for tracking system resources
  • TypeScript Implementation: Fully typed implementation with modern ECMAScript features

Installation

# Clone the repository
git clone <repository-url>
cd azsap-mcp-typescript

# Install dependencies
npm install

# Configure your environment
cp .env.example .env
# Edit .env with your SAP HANA and Azure credentials

# Build the project
npm run build

Running the Server

STDIO Transport (for Claude Desktop)

npm start

HTTP Transport (for web clients)

npm run start:http

Or with custom host/port:

node dist/server-cli.js --transport http --host localhost --port 3000

Using the Client

The package includes a client implementation that can connect to the MCP server:

# Connect to a local STDIO server
npm run client -- --transport stdio --command "node" --args "dist/server-cli.js"

# Connect to an HTTP server
npm run client -- --transport http --host localhost --port 3000

# Execute a specific tool
npm run client -- --transport http --host localhost --port 3000 --tool get_system_overview

Using as a Library

You can also use this package as a library in your own projects:

import { createServer, connectServer, AzureMCPClient } from 'azsap-mcp-typescript';

// Create and start a server
const server = createServer();
await connectServer(server, 'stdio');

// Or use the client
const client = new AzureMCPClient({
  transport: 'http',
  host: 'localhost',
  port: 3000
});

await client.connect();
const status = await client.getVmStatus('SID001', 'db', 'myResourceGroup');
console.log(status);

Docker Support

A Dockerfile is included for containerized deployment:

# Build the Docker image
docker build -t azsap-mcp-typescript .

# Run with environment variables
docker run -p 3000:3000 \
  -e HANA_HOST=your-hana-host \
  -e HANA_PORT=30215 \
  -e HANA_USER=your-user \
  -e HANA_PASSWORD=your-password \
  -e HANA_SCHEMA=your-schema \
  azsap-mcp-typescript

Claude Desktop Integration

To integrate with Claude Desktop, configure your claude_desktop_config.json file:

{
  "mcpServers": {
    "sap-hana-ts": {
      "command": "node",
      "args": ["/path/to/azsap-mcp-typescript/dist/server-cli.js"],
      "env": {
        "HANA_HOST": "your-hana-host",
        "HANA_PORT": "30215",
        "HANA_USER": "your-user",
        "HANA_PASSWORD": "your-password"
      }
    }
  }
}

Project Structure

The project follows a standard Node.js/TypeScript package structure:

├── src/                  # Source code
│   ├── index.ts          # Main entry point and library exports
│   ├── server-cli.ts     # CLI for running the server
│   ├── client-cli.ts     # CLI for running the client
│   ├── client.ts         # MCP client implementation
│   ├── hana-connection.ts # SAP HANA connection utilities
│   ├── tools/            # Tool implementations
│   │   ├── system-overview.ts
│   │   ├── disk-usage.ts
│   │   └── azure-tools/   # Azure-specific tools
│   │       └── vm-operations.ts
│   └── utils/            # Utility functions
│       ├── format.ts     # Formatting utilities
│       ├── logger.ts     # Logging configuration
│       └── types.ts      # TypeScript type definitions
├── test/                 # Test files
├── dist/                 # Compiled output (generated)
└── logs/                 # Log files (generated)

Available Tools

The server currently provides these tools:

SAP HANA Tools

  • get_system_overview: Get system status, host info, service status, and memory usage
  • get_disk_usage: Check disk space usage across volumes, data files, and log files

Azure VM Tools

  • get_vm_status: Get the current status of an Azure VM
  • start_vm: Start an Azure VM
  • stop_vm: Stop an Azure VM (with optional deallocation)
  • restart_vm: Restart an Azure VM
  • list_vms: List all VMs in a resource group or subscription

Documentation

For more information on available tools and their parameters, refer to the source code and JSDoc comments.

Testing

# Run all tests
npm test

# Run specific tests
npm test -- -t "system overview"

License

MIT