Skip to content

feat: multi-tenant support via HUAWEI_TENANTS_FILE #141

@filhocf

Description

@filhocf

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: filhocf@3b93dfa

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions