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

feat: unified server mode — single process for multiple services

Open filhocf opened this issue 7 months ago • 0 comments

Closes #142

Summary

Adds a unified server mode where a single process loads multiple Huawei Cloud service OpenAPI specs, drastically reducing resource usage.

Motivation

Approach Processes RAM Startup
Current (1 per service) 13+ ~2GB+ Slow
Unified 1 ~200MB Fast

Usage

export HUAWEI_SERVICES="ecs,vpc,cce,elb,nat,evs,iam"
mcp-server-unified -t stdio

Changes

  • assets/utils/unified_server.py: New UnifiedMCPServer class
    • Loads multiple OpenAPI specs based on HUAWEI_SERVICES env var
    • Prefixes tool names with service code (ecs_ListServers, vpc_ListVpcs)
    • Routes call_tool to correct OpenAPI spec based on prefix
    • Compatible with multi-tenant (#141)
    • Graceful handling of invalid OpenAPI JSONs (skip with warning)
  • New entry point: mcp-server-unified
  • Fix: CCE OpenAPI JSON trailing comma

Backward Compatibility

Existing per-service entry points (mcp-server-ecs, etc.) are unchanged. The unified server is an additional option.

Testing

Tested with 10 services (ecs, vpc, cce, elb, nat, evs, iam, dns, lts, ces): 898 tools loaded in a single process.

filhocf avatar Apr 16 '26 12:04 filhocf