Skip to main content
Glama
keywaysh

Keyway MCP Server

by keywaysh

keyway_set_secret

Create or update secrets in a secure vault using uppercase naming conventions like DATABASE_URL for credential management.

Instructions

Create or update a secret in the Keyway vault. The key must be uppercase with underscores (e.g., DATABASE_URL).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesSecret name - must be uppercase with underscores
valueYesSecret value to store
environmentNoEnvironment to set secret in (default: "development")

Implementation Reference

  • The handler function `setSecret` that processes the `keyway_set_secret` tool, including validation and interaction with the API.
    export async function setSecret(args: {
      name: string;
      value: string;
      environment?: string;
    }): Promise<CallToolResult> {
      // Validate name format
      if (!SECRET_NAME_PATTERN.test(args.name)) {
        return {
          content: [
            {
              type: 'text',
              text: `Invalid secret name "${args.name}". Name must be uppercase with underscores (e.g., DATABASE_URL, API_KEY)`,
            },
          ],
          isError: true,
        };
      }
    
      const token = await getToken();
      const repository = getRepository();
      const environment = args.environment || 'development';
    
      const result = await pushSecrets(repository, environment, { [args.name]: args.value }, token);
    
      const action = result.stats?.created ? 'created' : 'updated';
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({ success: true, name: args.name, environment, action }, null, 2),
          },
        ],
      };
    }
  • src/index.ts:36-48 (registration)
    Registration of the `keyway_set_secret` tool in the MCP server, defining its schema and mapping it to the `setSecret` handler.
    server.tool(
      'keyway_set_secret',
      'Create or update a secret in the Keyway vault. The key must be uppercase with underscores (e.g., DATABASE_URL).',
      {
        name: z.string().describe('Secret name - must be uppercase with underscores'),
        value: z.string().describe('Secret value to store'),
        environment: z
          .string()
          .optional()
          .describe('Environment to set secret in (default: "development")'),
      },
      async (args) => setSecret(args)
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/keywaysh/keyway-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server