get-secret
Retrieve sensitive data from Kubernetes secrets to access configuration values, API keys, or credentials stored securely within your cluster.
Instructions
Get the data from a secret
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| secret | Yes | The name of the secret | |
| namespace | No | The namespace of the secret (optional, defaults to current context namespace) |
Implementation Reference
- server.js:1752-1760 (handler)The handler function for the 'get-secret' tool. It destructures the arguments to get the secret name and optional namespace, constructs a kubectl command to fetch the secret as YAML, executes it using execAsync, and returns the stdout content or a fallback message.case "get-secret": { const { secret, namespace } = args; const nsArg = namespace ? `-n ${namespace}` : ""; const cmd = `kubectl get secret ${secret} ${nsArg} -o yaml`; const { stdout } = await execAsync(cmd); return { content: [{ type: "text", text: stdout || "No secret data found" }] }; }
- server.js:583-600 (schema)The schema definition for the 'get-secret' tool, including name, description, and input schema specifying the required 'secret' parameter and optional 'namespace'.{ name: "get-secret", description: "Get the data from a secret", inputSchema: { type: "object", properties: { secret: { type: "string", description: "The name of the secret" }, namespace: { type: "string", description: "The namespace of the secret (optional, defaults to current context namespace)" } }, required: ["secret"] } },
- server.js:1392-1394 (registration)The tool list registration handler that returns the 'tools' array, which includes the 'get-secret' tool definition, making it discoverable via the MCP listTools request.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools }; });