ABAP MCP

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.

Category
访问服务器

README

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

Tool Description
abap_analyze Deep code analysis: syntax, performance, security, Clean ABAP, cyclomatic complexity. Optionally integrates SAP Code Inspector via ADT.
abap_generate Generate production-ready ABAP from natural language – classes, CDS views, RAP behaviors, OData services, unit tests, and more.
abap_explain Plain-English explanation of any ABAP code. Adjustable audience level (beginner → expert). Optional line-by-line annotations.
abap_refactor Refactor towards Clean ABAP: extract methods, modernize syntax, improve naming, add error handling, convert to OOP.
abap_search Search ABAP repository objects in a connected SAP system (requires ADT credentials).
abap_unit_test Generate ABAP Unit Test classes using ABAP Unit + Test Double Framework. Optionally run existing tests via ADT.
abap_format Format code: 2-space indentation, uppercase keywords, replace deprecated syntax (MOVE→=, SELECT *→explicit fields).
abap_docs Comprehensive documentation for ABAP keywords, statements, classes, and SAP concepts with version-specific notes.

MCP Resources

Resource URI Content
abap://syntax-reference ABAP data types, modern 7.4+ syntax, constructor expressions, string templates
abap://best-practices Clean 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

Provider Config Notes
GitHub Copilot LLM_PROVIDER=copilot Uses your existing Copilot subscription via VS Code
OpenAI LLM_PROVIDER=openai + OPENAI_API_KEY GPT-4o recommended
Anthropic LLM_PROVIDER=anthropic + ANTHROPIC_API_KEY Claude Sonnet 4.6 recommended
Azure OpenAI LLM_PROVIDER=azure-openai + endpoint/key Enterprise deployments
Ollama LLM_PROVIDER=ollama Local 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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选