MCP Hub
Back to servers

ABAP MCP

An AI-powered server that provides comprehensive coding assistance for SAP ABAP development, including tools for code generation, analysis, and refactoring. It integrates with various LLMs and the SAP ADT REST API to enable intelligent interaction with ABAP repository objects and best practices.

Updated
Mar 1, 2026

ABAP MCP – AI-Powered SAP Development

An ABAP Model Context Protocol (MCP) server that brings AI-driven coding assistance to SAP ABAP development. Works with VS Code Copilot, Claude Desktop, Cursor, and any MCP-compatible client. Supports multiple LLM backends including GitHub Copilot, OpenAI, Anthropic Claude, Azure OpenAI, and local models via Ollama.


Architecture

┌──────────────────────────────────────────────────────────────────┐
│                       VS Code / IDE                              │
│                                                                  │
│  ┌─────────────────────┐    ┌──────────────────────────────────┐ │
│  │  GitHub Copilot Chat│    │  MCP Client (Claude Desktop,     │ │
│  │  @abap participant  │    │  Cursor, etc.)                   │ │
│  └──────────┬──────────┘    └──────────────┬───────────────────┘ │
│             │                              │                      │
│  ┌──────────▼──────────────────────────────▼───────────────────┐ │
│  │              VS Code Extension (abap-mcp-copilot)           │ │
│  │         • Copilot @abap chat agent                          │ │
│  │         • MCP client wrapper                                │ │
│  │         • Editor commands (analyze, format)                 │ │
│  └──────────────────────────┬────────────────────────────────--┘ │
└─────────────────────────────│────────────────────────────────────┘
                              │ stdio / SSE
┌─────────────────────────────▼────────────────────────────────────┐
│                     ABAP MCP Server (Node.js)                    │
│                                                                  │
│  Tools:                          Resources:                      │
│  • abap_analyze                  • abap://syntax-reference       │
│  • abap_generate                 • abap://best-practices         │
│  • abap_explain                                                  │
│  • abap_refactor                                                 │
│  • abap_search        ◄──────── SAP ADT REST API                │
│  • abap_unit_test                                                │
│  • abap_format                                                   │
│  • abap_docs                                                     │
│                                                                  │
│  ┌─────────────────────────────────────────────────────────────┐ │
│  │              Generic LLM Provider Layer                     │ │
│  │  ┌──────────┐ ┌──────────┐ ┌────────────┐ ┌─────────────┐ │ │
│  │  │  OpenAI  │ │Anthropic │ │Azure OpenAI│ │   Ollama    │ │ │
│  │  │  GPT-4o  │ │  Claude  │ │  GPT-4o   │ │  CodeLlama  │ │ │
│  │  └──────────┘ └──────────┘ └────────────┘ └─────────────┘ │ │
│  │                    ┌────────────────┐                       │ │
│  │                    │ GitHub Copilot │                       │ │
│  │                    └────────────────┘                       │ │
│  └─────────────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────┘

Features

MCP Tools

ToolDescription
abap_analyzeDeep code analysis: syntax, performance, security, Clean ABAP, cyclomatic complexity. Optionally integrates SAP Code Inspector via ADT.
abap_generateGenerate production-ready ABAP from natural language – classes, CDS views, RAP behaviors, OData services, unit tests, and more.
abap_explainPlain-English explanation of any ABAP code. Adjustable audience level (beginner → expert). Optional line-by-line annotations.
abap_refactorRefactor towards Clean ABAP: extract methods, modernize syntax, improve naming, add error handling, convert to OOP.
abap_searchSearch ABAP repository objects in a connected SAP system (requires ADT credentials).
abap_unit_testGenerate ABAP Unit Test classes using ABAP Unit + Test Double Framework. Optionally run existing tests via ADT.
abap_formatFormat code: 2-space indentation, uppercase keywords, replace deprecated syntax (MOVE→=, SELECT *→explicit fields).
abap_docsComprehensive documentation for ABAP keywords, statements, classes, and SAP concepts with version-specific notes.

MCP Resources

Resource URIContent
abap://syntax-referenceABAP data types, modern 7.4+ syntax, constructor expressions, string templates
abap://best-practicesClean ABAP naming, DB access patterns, exception design, unit testing

VS Code Extension (@abap Copilot Agent)

Use @abap in Copilot Chat with these slash commands:

@abap /analyze          ← analyze the current file
@abap /generate a CDS view for sales order header with customer join
@abap /explain          ← explain selected code or whole file
@abap /refactor         ← clean up current file
@abap /test             ← generate unit tests for current class
@abap /docs FOR ALL ENTRIES
@abap /format           ← format and fix deprecated syntax
@abap how do I implement a BAdi?   ← free-form ABAP question

LLM Providers

ProviderConfigNotes
GitHub CopilotLLM_PROVIDER=copilotUses your existing Copilot subscription via VS Code
OpenAILLM_PROVIDER=openai + OPENAI_API_KEYGPT-4o recommended
AnthropicLLM_PROVIDER=anthropic + ANTHROPIC_API_KEYClaude Sonnet 4.6 recommended
Azure OpenAILLM_PROVIDER=azure-openai + endpoint/keyEnterprise deployments
OllamaLLM_PROVIDER=ollamaLocal inference with CodeLlama, DeepSeek-Coder

Quick Start

1. Install dependencies

npm install

2. Configure environment

cp config/example.env .env
# Edit .env with your LLM credentials and optional SAP connection

3. Build and run

npm run build
npm start              # stdio mode (for Claude Desktop / Cursor)

4. Connect to Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "abap": {
      "command": "node",
      "args": ["/path/to/ABAP_MCP/dist/server/index.js"],
      "env": {
        "LLM_PROVIDER": "openai",
        "OPENAI_API_KEY": "sk-..."
      }
    }
  }
}

5. Install the VS Code Extension

cd vscode-extension
npm install
npm run compile
# Press F5 to launch Extension Development Host, or package with vsce

Then in VS Code settings, configure:

{
  "abapMcp.llmProvider": "copilot",
  "abapMcp.sapBaseUrl": "https://your-sap-system:8000",
  "abapMcp.sapUser": "DEVELOPER"
}

SAP System Connection (Optional)

The SAP connection uses the ABAP Development Tools (ADT) REST API, available on any SAP system with ABAP 7.5+ or S/4HANA.

Required SAP authorizations:

  • S_ADT_RES – ADT resource access
  • S_DEVELOP – ABAP Workbench authorization
  • S_CODE_INS – Code Inspector (for runCodeInspector: true)

Set credentials:

SAP_BASE_URL=https://my-sap.example.com:8000
SAP_USER=DEVELOPER
SAP_PASSWORD=secret
SAP_CLIENT=100
SAP_LANGUAGE=EN

Development

npm run dev          # Run server in development mode (tsx, no build)
npm run build:watch  # Watch mode TypeScript compilation
npm run typecheck    # Type-check without building
npm test             # Run unit tests

Project Structure

ABAP_MCP/
├── src/
│   ├── server/
│   │   ├── index.ts              # MCP server entry point
│   │   ├── tools/                # MCP tool handlers
│   │   │   ├── analyze.ts        # abap_analyze
│   │   │   ├── generate.ts       # abap_generate
│   │   │   ├── explain.ts        # abap_explain
│   │   │   ├── refactor.ts       # abap_refactor
│   │   │   ├── search.ts         # abap_search
│   │   │   ├── unit-test.ts      # abap_unit_test
│   │   │   ├── format.ts         # abap_format
│   │   │   └── docs.ts           # abap_docs
│   │   └── resources/            # MCP resources
│   │       ├── abap-syntax.ts    # ABAP syntax reference
│   │       └── best-practices.ts # Clean ABAP guidelines
│   ├── sap/
│   │   ├── adt-client.ts         # SAP ADT REST API client
│   │   └── types.ts              # ABAP domain types
│   ├── llm/
│   │   ├── provider.ts           # Generic LLM interface + ABAP system prompt
│   │   ├── factory.ts            # Provider factory (reads env config)
│   │   ├── openai.ts             # OpenAI adapter
│   │   ├── anthropic.ts          # Anthropic adapter
│   │   ├── azure-openai.ts       # Azure OpenAI adapter
│   │   ├── copilot.ts            # GitHub Copilot adapter
│   │   └── ollama.ts             # Ollama (local) adapter
│   └── utils/
│       ├── config.ts             # Zod-validated env config
│       └── logger.ts             # Winston logger
├── vscode-extension/
│   ├── package.json              # VS Code extension manifest
│   └── src/
│       ├── extension.ts          # Extension activation, commands
│       ├── copilot-agent.ts      # @abap Copilot chat participant
│       └── mcp-client.ts         # MCP client wrapper
└── config/
    ├── example.env               # Configuration template
    └── mcp.json                  # MCP server config template

Adding a New LLM Provider

  1. Create src/llm/my-provider.ts implementing LLMProvider:
export class MyProvider implements LLMProvider {
  readonly name = 'my-provider';
  readonly model: string;

  async complete(messages, options) { /* ... */ }
  async *stream(messages, options) { /* ... */ }
  async healthCheck() { /* ... */ }
}
  1. Register it in src/llm/factory.ts under a new case.
  2. Add the new provider to the LLM_PROVIDER enum in src/utils/config.ts.
  3. Add a VS Code setting entry in vscode-extension/package.json.

License

MIT

Reviews

No reviews yet

Sign in to write a review