[BUG] Chart's kagent-api RemoteMCPServer never discovers tools under server.auth.mode: trusted-proxy (401 on initialize)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- go, helm, kubernetes
Línea de trabajo
Start with go/core/internal/service/tool/mcp.go and go/core/internal/httpserver/auth/proxy_authn.go, then inspect helm/kagent/templates/toolserver-api.yaml and the service account authentication configuration. Trace how control-plane discovery authenticates to the controller's own MCP endpoint and confirm the intended credential and audience. Done means kagent-api is accepted and discovers its tools in trusted-proxy mode without a user token.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
📋 Prerequisites
- I have searched the existing issues to avoid creating a duplicate
- By submitting this issue, you agree to follow our Code of Conduct
- I am using the latest version of the software
- I have tried to clear cache/cookies or used incognito mode (if ui-related)
- I can consistently reproduce this issue
🎯 Affected Service(s)
Controller Service
🚦 Impact/Severity
Minor inconvenience
🐛 Bug Description
With config.server.auth.mode: trusted-proxy, the controller can't discover the tools on its own MCP endpoint. The Helm chart creates the RemoteMCPServer kagent-api (helm/kagent/templates/toolserver-api.yaml), and that object stays Accepted=False with reason DiscoveryFailed. The sessions, checkpoints and sandboxes tools never show up, so agents can't use them.
The controller authenticates /mcp with ProxyAuthenticator. That authenticator rejects any request without exactly one Authorization: Bearer <JWT> header (go/core/internal/httpserver/auth/proxy_authn.go:28-36). Discovery comes from the controller itself, through RuntimeMCPClient.connect (go/core/internal/service/tool/mcp.go:124). The only headers it sends are the ones the RemoteMCPServer resolves (server.ResolveHeaders, line 138), and the chart's kagent-api server defines none. connect also explicitly refuses actorJwt for control-plane calls (line 130). So the call reaches the controller with no credential and gets a 401.
Enabling config.server.auth.serviceAccount (the ServiceAccountProvider, audience kagent-invocation) doesn't help, because the discovery client never sends a service account token.
My guess is that this went unnoticed because trusted-proxy was only wired end to end recently (#2968). Before that the controller always ran unsecure, so self-discovery never had to authenticate.
🔄 Steps To Reproduce
Reproduced on 2026-11-03 on a local kind cluster, from a clean checkout of main at e3b80793, using the repository's own dev targets.
- Create the cluster and install kagent with Substrate and the dev database. The default auth mode is
insecure.git clone https://github.com/kagent-dev/kagent && cd kagent make create-kind-cluster make build kagent-cli-deploy - Confirm that
kagent-apidiscovers its tools in the default mode:kubectl --context kind-kagent -n kagent get remotemcpserver kagent-api \ -o jsonpath='{.status.conditions[?(@.type=="Accepted")].message}{"\n"}' # Discovered 19 MCP tools - Switch the controller to
trusted-proxy.grpcReflectionis only needed for the optionalgrpcurlcheck in step 6.helm --kube-context kind-kagent -n kagent upgrade kagent "dist/kagent-$(git describe --tags --always).tgz" \ --reuse-values \ --set config.server.auth.mode=trusted-proxy \ --set config.server.auth.userIdClaim=email \ --set config.server.grpcReflection=true --wait kubectl --context kind-kagent -n kagent rollout status deploy/kagent-controller - Force a fresh discovery, so the status doesn't still come from the
insecurerun. The reconciler watches label changes.kubectl --context kind-kagent -n kagent label remotemcpserver kagent-api repro="$(date +%s)" --overwrite - Read the status and the controller logs:
kubectl --context kind-kagent -n kagent get remotemcpserver kagent-api \ -o jsonpath='{range .status.conditions[*]}{.type}={.status} {.reason}: {.message}{"\n"}{end}' # Accepted=False DiscoveryFailed: Failed to connect to MCP server: failed to connect MCP client: calling "initialize": sending "initialize": Unauthorized kubectl --context kind-kagent -n kagent logs deploy/kagent-controller | grep -m1 'Reconciler error' - (Optional) A signed-in user calling a
kagent-apitool through the API fails the same way. Undertrusted-proxythe controller reads the token'semailclaim without verifying the signature, so an unsigned test token works:
Settingb64() { printf '%s' "$1" | base64 | tr '+/' '-_' | tr -d '='; } TOKEN="$(b64 '{"alg":"HS256","typ":"JWT"}').$(b64 '{"email":"[email protected]"}').dGVzdA" kubectl --context kind-kagent -n kagent run grpcurl --rm -i --restart=Never --image=fullstorydev/grpcurl:v1.9.3 -- \ -plaintext -H "authorization: Bearer $TOKEN" \ -d '{"server":{"ref":{"namespace":"kagent","name":"kagent-api"},"group_kind":"RemoteMCPServer.api.kagent.dev"},"tool_name":"list_agents"}' \ kagent-controller.kagent.svc.cluster.local:8083 kagent.api.v1.ToolService/CallMCPAppTool # ERROR: Code: Internal Message: internal server errorconfig.server.auth.mode=insecureagain and repeating step 4 brings backAccepted=Truewith 19 tools.
🤔 Expected Behavior
kagent-api is Accepted=True and its tools are discovered, the same as with mode: insecure. The controller's calls to its own endpoint authenticate with a credential the controller can verify, without a user token and without needing an authenticating proxy in front of the controller.
📱 Actual Behavior
The RemoteMCPServer status:
Accepted=False reason=DiscoveryFailed
message: Failed to connect to MCP server: failed to connect MCP client: calling "initialize": sending "initialize": Unauthorized
The controller logs Reconciler error for RemoteMCPServer kagent/kagent-api, retrying with backoff.
💻 Environment
- Kubernetes version: 1.37
- Kubernetes provider: AWS (EKS)
- Application version: kagent 1.0.0-rc1 (chart and images). The code involved is unchanged on
mainat 3b28b6b7. - Agent Substrate 1.0.0-rc1
- Also reproduced on kind (Kubernetes 1.35,
make create-kind-cluster) frommainate3b80793, with the steps above.
🔍 Additional Context
- Did this work before? On 1.0.0-alpha17 with the same values,
kagent-apidiscovered its tools. That release never actually appliedtrusted-proxy(#2968), so it wasn't really a working configuration. - Workarounds:
mode: insecuremakes discovery work, but it gives up per-user identity, so it isn't usable for us.- Putting a static
Authorizationheader on theRemoteMCPServerthroughheadersFromwould mean minting a long-lived token. Undertrusted-proxythat token would be an unverified user JWT. We don't want either.
- Possible fix, for maintainers to confirm: for control-plane MCP calls to the controller's own endpoint,
RuntimeMCPClientcould attach a projected service account token with audiencekagent-invocation, and the existingServiceAccountProviderwould verify it. The chart would then enableserver.auth.serviceAccountwhenevermodeistrusted-proxy, or the controller would always trust its own service account. I'm happy to work through the approach here or in#kagent-devbefore opening a PR.
📋 Logs
$ kubectl -n kagent get remotemcpserver kagent-api
NAME PROTOCOL URL ACCEPTED
kagent-api STREAMABLE_HTTP http://kagent-controller.kagent.svc.cluster.local:8083/mcp False
🙋 Are you willing to contribute?
- I am willing to submit a PR to fix this issue
- Lenguaje dominante
- Go
- Estrellas
- 4.5k
- Forks
- 937
- Merge medio
- 1 d 10 h
- PR fusionados (30 d)
- 150
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de kagent-dev/kagent
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
kagent-dev/kagent#3792 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
kagent-dev/kagent#3790 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
kagent-dev/kagent#3789 ·
Los mantenedores suelen responder en 1 día
-
[BUG] A2A lookups by task or context ID reveal whether another user's resource existsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
kagent-dev/kagent#3787 ·
Los mantenedores suelen responder en 1 día
-
[BUG] Python memory summarization fails for Gemini models: the request has no model namePosiblemente ocupada @BahaaMattar la tomó hace 7 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
kagent-dev/kagent#3710 ·
Los mantenedores suelen responder en 1 día
Todos los issues de kagent-dev/kagent
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
limitlessprojects/Go-Hybrid#4764 ·
Los mantenedores suelen responder en 1 día
-
[bug]: lint fails on main, generated CLI docs out of datePosiblemente ocupada @bupd la tomó hoy. Abiertobug documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
goharbor/harbor-cli#1180 ·
Los mantenedores suelen responder en 1 día
-
crane: mutate --env adds duplicate PATH on Windows images when key case differsPosiblemente ocupada @aad1tyaaaaa la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
google/go-containerregistry#2523 ·
Los mantenedores suelen responder en 4 días
-
bosh_io_stemcell_type: regular does not work for noble and resolute as it adds -go_agent as suffixAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
cloudfoundry/bosh-deployment-resource#138 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100