mcp-server icon indicating copy to clipboard operation
mcp-server copied to clipboard

feat: multi-tenant support via HUAWEI_TENANTS_FILE

Open filhocf opened this issue 7 months ago • 0 comments

Problem

Currently, the MCP server supports only a single set of credentials (AK/SK) configured via environment variables. In enterprise environments with multiple Huawei Cloud tenants (e.g., different departments or clients sharing the same HCSO on-premise), operators need to run separate MCP server instances per tenant, which is resource-intensive.

Proposed Solution

Add HUAWEI_TENANTS_FILE env var pointing to a JSON file that defines multiple tenants with their own credentials and endpoint configurations. Each tool call accepts an optional tenant parameter.

Tenants file format

{
  "default": "tenant-a",
  "tenants": {
    "tenant-a": {
      "ak": "...", "sk": "...", "project_id": "...",
      "endpoint_domain": "hcso.example.com",
      "endpoint_prefix": "-internal",
      "iam_endpoint": "https://iam-pub.region.hcso.example.com",
      "region": "region-1"
    },
    "tenant-b": { "ak": "...", "sk": "...", "project_id": "..." }
  }
}

Behavior

  • HUAWEI_TENANTS_FILE set → tenant parameter injected into all tools
  • No tenant in call → uses default tenant from JSON
  • No HUAWEI_TENANTS_FILE → behavior unchanged (backward compatible)
  • Per-tenant fields override global config; unset fields fall back to defaults

Use Case

Managing resources across multiple Huawei Cloud tenants from a single MCP server instance, particularly useful for HCSO on-premise deployments serving multiple government agencies.

Related to #137 (custom endpoint domain support).

Implementation available at: https://github.com/filhocf/hcso-mcp-server/commit/3b93dfa

filhocf avatar Apr 16 '26 12:04 filhocf