Summary
Turn any OData V2 or V4 service, SAP Gateway included, into MCP tools for Claude, ChatGPT and Copilot. Reads $metadata for labels, keys and units. No code.
TL;DR: AnythingMCP has an OData connector type. Point it at an OData V2 or V4 service, or at an SAP Gateway, and Claude, ChatGPT and Copilot get five tools to find services, read their entity sets and fields with their business labels, query rows and fetch one entity by key. Queries are checked against $metadata before they are sent, server paging is followed, and V2 and V4 answers come back as plain rows. You can also import a service's $metadata as named tools, one list and one get tool per entity set.
| Facts | |
|---|---|
| Protocols | OData V2 and V4, detected from $metadata |
| SAP | Gateway service catalog (V2 and V4), sap-client, sap-language, CSRF tokens for writes |
| Built-in tools | 5, read-only: list services, describe service, describe entity, query, get entity |
| Import | $metadata → <set>_list and <set>_get tools per entity set |
| Auth | Every REST method: Basic, OAuth 2.0, API key, certificates, login token |
| Tested | Northwind V2 and V4 and TripPin V4 on services.odata.org |
| Hosting | Self-hosted (open source, AGPL-3.0) or AnythingMCP Cloud |
Why OData needs more than a REST import
An OData service describes itself. Its $metadata document lists every entity set, its keys, the type of every field and, in SAP's case, the label a user sees on screen, the currency or unit that belongs to each amount, and which fields are dimensions and which are measures. A generic REST import throws most of that away, so the model has to guess that NetAmount is in TransactionCurrency, or that an analytical service must be filtered by a parameter.
The OData connector reads $metadata and hands it to the model. Claude sees that NetAmount is labelled Net Amount and carries its currency in TransactionCurrency, and when it misspells a field, the connector answers "Unknown field … Did you mean …" instead of passing the error on to the server.
Two ways to get it
- The OData connector type. Pick OData when you create a connector. Tick SAP Gateway (S/4HANA, ECC, BW) for an SAP system: the base URL is the host, e.g.
https://s4.example.com:44300, and services come from SAP's catalog. Leave it unticked for a single OData service: the base URL is the service root, e.g.https://services.example.com/odata/v4/Sales. - A REST connector with OData settings. A REST connector whose settings carry an
odatablock gets the same built-in tools; its own tools stay plain REST calls. The SAP S/4HANA Cloud adapter works this way.
Both run on the REST engine, so every REST authentication method applies, as do retries, the outbound SSRF guard and the proxy.
Built-in tools
Every OData connector gets five tools, named <prefix>_…. The prefix is the connector name plus _odata, or one you set.
| Tool | What it does |
|---|---|
<prefix>_list_services | SAP: searches the Gateway service catalog, V2 and V4, cached for an hour. Otherwise the services listed in the settings, or the single service root. |
<prefix>_describe_service | Entity sets with their labels, keys and number of fields, flagged analytical (the server aggregates), parameters (a parameterised view), requiredInFilter or readOnly. $metadata is cached for 24 hours. |
<prefix>_describe_entity | Every field with label, type, key, its currency or unit field, its text field, whether it can be filtered and sorted, and its dimension or measure role; navigation properties; hints for analytical and parameterised sets. |
<prefix>_query | select, filter, orderby, top (up to 1,000), skip, expand, parameters, and V4 apply and search. Field names are checked first, required filters are enforced, server paging is followed on the connector's own host only, and the answer is flattened: plain rows, ISO dates, decimals as strings, the total count and nextSkip. |
<prefix>_get_entity | One entity by key, including composite keys such as {"SalesOrder": "1", "SalesOrderItem": "10"}. |
The built-ins only read and are marked read-only for MCP clients.
Setup
Step 1: Run AnythingMCP
For a public OData service, AnythingMCP Cloud works as is. For an SAP Gateway or any service on your own network, self-host AnythingMCP where it can reach the service:
mkdir anythingmcp && cd anythingmcp
curl -fsSLo docker-compose.yml \
https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d # → http://localhost:3000
Add internal host names to SSRF_ALLOWED_HOSTS; AnythingMCP refuses private addresses by default.
Step 2: Create an OData connector
Create a new connector, choose OData and enter the base URL. To try it without an account anywhere, use the public Northwind service: https://services.odata.org/V4/Northwind/Northwind.svc, SAP Gateway unticked, no authentication. For SAP, tick SAP Gateway and enter the three-digit client and the language.
Step 3: Set authentication and restrict services
Choose the authentication your service expects: Basic auth with a technical user, OAuth 2.0 (client credentials or authorization code), an API key, a client certificate or a login token. Under the connector's OData settings, list the service paths the model may call in Allowed services (* works as a wildcard); other services are refused.
Step 4: Test and import tools
Test connection reads the SAP catalog or the service's $metadata. If you want named tools for the entity sets the model uses most, open Import Tools → OData $metadata, give the service path (SAP) or leave it empty (single service), and pick the entity sets. See below.
Step 5: Connect Claude, ChatGPT or Copilot
- Claude: Customize → Connectors → Add custom connector, paste your MCP server URL. Step by step: how to add a custom connector to Claude.
- ChatGPT: add the same public HTTPS URL as a connector (app) in ChatGPT's settings.
- Claude Code, Cursor, VS Code / Copilot: add the URL with an
X-API-Keyheader.
Importing tools from $metadata
Import Tools → OData $metadata turns entity sets into named tools: <set>_list with filter, select, orderby, top, skip and expand, and <set>_get with the key parameters. The document is fetched with the connector's credentials; you can also paste a $metadata document and limit the import to some entity sets. Re-importing a service updates its tools and retires only that service's tools that disappeared, never the built-ins or another service's tools.
On an OData connector, imported and hand-written HTTP tools get the SAP client and language, JSON format for V2 and flattened answers. SAP writes (POST, PUT, PATCH, DELETE) fetch a CSRF token with the session cookies first. Writes only happen through tools you import or write yourself.
SAP Gateway: S/4HANA, ECC and BW
- A technical user of type System, with a productive password, in the client you want to read.
- A role with
S_SERVICEfor the services the model may call and display-only business authorizations. For catalog browsing, also the V2 catalog service/IWFND/CATALOGSERVICEand the V4 catalog. SAP checks these authorizations on every call; they are the real boundary. - Active services in
/IWFND/MAINT_SERVICE(V2) and/IWFND/V4_ADMIN(V4). - Network: the Gateway port is usually internal. Self-host AnythingMCP inside the network or reach it through a VPN.
SAP's API policy expects third-party integrations to use published APIs (the API_* services on the SAP Business Accelerator Hub) or services you built yourself; restrict Allowed services accordingly.
For S/4HANA on-premise and Private Cloud there is a ready adapter, SAP S/4HANA (OData). It sets all of this up with the s4 prefix (s4_list_services, s4_describe_service, s4_describe_entity, s4_query, s4_get_entity) and adds ready tools for journal entry items, billing documents, sales orders, business partners, material stock and products, plus s4_guide, a guide to filters, analytical services and KPIs. It installs with Basic auth, and you can switch the connector to OAuth 2.0. The SAP S/4HANA Cloud adapter carries the same built-ins as s4_cloud_* over its communication-arrangement APIs.
If you would rather read S/4HANA's tables directly, see SAP S/4HANA via HANA SQL.
Settings
| Setting | Meaning |
|---|---|
| SAP Gateway | Catalog discovery and SAP parameters. Implied by an SAP client. |
| SAP client | Three-digit client, sent as sap-client on every request. |
| Language | Sent as sap-language, e.g. EN. |
| Allowed services | Service paths the model may call, * as wildcard. |
| Version | v2 or v4, to override detection from $metadata. |
| Max rows | Row cap per query, at most 1,000. |
| Tool prefix | Prefix of the built-in tool names. |
Each setting can hold {{VARIABLES}} from the connector's environment variables.
Example prompts
- "Which services in the catalog deal with billing documents?"
- "Describe the sales order entity: which fields are amounts, and in which currency?"
- "Net sales per sales organization for September, from the billing documents."
- "Show sales order 1 with all its items."
- On Northwind: "Which ten products have the highest unit price, and which supplier delivers them?"
FAQ
Which OData versions are supported?
V2 and V4. The version is detected from $metadata; you can override it in the settings.
Do I need to convert $metadata to OpenAPI first?
No. The OData connector reads $metadata directly, and Import Tools → OData $metadata creates the tools from it.
Can Claude change data through OData? Not through the five built-in tools, which only read. Writes need tools you import or write yourself, and an MCP server role can leave them out; SAP writes fetch the CSRF token automatically.
Does it work with SAP S/4HANA on-premise and ECC? Yes, through SAP Gateway, with a self-hosted AnythingMCP that can reach it. The SAP S/4HANA (OData) adapter is the quickest start for S/4HANA.
How are large results handled?
A query returns at most 1,000 rows. The connector follows the server's paging on the same host and returns nextSkip, so the model can ask for the next page.
Does it work with ChatGPT and Copilot as well? Yes. The same MCP server works in Claude, ChatGPT, GitHub Copilot, Cursor and Claude Code.
Related
- Connect SAP to Claude: every SAP connector at a glance
- SAP S/4HANA via HANA SQL: the database route, with SAP's data dictionary as tools
- OpenAPI to MCP: REST APIs with an OpenAPI or Swagger spec
- SOAP to MCP: WSDL services
- OData in the AnythingMCP docs
Was this guide helpful?