awsapimcproxy

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: CC0-1.0 Imports: 11 Imported by: 0

README

awsapimcproxy

CI codecov

A multi-profile proxy for the AWS API MCP Server.

The AWS API MCP server picks its AWS identity from the environment (AWS_API_MCP_PROFILE_NAME) at launch, so a single server can only use one profile. awsapimcproxy runs one upstream server per profile, mirrors all of their tools, and adds a profile argument to each tool. When a tool is called, the proxy picks the matching profile's process and forwards the request.

Claude Code ──stdio──▶ awsapimcproxy ──┬─ profile=dev  ─▶ aws-api-mcp-server (AWS_API_MCP_PROFILE_NAME=my-dev)
                                       └─ profile=prod ─▶ aws-api-mcp-server (AWS_API_MCP_PROFILE_NAME=my-prod)

Requirements

The upstream server is launched on demand. By default that is uvx awslabs.aws-api-mcp-server@latest, so uv must be installed (override with command in the config).

Install

go install github.com/winebarrel/awsapimcproxy/cmd/awsapimcproxy@latest

Configuration

Create a YAML config file. Values are passed through os.ExpandEnv, so values can be referenced as ${ENV_VAR} instead of being written literally.

# awsapimcproxy.yml

# Optional. Default: [uvx, awslabs.aws-api-mcp-server@latest]
# command: [uvx, awslabs.aws-api-mcp-server@latest]

profiles:
  - name: dev
    aws_profile: my-dev
    region: us-east-1
  - name: prod
    aws_profile: my-prod
    region: ap-northeast-1

Each profile launches its own upstream process:

  • aws_profile is passed as AWS_API_MCP_PROFILE_NAME.
  • region is passed as AWS_REGION.
  • env adds or overrides any other environment variables for that process.

Usage

Usage: awsapimcproxy --config=STRING [flags]

Flags:
  -h, --help             Show help.
  -c, --config=STRING    Config file path ($AWSAPIMCPROXY_CONFIG).
      --version
Claude Code

Register it as an MCP server:

{
  "mcpServers": {
    "awsapimcproxy": {
      "command": "awsapimcproxy",
      "args": ["--config", "/path/to/awsapimcproxy.yml"]
    }
  }
}

How it works

  • On startup the proxy launches the upstream server for the first profile and lists its tools.
  • Each upstream tool is re-registered with a required profile string argument (enumerated over the configured profile names). A proxy-native list_profiles tool is also added.
  • On a tool call, the proxy strips the profile argument, looks up that profile's upstream process (launching it lazily, then caching it), and forwards the call.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCommand = []string{"uvx", "awslabs.aws-api-mcp-server@latest"}

DefaultCommand is the command used to launch an upstream AWS API MCP server when the config does not override it. See https://github.com/awslabs/mcp/tree/main/src/aws-api-mcp-server

Functions

This section is empty.

Types

type Config

type Config struct {
	// Command launches the upstream AWS API MCP server. Defaults to DefaultCommand.
	Command  []string         `yaml:"command,omitempty"`
	Profiles []*ProfileConfig `yaml:"profiles"`
}

Config is the awsapimcproxy configuration file.

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig reads and validates the config file at path.

The file content is passed through os.ExpandEnv so that values can be referenced as ${ENV_VAR} instead of being written literally.

func (*Config) Profile

func (config *Config) Profile(name string) *ProfileConfig

Profile returns the config for the named profile, or nil if it is not configured.

func (*Config) ProfileNames

func (config *Config) ProfileNames() []string

ProfileNames returns the configured profile names in file order.

type Options

type Options struct {
	Config string `kong:"required,short='c',env='AWSAPIMCPROXY_CONFIG',help='Config file path.'"`
}

Options holds the command-line options.

type ProfileConfig

type ProfileConfig struct {
	Name       string            `yaml:"name"`
	AWSProfile string            `yaml:"aws_profile,omitempty"`
	Region     string            `yaml:"region,omitempty"`
	Env        map[string]string `yaml:"env,omitempty"`
}

ProfileConfig selects the AWS identity for one upstream AWS API MCP server.

Each profile launches its own upstream process. AWSProfile is passed as AWS_API_MCP_PROFILE_NAME and Region as AWS_REGION; Env adds or overrides any other environment variables for that process.

type Proxy

type Proxy struct {
	// contains filtered or unexported fields
}

Proxy is a multi-profile MCP proxy in front of the AWS API MCP server.

It launches one upstream AWS API MCP server process per AWS profile, exposes the upstream tools over stdio, and injects a required "profile" argument into each tool. On a tool call the profile selects the matching upstream process, and the call is forwarded to it.

func NewProxy

func NewProxy(config *Config, version string) *Proxy

NewProxy creates a Proxy from the given config.

func (*Proxy) Run

func (proxy *Proxy) Run(ctx context.Context) error

Run builds the proxy server and serves it over stdio until the client disconnects or ctx is cancelled.

Directories

Path Synopsis
cmd
awsapimcproxy command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL