Skip to main content

MCPRemoteProxy

MCPRemoteProxy fronts a remote MCP server (reachable over HTTPS) with the same authentication, telemetry, and tool-filtering features that the operator applies to containerized servers. Use this when you want to apply ToolHive policies to a third-party hosted MCP endpoint.

API: toolhive.stacklok.dev/v1alpha1 · Scope: Namespaced · Short names: rp, mcprp

Example

mcpremoteproxy.yaml
apiVersion: toolhive.stacklok.dev/v1alpha1
kind: MCPRemoteProxy
metadata:
name: my-mcpremoteproxy
namespace: default
spec:
remoteUrl: <string>

Schema

spec

MCPRemoteProxySpec defines the desired state of MCPRemoteProxy

FieldTypeDescription
auditobject

Audit defines audit logging configuration for the proxy

authServerRefobject

AuthServerRef optionally references a resource that configures an embedded OAuth 2.0/OIDC authorization server to authenticate MCP clients. Currently the only supported kind is MCPExternalAuthConfig (type: embeddedAuthServer).

authzConfigobject

AuthzConfig defines authorization policy configuration for the proxy

endpointPrefixstring

EndpointPrefix is the path prefix to prepend to SSE endpoint URLs. This is used to handle path-based ingress routing scenarios where the ingress strips a path prefix before forwarding to the backend.

externalAuthConfigRefobject

ExternalAuthConfigRef references a MCPExternalAuthConfig resource for token exchange. When specified, the proxy will exchange validated incoming tokens for remote service tokens. The referenced MCPExternalAuthConfig must exist in the same namespace as this MCPRemoteProxy.

groupRefobject

GroupRef references the MCPGroup this proxy belongs to. The referenced MCPGroup must be in the same namespace.

headerForwardobject

HeaderForward configures headers to inject into requests to the remote MCP server. Use this to add custom headers like X-Tenant-ID or correlation IDs.

oidcConfigRefobject

OIDCConfigRef references a shared MCPOIDCConfig resource for OIDC authentication. The referenced MCPOIDCConfig must exist in the same namespace as this MCPRemoteProxy. Per-server overrides (audience, scopes) are specified here; shared provider config lives in the MCPOIDCConfig resource.

proxyPortinteger

ProxyPort is the port to expose the MCP proxy on


default 8080 · format int32 · min 1 · max 65535
remoteUrlrequiredstring

RemoteURL is the URL of the remote MCP server to proxy


pattern ^https?://
resourceOverridesobject

ResourceOverrides allows overriding annotations and labels for resources created by the operator

resourcesobject

Resources defines the resource requirements for the proxy container

serviceAccountstring

ServiceAccount is the name of an already existing service account to use by the proxy. If not specified, a ServiceAccount will be created automatically and used by the proxy.

sessionAffinitystring

SessionAffinity controls whether the Service routes repeated client connections to the same pod. MCP protocols (SSE, streamable-http) are stateful, so ClientIP is the default. Set to "None" for stateless servers or when using an external load balancer with its own affinity.


default "ClientIP" · enum: ClientIP | None
telemetryConfigRefobject

TelemetryConfigRef references an MCPTelemetryConfig resource for shared telemetry configuration. The referenced MCPTelemetryConfig must exist in the same namespace as this MCPRemoteProxy. Cross-namespace references are not supported for security and isolation reasons.

toolConfigRefobject

ToolConfigRef references a MCPToolConfig resource for tool filtering and renaming. The referenced MCPToolConfig must exist in the same namespace as this MCPRemoteProxy. Cross-namespace references are not supported for security and isolation reasons. If specified, this allows filtering and overriding tools from the remote MCP server.

transportstring

Transport is the transport method for the remote proxy (sse or streamable-http)


default "streamable-http" · enum: sse | streamable-http
trustProxyHeadersboolean

TrustProxyHeaders indicates whether to trust X-Forwarded-* headers from reverse proxies When enabled, the proxy will use X-Forwarded-Proto, X-Forwarded-Host, X-Forwarded-Port, and X-Forwarded-Prefix headers to construct endpoint URLs


default false

spec.audit

Audit defines audit logging configuration for the proxy

FieldTypeDescription
enabledboolean

Enabled controls whether audit logging is enabled When true, enables audit logging with default configuration


default false

spec.authServerRef

AuthServerRef optionally references a resource that configures an embedded OAuth 2.0/OIDC authorization server to authenticate MCP clients. Currently the only supported kind is MCPExternalAuthConfig (type: embeddedAuthServer).

FieldTypeDescription
kindrequiredstring

Kind identifies the type of the referenced resource.


default "MCPExternalAuthConfig" · enum: MCPExternalAuthConfig
namerequiredstring

Name is the name of the referenced resource in the same namespace.


minLength 1

spec.authzConfig

AuthzConfig defines authorization policy configuration for the proxy

FieldTypeDescription
configMapobject

ConfigMap references a ConfigMap containing authorization configuration Only used when Type is "configMap"

inlineobject

Inline contains direct authorization configuration Only used when Type is "inline"

typerequiredstring

Type is the type of authorization configuration


default "configMap" · enum: configMap | inline
spec.authzConfig.configMap

ConfigMap references a ConfigMap containing authorization configuration Only used when Type is "configMap"

FieldTypeDescription
keystring

Key is the key in the ConfigMap that contains the authorization configuration


default "authz.json"
namerequiredstring

Name is the name of the ConfigMap

spec.authzConfig.inline

Inline contains direct authorization configuration Only used when Type is "inline"

FieldTypeDescription
entitiesJsonstring

EntitiesJSON is a JSON string representing Cedar entities


default "[]"
policiesrequiredstring[]

Policies is a list of Cedar policy strings

spec.externalAuthConfigRef

ExternalAuthConfigRef references a MCPExternalAuthConfig resource for token exchange. When specified, the proxy will exchange validated incoming tokens for remote service tokens. The referenced MCPExternalAuthConfig must exist in the same namespace as this MCPRemoteProxy.

FieldTypeDescription
namerequiredstring

Name is the name of the MCPExternalAuthConfig resource

spec.groupRef

GroupRef references the MCPGroup this proxy belongs to. The referenced MCPGroup must be in the same namespace.

FieldTypeDescription
namerequiredstring

Name is the name of the MCPGroup resource in the same namespace


minLength 1

spec.headerForward

HeaderForward configures headers to inject into requests to the remote MCP server. Use this to add custom headers like X-Tenant-ID or correlation IDs.

FieldTypeDescription
addHeadersFromSecretobject[]

AddHeadersFromSecret references Kubernetes Secrets for sensitive header values.

addPlaintextHeadersmap<string, string>

AddPlaintextHeaders is a map of header names to literal values to inject into requests. WARNING: Values are stored in plaintext and visible via kubectl commands. Use addHeadersFromSecret for sensitive data like API keys or tokens.

spec.headerForward.addHeadersFromSecret[]

AddHeadersFromSecret references Kubernetes Secrets for sensitive header values.

FieldTypeDescription
headerNamerequiredstring

HeaderName is the HTTP header name (e.g., "X-API-Key")


minLength 1 · maxLength 255
valueSecretRefrequiredobject

ValueSecretRef references the Secret and key containing the header value

spec.headerForward.addHeadersFromSecret.valueSecretRef

ValueSecretRef references the Secret and key containing the header value

FieldTypeDescription
keyrequiredstring

Key is the key within the secret

namerequiredstring

Name is the name of the secret

spec.oidcConfigRef

OIDCConfigRef references a shared MCPOIDCConfig resource for OIDC authentication. The referenced MCPOIDCConfig must exist in the same namespace as this MCPRemoteProxy. Per-server overrides (audience, scopes) are specified here; shared provider config lives in the MCPOIDCConfig resource.

FieldTypeDescription
audiencerequiredstring

Audience is the expected audience for token validation. This MUST be unique per server to prevent token replay attacks.


minLength 1
namerequiredstring

Name is the name of the MCPOIDCConfig resource


minLength 1
resourceUrlstring

ResourceURL is the public URL for OAuth protected resource metadata (RFC 9728). When the server is exposed via Ingress or gateway, set this to the external URL that MCP clients connect to. If not specified, defaults to the internal Kubernetes service URL.

scopesstring[]

Scopes is the list of OAuth scopes to advertise in the well-known endpoint (RFC 9728). If empty, defaults to ["openid"].

spec.resourceOverrides

ResourceOverrides allows overriding annotations and labels for resources created by the operator

FieldTypeDescription
proxyDeploymentobject

ProxyDeployment defines overrides for the Proxy Deployment resource (toolhive proxy)

proxyServiceobject

ProxyService defines overrides for the Proxy Service resource (points to the proxy deployment)

spec.resourceOverrides.proxyDeployment

ProxyDeployment defines overrides for the Proxy Deployment resource (toolhive proxy)

FieldTypeDescription
annotationsmap<string, string>

Annotations to add or override on the resource

envobject[]

Env are environment variables to set in the proxy container (thv run process) These affect the toolhive proxy itself, not the MCP server it manages Use TOOLHIVE_DEBUG=true to enable debug logging in the proxy

imagePullSecretsobject[]

ImagePullSecrets allows specifying image pull secrets for the proxy runner These are applied to both the Deployment and the ServiceAccount

labelsmap<string, string>

Labels to add or override on the resource

podTemplateMetadataOverridesobject

ResourceMetadataOverrides defines metadata overrides for a resource

spec.resourceOverrides.proxyDeployment.env[]

Env are environment variables to set in the proxy container (thv run process) These affect the toolhive proxy itself, not the MCP server it manages Use TOOLHIVE_DEBUG=true to enable debug logging in the proxy

FieldTypeDescription
namerequiredstring

Name of the environment variable

valuerequiredstring

Value of the environment variable

spec.resourceOverrides.proxyDeployment.imagePullSecrets[]

ImagePullSecrets allows specifying image pull secrets for the proxy runner These are applied to both the Deployment and the ServiceAccount

FieldTypeDescription
namestring

Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names


default ""
spec.resourceOverrides.proxyDeployment.podTemplateMetadataOverrides

ResourceMetadataOverrides defines metadata overrides for a resource

FieldTypeDescription
annotationsmap<string, string>

Annotations to add or override on the resource

labelsmap<string, string>

Labels to add or override on the resource

spec.resourceOverrides.proxyService

ProxyService defines overrides for the Proxy Service resource (points to the proxy deployment)

FieldTypeDescription
annotationsmap<string, string>

Annotations to add or override on the resource

labelsmap<string, string>

Labels to add or override on the resource

spec.resources

Resources defines the resource requirements for the proxy container

FieldTypeDescription
limitsobject

Limits describes the maximum amount of compute resources allowed

requestsobject

Requests describes the minimum amount of compute resources required

spec.resources.limits

Limits describes the maximum amount of compute resources allowed

FieldTypeDescription
cpustring

CPU is the CPU limit in cores (e.g., "500m" for 0.5 cores)

memorystring

Memory is the memory limit in bytes (e.g., "64Mi" for 64 megabytes)

spec.resources.requests

Requests describes the minimum amount of compute resources required

FieldTypeDescription
cpustring

CPU is the CPU limit in cores (e.g., "500m" for 0.5 cores)

memorystring

Memory is the memory limit in bytes (e.g., "64Mi" for 64 megabytes)

spec.telemetryConfigRef

TelemetryConfigRef references an MCPTelemetryConfig resource for shared telemetry configuration. The referenced MCPTelemetryConfig must exist in the same namespace as this MCPRemoteProxy. Cross-namespace references are not supported for security and isolation reasons.

FieldTypeDescription
namerequiredstring

Name is the name of the MCPTelemetryConfig resource


minLength 1
serviceNamestring

ServiceName overrides the telemetry service name for this specific server. This MUST be unique per server for proper observability (e.g., distinguishing traces and metrics from different servers sharing the same collector). If empty, defaults to the server name with "thv-" prefix at runtime.

spec.toolConfigRef

ToolConfigRef references a MCPToolConfig resource for tool filtering and renaming. The referenced MCPToolConfig must exist in the same namespace as this MCPRemoteProxy. Cross-namespace references are not supported for security and isolation reasons. If specified, this allows filtering and overriding tools from the remote MCP server.

FieldTypeDescription
namerequiredstring

Name is the name of the MCPToolConfig resource in the same namespace

status

MCPRemoteProxyStatus defines the observed state of MCPRemoteProxy

FieldTypeDescription
authServerConfigHashstring

AuthServerConfigHash is the hash of the referenced authServerRef spec, used to detect configuration changes and trigger reconciliation.

conditionsobject[]

Conditions represent the latest available observations of the MCPRemoteProxy's state

externalAuthConfigHashstring

ExternalAuthConfigHash is the hash of the referenced MCPExternalAuthConfig spec

externalUrlstring

ExternalURL is the external URL where the proxy can be accessed (if exposed externally)

messagestring

Message provides additional information about the current phase

observedGenerationinteger

ObservedGeneration reflects the generation of the most recently observed MCPRemoteProxy


format int64
oidcConfigHashstring

OIDCConfigHash is the hash of the referenced MCPOIDCConfig spec for change detection

phasestring

Phase is the current phase of the MCPRemoteProxy


enum: Pending | Ready | Failed | Terminating
telemetryConfigHashstring

TelemetryConfigHash stores the hash of the referenced MCPTelemetryConfig for change detection

toolConfigHashstring

ToolConfigHash stores the hash of the referenced ToolConfig for change detection

urlstring

URL is the internal cluster URL where the proxy can be accessed

status.conditions[]

Conditions represent the latest available observations of the MCPRemoteProxy's state

FieldTypeDescription
lastTransitionTimerequiredstring

lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.


format date-time
messagerequiredstring

message is a human readable message indicating details about the transition. This may be an empty string.


maxLength 32768
observedGenerationinteger

observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.


format int64 · min 0
reasonrequiredstring

reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.


pattern ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ · minLength 1 · maxLength 1024
statusrequiredstring

status of the condition, one of True, False, Unknown.


enum: True | False | Unknown
typerequiredstring

type of condition in CamelCase or in foo.example.com/CamelCase.


pattern ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ · maxLength 316

References: