Skip to content

feat(agentgateway): add Agent Gateway module for MCP tool discovery and invocation#103

Merged
NicoleMGomes merged 8 commits into
SAP:mainfrom
prashantrakheja:feature/add-agent-gateway-module
May 11, 2026
Merged

feat(agentgateway): add Agent Gateway module for MCP tool discovery and invocation#103
NicoleMGomes merged 8 commits into
SAP:mainfrom
prashantrakheja:feature/add-agent-gateway-module

Conversation

@prashantrakheja
Copy link
Copy Markdown
Contributor

Description

Add the Agent Gateway module (sap_cloud_sdk.agentgateway) — a framework-agnostic client for discovering and invoking MCP tools via SAP Agent Gateway.

Key capabilities:

  • Automatic flow detection: Detects LoB (BTP Destination Service) vs Customer (mTLS file-based credentials) based on environment
  • Tool discovery: Lists MCP tools from all configured servers
  • Tool invocation: Calls MCP tools with user principal propagation (jwt-bearer token exchange)
  • LLM-safe tool naming: Sanitizes and namespaces tool names to conform to LLM API constraints (64 chars, ^[a-zA-Z0-9-_]+$)
  • LangChain integration: Converter to transform MCP tools into LangChain StructuredTool objects

Type of Change

  • New feature (non-breaking change that adds functionality)

How to Test

from sap_cloud_sdk.agentgateway import create_client

# Customer agent flow (reads servers from credentials integrationDependencies)
agw_client = create_client()
tools = await agw_client.list_mcp_tools()
result = await agw_client.call_mcp_tool(tool=tools[0], user_token="jwt")

# LoB agent flow (uses BTP Destination Service)
agw_client = create_client(tenant_subdomain="my-tenant")
tools = await agw_client.list_mcp_tools()
result = await agw_client.call_mcp_tool(tool=tools[0], user_token="jwt")

Unit tests:

uv run pytest tests/agentgateway/unit/ -v

Checklist

  • My code follows the project's Code Guidelines
  • I have added type hints for all public APIs
  • I have added unit tests covering the new functionality
  • I have added or updated the user guide (user-guide.md) in the module directory
  • All existing tests pass locally
  • My commits follow Conventional Commits format
  • No confidential or SAP-internal information is included

…nd invocation

Add framework-agnostic client for discovering and invoking MCP tools
via SAP Agent Gateway. Supports both LoB (BTP Destination Service) and
Customer (mTLS file-based credentials) authentication flows.
@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented May 11, 2026

CLA assistant check
All committers have signed the CLA.

@prashantrakheja prashantrakheja marked this pull request as ready for review May 11, 2026 15:12
@prashantrakheja prashantrakheja requested a review from a team as a code owner May 11, 2026 15:12
Signed-off-by: Prashant <prashant.rakheja@sap.com>
@NicoleMGomes
Copy link
Copy Markdown
Contributor

Missing user-guide.md

prashantrakheja and others added 2 commits May 11, 2026 22:23
Signed-off-by: Prashant <prashant.rakheja@sap.com>
@NicoleMGomes NicoleMGomes merged commit 51e5308 into SAP:main May 11, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants