@@ -255,10 +255,25 @@ process.
255255
256256# ## Run a server with secrets
257257
258- For MCP servers that require authentication tokens or other secrets, add the
259- ` secrets` field to the `MCPServer` resource. This example shows how to use a
260- Kubernetes secret to pass a GitHub personal access token to the `github` MCP
261- server.
258+ When your MCP servers require authentication tokens or other secrets, ToolHive
259+ supports multiple secrets management methods to fit your existing
260+ infrastructure. Choose the method that best suits your needs :
261+
262+ <Tabs groupId='secret-manager' queryString='secret-manager'>
263+ <TabItem value='kubernetes-native' label='Kubernetes secrets' default>
264+
265+ ToolHive can reference existing Kubernetes secrets to inject sensitive data into
266+ your MCP server pods as environment variables. This example demonstrates how to
267+ pass a GitHub personal access token to the `github` MCP server.
268+
269+ First, create the secret. The secret must exist in the same namespace as your
270+ MCP server and the key must match what you specify in the `MCPServer` resource.
271+
272+ ` ` ` bash
273+ kubectl -n production create secret generic github-token --from-literal=token=<YOUR_TOKEN>
274+ ` ` `
275+
276+ Next, define the `MCPServer` resource to reference the secret :
262277
263278` ` ` yaml {13-16} title="my-mcpserver-with-secrets.yaml"
264279apiVersion: toolhive.stacklok.dev/v1alpha1
@@ -279,20 +294,88 @@ spec:
279294 targetEnvName: GITHUB_PERSONAL_ACCESS_TOKEN
280295` ` `
281296
282- First, create the secret. Note that the secret must be created in the same
283- namespace as the MCP server and the key must match the one specified in the
284- ` MCPServer` resource.
297+ Finally, apply the MCPServer resource :
285298
286299` ` ` bash
287- kubectl -n production create secret generic github-token --from-literal=token=<YOUR_TOKEN>
300+ kubectl apply -f my-mcpserver-with-secrets.yaml
288301` ` `
289302
290- Apply the MCPServer resource :
303+ </TabItem>
304+ <TabItem value='eso' label='External Secrets Operator'>
305+
306+ [External Secrets Operator](https://external-secrets.io/) is a Kubernetes
307+ operator that integrates external secret management systems and syncs secrets
308+ into Kubernetes as native resources. This example demonstrates how to use
309+ ESO-managed secrets with your MCP server.
310+
311+ :::note
312+
313+ When you use the External Secrets Operator, your MCP server definition will look
314+ the same as the Kubernetes-native example. This is because the External Secrets
315+ Operator creates standard Kubernetes secrets from external sources.
316+
317+ :: :
318+
319+ First, create a secret using the
320+ [ExternalSecret resource](https://external-secrets.io/latest/api/externalsecret/).
321+ The exact configuration depends on your external secret management system. The
322+ secret must exist in the same namespace as your MCP server and the key must
323+ match what you specify in the `MCPServer` resource.
324+
325+ Next, define the `MCPServer` resource to reference the secret :
326+
327+ ` ` ` yaml {13-16} title="my-mcpserver-with-secrets-eso.yaml"
328+ apiVersion: toolhive.stacklok.dev/v1alpha1
329+ kind: MCPServer
330+ metadata:
331+ name: github
332+ namespace: production # Can be any namespace
333+ spec:
334+ image: ghcr.io/github/github-mcp-server
335+ transport: stdio
336+ port: 8080
337+ permissionProfile:
338+ type: builtin
339+ name: network
340+ secrets:
341+ - name: github-token
342+ key: token
343+ targetEnvName: GITHUB_PERSONAL_ACCESS_TOKEN
344+ ` ` `
345+
346+ Finally, apply the MCPServer resource :
291347
292348` ` ` bash
293- kubectl apply -f my-mcpserver-with-secrets.yaml
349+ kubectl apply -f my-mcpserver-with-secrets-eso .yaml
294350` ` `
295351
352+ </TabItem>
353+ <TabItem value='vault' label='HashiCorp Vault'>
354+
355+ HashiCorp Vault provides multiple integration methods for Kubernetes
356+ environments :
357+
358+ 1. [Vault Sidecar Agent Injector](https://developer.hashicorp.com/vault/docs/deploy/kubernetes/injector),
359+ which injects a sidecar container into your pod to fetch and renew secrets
360+ 2. [Vault Secrets Operator](https://developer.hashicorp.com/vault/docs/deploy/kubernetes/vso),
361+ which creates Kubernetes secrets from Vault secrets (similar to the External
362+ Secrets Operator)
363+ 3. [Vault CSI Provider](https://developer.hashicorp.com/vault/docs/deploy/kubernetes/csi),
364+ which mounts secrets directly into your pod as files
365+
366+ ToolHive supports the first two methods. When you use the Vault Secrets
367+ Operator, your MCP server definition will look the same as the Kubernetes-native
368+ example because the Vault Secrets Operator creates standard Kubernetes secrets
369+ from Vault.
370+
371+ The Vault Sidecar Agent Injector requires additional configuration in your
372+ ` MCPServer` resource to add the required annotations. For a complete example,
373+ see the
374+ [HashiCorp Vault integration tutorial](../tutorials/vault-integration.mdx).
375+
376+ </TabItem>
377+ </Tabs>
378+
296379# ## Mount a volume
297380
298381You can mount volumes into the MCP server pod to provide persistent storage or
0 commit comments