Files
epod-adt-mcp-updatesite/install/eclipse.md
2026-11-22 20:38:35 +01:00

323 lines
18 KiB
Markdown

# Eclipse mode
In the Eclipse mode the MCP server runs inside Eclipse ADT. The server uses the ADT session of each connected ABAP
project. The server asks for no password and stores no password.
## 1. Prerequisites
- Eclipse 2024-03 or later with SAP ADT is installed.
- Eclipse runs on Java 21 or later. ADT 3.63.0 needs Java 21.
- The Eclipse workspace has an ABAP project. You can log on to the project.
- An MCP client is installed, for example Claude Code or Codex.
## 2. Install from the update site
<!-- external-only:start -->
The update site is available at two places. Both places carry the same version.
<!-- external-only:end -->
The feature "EPOD ADT MCP Server"
installs two bundles: `com.epod.adt.mcp.core` and `com.epod.adt.mcp.plugin`.
<!-- external-only:start -->
### External update site (no sign-in)
1. In Eclipse, select **Help > Install New Software...**.
2. Click **Add...**.
3. In **Location**, enter `https://git.epod.dev/erhan/epod-adt-mcp-updatesite/raw/branch/main/`.
4. Select **EPOD ADT MCP Server** in the list.
5. Click **Next**.
6. Accept the license and complete the wizard.
7. Restart Eclipse when Eclipse asks for it.
<!-- external-only:end -->
### Internal update site (SAP developers)
The internal host gives files only to a browser with a sign-in. Eclipse cannot sign in. Install from a local clone.
1. Clone the repository:
git clone https://github.tools.sap/GLOFINDEFICA/epod-adt-mcp-updatesite.git
2. In Eclipse, select **Help > Install New Software...**.
3. Click **Add...**.
4. Click **Local...**.
5. Select the cloned folder. The folder holds `compositeContent.xml`.
6. Select **EPOD ADT MCP Server** in the list.
7. Click **Next**.
8. Accept the license and complete the wizard.
9. Restart Eclipse when Eclipse asks for it.
Keep the cloned folder. Eclipse installs the updates from it, and the update check takes the download link from it
(section 11).
### Install with dropins (not tested)
CAUTION: Nobody tested this way with the two bundles of version 2.6.0. Use the update site if you can.
1. Get the two jars `com.epod.adt.mcp.core_<version>.jar` and `com.epod.adt.mcp.plugin_<version>.jar`. The folder
`<version>/plugins/` of the update site holds them.
2. Copy both jars into the folder `dropins/` of the Eclipse installation.
3. Restart Eclipse.
## 3. Start the server
1. Select **Window > Show View > Other...**.
2. Select **ABAP MCP Server > ABAP MCP Server**.
3. Click **Open**.
4. In the project table, select your ABAP project.
5. Click **Connect**. To connect all ABAP projects of the workspace, click **Connect All**.
The tab **Log** shows `Connected 1 of 1 systems.` The column **Status** of the project shows `● Connected`.
6. Click **Start Server**.
The tab **Log** shows `MCP server started on http://127.0.0.1:3000` and the client configuration block. The
button changes to **Stop Server**.
The server accepts connections from `127.0.0.1` only. Other computers cannot reach it.
To start the server at each connect, turn on **Auto-start server on connect** in the preferences (section 10).
## 4. The token
The server makes a token at the first start. The server stores the token in the Eclipse preferences of the
workspace. The server uses the same token after a restart of Eclipse.
CAUTION: The token gives access to your ABAP systems with your logon. Do not put the token into a file that other
persons can read. Do not commit the token to git.
- Click **Copy client config** to copy the client configuration block with the token. The button works only while
the server runs.
- Click **Regenerate token** when the token leaks. The old token stops working at once. Update each MCP client with
the new token.
## 5. Connect an MCP client
Each request to `/mcp` needs the header `Authorization: Bearer <token>`. In the commands below, replace `<token>`
with the token from the view. The examples use the name `epod-abap-mcp` for the client configuration. The name is
free.
### Claude Code
CAUTION: The command puts the token into the history of your shell. Remove the line from the history after the
command.
1. Run this command for your user:
claude mcp add --transport http --scope user epod-abap-mcp http://127.0.0.1:3000/mcp --header "Authorization: Bearer <token>"
2. Run `claude mcp list`. The list shows `epod-abap-mcp`.
To use the server in one project folder only, put this block into the file `.mcp.json` in that folder:
```json
{
"mcpServers": {
"epod-abap-mcp": {
"type": "http",
"url": "http://127.0.0.1:3000/mcp",
"headers": { "Authorization": "Bearer <token>" }
}
}
}
```
CAUTION: Add `.mcp.json` to the `.gitignore` file of the project. The file holds the token.
### Codex
Codex reads the token from an environment variable.
1. Add the client configuration:
codex mcp add epod-abap-mcp --url http://127.0.0.1:3000/mcp --bearer-token-env-var EPOD_ABAP_MCP_TOKEN
2. Set the variable in the terminal that starts Codex:
export EPOD_ABAP_MCP_TOKEN='<token>'
3. Start Codex in the same terminal.
`codex mcp list` shows `epod-abap-mcp` with the auth `Bearer token`.
For the editor tools, Codex needs a text in the file `AGENTS.md`. Refer to [The open editor](#the-open-editor).
The second way is a header in `~/.codex/config.toml`:
```toml
[mcp_servers.epod-abap-mcp]
url = "http://127.0.0.1:3000/mcp"
http_headers = { Authorization = "Bearer <token>" }
```
### Other MCP clients
Use the block that **Copy client config** copies:
```json
{
"mcpServers": {
"abap-adt": {
"type": "streamable-http",
"url": "http://127.0.0.1:3000/mcp",
"headers": { "Authorization": "Bearer <token>" }
}
}
}
```
The block names the entry `abap-adt`. The name is free. The block uses the type `streamable-http`.
Claude Code uses the type `http` for the same server. Use the type that your MCP client documents for a Streamable
HTTP server.
## 6. Check the connection
1. Open `http://127.0.0.1:3000/health` in a browser.
The page shows `"status": "ok"` and the version.
2. In the MCP client, ask for the tool `sap_list_systems`.
The answer lists the connected ABAP projects with their access mode.
## 7. Several ABAP projects
Each tool has the parameter `systemId`. The value is the name of the ABAP project.
- With one connected project, the server uses that project. `systemId` is optional.
- With two or more connected projects, each tool call needs `systemId`. Tell the MCP client which project to use.
The MCP client sees the names of the connected projects in the description of `systemId`.
## 8. Access mode
Each connected system has an access mode: `write` or `read-only`. A new connection starts in `write`. The column
**Mode** of the project table shows the mode.
1. Select the project in the table.
2. Click **Toggle Read-Only**.
The tab **Log** shows `System <name> is now read-only.`
A read-only system refuses these 13 tools and sends no write request to SAP: `sap_push_source`, `sap_push_source_from_file`,
`sap_push_element`, `sap_push_message`, `sap_push_fields`, `sap_create_object`, `sap_activate`, `sap_lock`,
`sap_unlock`, `sap_transport_create`, `sap_transport_release`, `sap_quick_fix`, and `sap_apply_to_editor`. `sap_quick_fix` without `fix`
only lists the proposals and works on a read-only system. All other tools work. The view stores the mode
for each project. The mode stays after a restart of Eclipse.
### The open editor
The Eclipse mode has three tools for the ABAP editor that you work in: `sap_active_editor` reads the last active ABAP
editor, `sap_editor_problems` reads the errors and warnings that this editor shows, and `sap_apply_to_editor` writes
one block into the open editor of the object that the call names. The three tools send no request to SAP.
`sap_apply_to_editor` does not save and does not activate. You save and activate in Eclipse. One Ctrl+Z undoes the
change.
`sap_apply_to_editor` writes into the active tab of the editor. For a block of another tab of a class, select that tab
first.
The write tools refuse an object that is open in an editor with changes that are not saved. An editor holds the lock
of its object from the first change until the activation or the close, also after Ctrl+Z and after a save. When the
server refuses the lock and an editor of the object is open, the result names the editor before the message of the
server. The message of the server names the lock owner. If the editor is the lock owner, close the editor to release
the lock.
Codex: copy the text below into the file `AGENTS.md` of your work folder. Without this text, Codex reads "this
method" and "here" as a file of the work folder and calls no EPOD tool.
```text
## When the user works in an open editor
Eclipse mode only. The three editor tools read and write the ABAP editor of this Eclipse. They send no request to SAP. The standalone mode has no editor tool.
`sap_active_editor` gives the last active ABAP editor: the system (the Eclipse project of the editor), the object and its tab, the state `editor saved` or `editor not saved`, the selection, the cursor line and column, and the block at the cursor (a method, a FORM, a MODULE, a declaration, or a section) from the editor text, also when the text is not saved. `full=true` gives the whole text of the tab. A form editor (a message class, a DDIC object) has no text: the result names the object and the state, and says that it gives no cursor, no block, and no text, also with `full=true`. Use it for "this method", "here", or "the open class". A given `systemId` must be the system of the editor; else the tool refuses. An editor of a project without an EPOD connection gives a refusal that names the project.
`sap_editor_problems` gives the errors and warnings that the editor shows now: the check that Eclipse runs while the user types (500 ms after the last change), the activation errors, and the ATC findings. One line each: source, severity, line, column, block, message. A problem of another tab of the same class names its tab. `severity` sets the lowest severity (default `error`).
`sap_apply_to_editor` writes one block into the open editor of the object `objectName` (required) in the system of the call (`systemId`, or the single connected system), as the user types it: a method implementation or definition, a declaration, a section, a FORM, or a MODULE. The editor need not be the last active editor. When two editors hold the object (two workbench windows), the tool takes the last active of them. The tool writes into the active tab of that editor; a block of another tab gives a refusal, and a change of the tab is a user step in Eclipse. `element` names the block; without it the tool takes the block at the cursor of that editor. `part` is `implementation` or `definition`; the default is `implementation` for a method and `definition` for a declaration, and without `element` the block at the cursor decides. An object that is not open in an editor of the system gives a refusal that names `sap_push_element`; an editor of the same name in another project is not a match. A new class method needs `signature` (one `METHODS` or `CLASS-METHODS` statement, with an optional section statement before it; default `PRIVATE SECTION`). The tool writes the definition and the implementation in one undo step. The tool does not save and does not activate. Eclipse locks the object as for a key press. One Ctrl+Z removes the change. The tool refuses a member of a chained declaration or of a `BEGIN OF` structure, and a read-only system. When Eclipse does not answer within 10 seconds (a dialog or a long job), the tool writes nothing.
An open editor holds the lock of its object from the first change until the activation or the close, also after Ctrl+Z back to the saved text and after a save. The write tools of this server see the open editors of this Eclipse:
- An editor of the object with changes that are not saved: `sap_push_source`, `sap_push_source_from_file`, `sap_push_element`, `sap_push_message`, `sap_push_fields`, `sap_activate`, `sap_lock`, and `sap_quick_fix` with `fix` refuse before any write request. The text names the object. For a source write it names `sap_apply_to_editor`. For `sap_activate` it says that the save and the activation of the editor text are user steps in Eclipse. For `sap_lock` it says that the editor holds the lock. For a message class or a DDIC object (a form editor) it says that no tool of this server writes into this editor and that the save or the close of the editor is a user step in Eclipse.
- The server refuses the lock (HTTP 403) and an editor of the object is open: the result puts the editor state before the server message: "<object> is open in an Eclipse editor of this system, and the server refused the lock. This editor can be the lock owner: ... A close of the editor releases that lock. The lock answer names the lock owner. ... Lock answer: ...". The tool does not read the lock owner; the same status covers the lock of another user.
- A write to the backend while a clean editor without a lock is open succeeds. The editor shows the old text until the user clicks into it; then Eclipse loads the new text.
When the object is open in an editor, write with `sap_apply_to_editor` and let the user save and activate. When the object is not open, use `sap_push_element` or `sap_push_source`.
```
## 9. Security log
The server writes each server start, server stop, tool call, and refused request to the file `mcp-security.log`.
Each line is one JSON object. The log holds no token and no ABAP source.
1. Click **Open log folder** in the view.
The folder `<workspace>/.metadata/.plugins/com.epod.adt.mcp.plugin/` opens.
The file rotates at 5 MB. The server keeps 5 archives. The detail level is a preference (section 10).
## 10. Preferences
Select **Window > Preferences...**. Select the page **ABAP MCP Server**.
| Field | Default | Effect |
|---|---|---|
| MCP Server Port | 3000 | The server uses the port at the next start. Change the URL in each MCP client too. |
| Auto-start server on connect | off | The server starts when you connect a project. |
| Security log detail level | Full | The value `Reduced` removes the object name and the time from a tool-call line. |
## 11. Update
<!-- external-only:start -->
- External update site: select **Help > Check for Updates**.
<!-- external-only:end -->
- Internal update site: run `git pull` in the clone. Then restart Eclipse, or select **Help > Check for Updates**.
ADT checks the known update sites at each start of Eclipse, so Eclipse offers the update.
The token and the access modes stay after an update.
### The update check
The server checks once a day for a new EPOD release. The first check runs 3 minutes after the server start. The
server reads one file, `latest.json`, from the external update site. The request holds no user data and no
identifier. The server stores the time of the last check, so a restart does not check again within 24 hours. EPOD
has no setting for the check. No tool result shows the update.
- The tab **Log** shows one line for each check, for example
`Update check: EPOD 2.14.0 is available (2026-11-15). Installed: 2.13.0. Download: <link>.`
- A popup shows a new version one time. The popup names the installed version, the download link, and the changes
of each version after the installed one. The popup stays open until you close it.
- The link comes from the update site that you installed from. A local clone gives the link of its site, and the
line and the popup also name the folder of the clone and the version that the clone holds.
- No popup shows when Eclipse reports the update itself. This is the case when the automatic update of Eclipse is
on (the ADT default) and **Available Software Sites** holds the external update site.
- A failed check writes one line to the tab **Log**, for example
`Update check: no answer from the update site (connect timeout). Next check in 24 hours.`
- The check uses the proxy of Eclipse (**Window > Preferences > General > Network Connections**).
## 12. Uninstall
1. Click **Stop Server** in the view.
2. Remove the client configuration from each MCP client:
claude mcp remove epod-abap-mcp --scope user
codex mcp remove epod-abap-mcp
3. Open **Installation Details** from the About dialog of Eclipse.
4. On the page of the installed software, select **EPOD ADT MCP Server**.
5. Click **Uninstall...** and complete the wizard.
6. Restart Eclipse.
The token stays in the file `<workspace>/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.epod.adt.mcp.plugin.prefs`.
Delete the file to remove the token.
## 13. Errors
| Symptom | Cause | Action |
|---|---|---|
| The MCP client gets HTTP 401. | The client sends no token, or an old token. | Click **Copy client config** and update the client configuration. |
| The MCP client gets HTTP 403 with the text `Forbidden`. | The request has an `Origin` header, or a `Host` header that is not local. A browser sends such a request. | Use an MCP client. The server refuses requests from a web page. |
| The tab **Log** shows `ERROR: Connect to at least one ABAP project before starting the server.` | No project is connected. | Connect a project. Click **Start Server**. |
| The tab **Log** shows `ERROR: Failed to start server:` and a reason. | An example is a port that another program uses. | Set another port in the preferences. Update the URL in each MCP client. |
| A tool returns `The destination with ID <name> is not registered.` | The ABAP project has no logon after a restart of Eclipse. | Log on to the project in Eclipse. Call the tool again. |
| A tool returns `Multiple systems connected. The call needs 'systemId'.` | Two or more projects are connected. | Tell the MCP client the project name. |
| A tool returns `System <name> is set to read-only.` | The project is read-only. | Click **Toggle Read-Only**, or use another project. |