How oisee/odata_mcp_go works
1. Repository purpose
- This is a Go-based MCP server/bridge that sits between an MCP client and an OData service.
- Its core job is to inspect OData metadata, generate MCP tools, and translate tool calls into OData HTTP requests for both OData v2 and v4 services.
2. Top-level runtime entrypoint
- The executable lives at cmd/odata-mcp/main.go.
- Startup likely wires together: CLI/config parsing, OData service initialization, tool generation, hint loading, and one of the supported transports.
3. Primary request flow
- The main data path is:
- MCP client sends a request
- transport layer receives it
- MCP server dispatches to the bridge
- bridge calls OData client
- OData service responds
- bridge formats the result back into MCP response shape
- This is the central architecture to diagram: MCP protocol on one side, OData HTTP on the other.
4. Transport boundary
- Transport is isolated under internal/transport.
- Supported modes are:
- stdio for desktop/CLI MCP clients
- http with SSE/JSON-RPC legacy endpoints
- streamable-http for the modern MCP protocol
- The HTTP transport includes a security boundary: token auth, optional TLS, and a special restriction around binding to all interfaces.
5. MCP server layer
- internal/mcp/server.go is the protocol-facing server layer.
- It is responsible for MCP lifecycle and request routing, but it does not contain OData-specific behavior itself; that is pushed into the bridge and client layers.
- The repo also includes protocol compliance tests, which implies this layer is sensitive to exact MCP schema and version behavior.
6. Bridge layer: the core translation engine
- internal/bridge is the heart of the system.
- It turns OData metadata into MCP tool definitions and translates tool invocations back into OData operations.
- Key responsibilities include:
- generating entity-set tools
- generating function import tools
- shaping responses
- handling universal tool mode vs standard per-entity tools
- applying SAP-specific behavior where needed
7. Standard mode vs universal mode
- In standard mode, the bridge emits many named tools like entity-specific filter/get/create/update/delete actions.
- In universal mode, it emits a single odata tool and routes requests based on action, target, and params.
- Architecturally, this is a tool-generation strategy switch inside the bridge, not a separate service.
8. OData client subsystem
- internal/client handles direct communication with the OData service.
- It includes HTTP request construction, metadata retrieval, operation execution, response parsing, formatting, and CSRF-related behavior.
- This layer is the boundary where OData protocol differences, auth, cookies, and server quirks are normalized before the bridge sees the result.
9. Metadata parsing and capability detection
- internal/metadata parses service metadata for entity sets, entity types, function imports, and capabilities.
- It also supports v4-specific parsing and exposes details that drive tool generation and feature filtering.
- The parser is the key discovery stage: tool definitions are not static; they are synthesized from metadata.
10. Service-specific behavior and hints
- internal/hint plus hints.json implement a service-pattern hint system.
- Hints augment odata_service_info with known issues, workarounds, and field guidance, especially for SAP and other problematic services.
- This is a metadata-adjacent guidance layer rather than a runtime dependency of request execution.
11. Data normalization and compatibility helpers
- internal/utils contains date and numeric conversions, which matter because OData services often encode values differently across v2, v4, and SAP variants.
- internal/constants and model definitions in internal/models help centralize protocol/service-specific types and literals.
- These helpers sit between raw OData payloads and the MCP-facing response format.
12. Security and auth boundaries
- Authentication support includes basic auth, cookies, and forwarded headers in streamable HTTP mode.
- The HTTP transport security model is stricter than stdio: it requires token-based access, and TLS for non-localhost or unrestricted bindings.
- There is also explicit support for SAP CSRF handling and response/error behavior that preserves upstream failures instead of timing out silently.
13. Observability and debugging
- internal/debug/trace.go and the --trace / --trace-mcp flags support two distinct debugging views:
- tool-generation inspection
- protocol-level MCP tracing
- The repo includes many shell and Python test harnesses plus trace-capture scripts, indicating debugging is a first-class concern.
14. Testing and validation strategy
- The internal/test package contains focused tests for MCP protocol compliance, OData v2/v4 behavior, CSRF, numeric/date handling, filtering, and integration scenarios.
- At the repository root, additional scripts validate client compatibility, transport behavior, security, and regressions.
- This suggests the architecture is heavily contract-driven: protocol correctness and cross-client compatibility matter as much as functionality.
15. Build, packaging, and release pipeline
- The project is optimized for single-binary distribution via Go, with Docker support and cross-platform build scripts.
- GitHub Actions workflows handle build, security, and release automation.
- Operationally, the repo is designed for deployment as a local MCP server binary, not as a long-running cloud service.
16. Diagram boundary summary
- Draw three major zones:
- MCP client side: Claude Desktop / Claude Code / other MCP consumers
- Bridge runtime: transport → MCP server → bridge → metadata/client/hints/utils
- External OData service: v2/v4 endpoint with optional SAP-specific extensions and CSRF/auth requirements
- The most important flows are discovery-time metadata/tool generation and request-time MCP-to-OData translation.
Main entry points: bridge.go Bridge · client.go OData client · server.go MCP server · transport.go Transport
Components 21
MCP clients
Requesting MCP consumers
- MCP clients · Claude Desktop, Claude Code, and other MCP consumers
Bridge runtime
Protocol handling and OData translation
- Entrypoint · CLI startup and wiring
cmd/odata-mcp/main.go - Config · CLI flags and runtime configuration
internal/config/config.go - Transport · stdio and HTTP transport boundary
internal/transport/transport.go - stdio · Desktop and CLI MCP transport
internal/transport/stdio/stdio.go - HTTP transport · SSE and streamable HTTP endpoints with auth/TLS checks
internal/transport/http/streamable.go - Security · Token auth, TLS, and binding restrictions
internal/transport/http/security.go - MCP server · Lifecycle and request routing for MCP
internal/mcp/server.go - Bridge · Turns OData metadata into MCP tools and routes tool calls back to OData
internal/bridge/bridge.go - Tool gen · Standard and universal tool generation
internal/bridge/generators.go - Handlers · Per-tool and universal action handlers
internal/bridge/handlers.go - Universal mode · Single odata tool routed by action, target, and params
internal/bridge/handlers_universal.go - OData client · Metadata fetch, request execution, parsing, and CSRF handling
internal/client/client.go - Metadata · Parses entity sets, function imports, and capabilities
internal/metadata/parser.go - Hints · Service-specific workarounds and metadata guidance
internal/hint/hint.go - Models · Shared MCP and OData model types
internal/models/models.go - Utils · Date and numeric compatibility helpers
internal/utils/date.go - Constants · Shared OData and protocol constants
internal/constants/constants.go
OData service
External OData endpoints and service behavior
- OData service · External OData v2/v4 endpoint, including SAP-specific behavior
Tooling
Tests, traces, and release automation
- Validation suite · Protocol, integration, CSRF, and compatibility tests
internal/test/README.md - Build & release · Docker, Go builds, and GitHub Actions release workflows
Makefile
Connections 25
- MCP clients → Transport: MCP requests · Clients connect over stdio or HTTP
- Entrypoint → Config: loads · Entrypoint parses configuration and flags
- Entrypoint → Transport: starts · Wires the selected transport
- Transport → stdio: stdio · Desktop/CLI transport path
- Transport → HTTP transport: http · SSE and streamable HTTP path
- HTTP transport → Security: guards · Applies token, TLS, and binding rules
- stdio → MCP server: dispatches · Hands protocol messages to the MCP server
- HTTP transport → MCP server: dispatches · Hands HTTP transport messages to the MCP server
- MCP server → Bridge: routes · Protocol layer forwards tool and lifecycle requests
- Bridge → Metadata: discovers · Builds tools from service metadata
- Bridge → Hints: augments · Applies service-specific hints and workarounds
- Bridge → Tool gen: synthesizes · Creates tool definitions
- Tool gen → Handlers: maps · Connects generated tools to handlers
- Handlers → Universal mode: mode switch · Selects standard or universal tool routing
- Bridge → OData client: executes · Translates MCP tool calls into OData operations
- OData client → OData service: http ops · Sends metadata and entity requests
- OData service → OData client: responses · Returns payloads, errors, and auth challenges
- OData client → Utils: normalizes · Converts dates and numeric values
- OData client → Models: shapes · Uses shared response and protocol models
- Bridge → Constants: references · Uses shared literals and protocol constants
- Bridge → MCP server: returns · Formats MCP responses for the server layer
- Validation suite → MCP server: verifies · Checks protocol compliance and lifecycle behavior
- Validation suite → Bridge: verifies · Checks tool generation and translation logic
- Validation suite → OData client: verifies · Checks CSRF, parsing, and OData compatibility
- Build & release → Entrypoint: builds · Produces the distributable binary