doppler_run
Execute commands with Doppler secrets automatically injected as environment variables to securely manage sensitive data during runtime.
Instructions
Run a command with Doppler secrets injected as environment variables
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| command | Yes | The command to run with Doppler secrets | |
| project | No | The Doppler project name (optional if set via doppler setup) | |
| config | No | The Doppler config name (optional if set via doppler setup) |
Implementation Reference
- src/doppler.ts:109-115 (handler)Specific handler logic for 'doppler_run' tool: constructs the 'doppler run --project X --config Y -- command' CLI invocation.case "doppler_run": parts.push("run"); if (getString("project")) parts.push("--project", getString("project")!); if (getString("config")) parts.push("--config", getString("config")!); parts.push("--", getString("command")!); // Note: doppler run doesn't support --json flag break;
- src/tools.ts:165-186 (schema)Defines the name, description, and input schema (command required, project/config optional) for the doppler_run tool.{ name: "doppler_run", description: "Run a command with Doppler secrets injected as environment variables", inputSchema: { type: "object", properties: { command: { type: "string", description: "The command to run with Doppler secrets", }, project: { type: "string", description: "The Doppler project name (optional if set via doppler setup)", }, config: { type: "string", description: "The Doppler config name (optional if set via doppler setup)", }, }, required: ["command"], }, },
- src/index.ts:27-31 (registration)Registers the list tools handler which returns all tool definitions, including doppler_run.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: toolDefinitions, }; });
- src/index.ts:34-51 (handler)MCP server request handler for calling any tool, including doppler_run, by invoking executeCommand with the tool name and arguments.server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { const result = await executeCommand(name, args || {}); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); throw new McpError(ErrorCode.InternalError, `Doppler CLI error: ${errorMessage}`); } });
- src/doppler.ts:10-36 (helper)Core helper function that builds the CLI command (via buildDopplerCommand) and executes it using Node's execSync, handling output parsing and errors.export async function executeCommand( toolName: string, args: DopplerArgs ): Promise<any> { const command = buildDopplerCommand(toolName, args); try { const output = execSync(command, { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], maxBuffer: 10 * 1024 * 1024, // 10MB buffer }); // Try to parse as JSON, if it fails return raw output try { return JSON.parse(output); } catch { return { output: output.trim() }; } } catch (error: any) { // Handle execution errors const stderr = error.stderr?.toString() || ""; const stdout = error.stdout?.toString() || ""; const message = stderr || stdout || error.message; throw new Error(`Doppler CLI command failed: ${message}`); } }