Skip to content

feat: add custom endpoint domain support for HCSO/on-premise deployments#139

Open
filhocf wants to merge 6 commits intoHuaweiCloudDeveloper:mainfrom
filhocf:main
Open

feat: add custom endpoint domain support for HCSO/on-premise deployments#139
filhocf wants to merge 6 commits intoHuaweiCloudDeveloper:mainfrom
filhocf:main

Conversation

@filhocf
Copy link
Copy Markdown

@filhocf filhocf commented Mar 26, 2026

Summary

Adds support for custom endpoint domains, enabling the MCP server to work with Huawei Cloud Stack Online (HCSO) and other on-premise deployments where the default myhuaweicloud.com domain is not reachable.

Closes #137

Problem

The current implementation hardcodes endpoints to *.myhuaweicloud.com. In HCSO on-premise environments, API endpoints use a different domain (e.g., *.hcso.customer-domain.com), making the MCP server unusable.

Changes

assets/utils/variable.py

  • Added HUAWEI_ENDPOINT_DOMAIN environment variable constant

assets/utils/model.py

  • Added endpoint_domain: Optional[str] field to MCPConfig dataclass

assets/utils/hwc_tools.py

  • Modified create_api_client() to accept endpoint_domain parameter
  • When endpoint_domain is set, replaces myhuaweicloud.com with the custom domain
  • Improved URL scheme detection (uses \".\" in endpoint instead of \"com\" in endpoint)
  • Added HUAWEI_ENDPOINT_DOMAIN to env variable mapping in load_config()

assets/utils/server.py

  • Passes self.config.endpoint_domain to create_api_client() in the tool handler

Usage

Via environment variable (recommended)

export HUAWEI_ENDPOINT_DOMAIN=\"hcso.customer-domain.com\"
uv run mcp-server-ecs -t stdio
# Endpoints become: https://ecs.{region}.hcso.customer-domain.com

Via config.yaml

service_code: ecs
transport: stdio
endpoint_domain: hcso.customer-domain.com

MCP client configuration (Kiro/Cursor/Cline)

{
  \"mcpServers\": {
    \"huawei-ecs\": {
      \"command\": \"uv\",
      \"args\": [\"run\", \"--directory\", \"/path/to/mcp-server\", \"mcp-server-ecs\", \"-t\", \"stdio\"],
      \"env\": {
        \"HUAWEI_ACCESS_KEY\": \"...\",
        \"HUAWEI_SECRET_KEY\": \"...\",
        \"HUAWEI_ENDPOINT_DOMAIN\": \"hcso.customer-domain.com\"
      }
    }
  }
}

Backward Compatibility

  • No breaking changes. When endpoint_domain is not set, behavior is identical to before.
  • Environment variable takes precedence over config.yaml value.

filhocf and others added 6 commits March 26, 2026 09:50
- Add HUAWEI_ENDPOINT_DOMAIN env var to override myhuaweicloud.com domain
- Add endpoint_domain field to MCPConfig (config.yaml + env var)
- Modify create_api_client to replace domain when endpoint_domain is set
- Pass endpoint_domain from config through server to API client

This enables usage with Huawei Cloud Stack Online (HCSO) and other
on-premise deployments where API endpoints use a different domain.

Closes HuaweiCloudDeveloper#137
…oint)

- HUAWEI_ENDPOINT_PREFIX: inject suffix into service name (e.g. '-prevnet')
  roma.region.domain → roma-prevnet.region.domain
- HUAWEI_PROJECT_ID: required for HCSO on-premise authentication
- HUAWEI_IAM_ENDPOINT: custom IAM endpoint for on-premise deployments
  Uses BasicCredentials.with_iam_endpoint() for HCSO IAM

All new parameters supported via env vars and config.yaml.
- Bump version to 0.3.1
- Add HCSO/on-premise to description and keywords
- Fix license to Apache-2.0 (matching repo LICENSE)
- Add project URLs (fork + upstream)
- Add Python 3.11-3.13 classifiers
- Add co-author
- New TenantConfig dataclass for per-tenant credentials
- HUAWEI_TENANTS_FILE env var points to JSON with tenant configs
- 'tenant' parameter injected into all tools when multi-tenant active
- call_tool resolves credentials from tenant > default_tenant > config
- Backward compatible: without HUAWEI_TENANTS_FILE, behavior unchanged
- tenants.example.json with sicar/mgi template
- .gitignore: docs/, uv.lock, tenants.json
…weiCloudDeveloper#142)

- New UnifiedMCPServer class loads multiple OpenAPI specs in one process
- HUAWEI_SERVICES env var: comma-separated service codes (e.g. ecs,vpc,cce)
- Tools prefixed with service code (ecs_ListServers, vpc_ListVpcs)
- Compatible with multi-tenant (HUAWEI_TENANTS_FILE)
- Graceful handling of invalid OpenAPI JSONs (skip with warning)
- New entry point: mcp-server-unified
- Fix: CCE OpenAPI JSON trailing comma
- readonly (default): exposes only read operations (List, Show, Get, Count, Check, Search, Query, Describe)
- full: exposes all operations including Create, Delete, Update
- Reduces tool count from ~886 to ~396 in readonly mode
- Safer for exploration, reduces LLM context overhead
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.

Support custom endpoint domain for HCSO / on-premise deployments

1 participant