Skip to main content
Glama

teleport_unpack

Decrypt and import secrets from encrypted teleport bundles into your vault. Use this tool to securely manage API keys and prevent plaintext .env file leaks.

Instructions

Decrypt and import secrets from a teleport bundle.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bundleYesBase64-encoded encrypted bundle
passphraseYesDecryption passphrase
scopeNoScope: global or projectglobal
projectPathNoProject root path for project-scoped secrets
dryRunNoPreview without importing

Implementation Reference

  • Registration and handler implementation for the 'teleport_unpack' MCP tool in src/mcp/server.ts.
    server.tool(
      "teleport_unpack",
      "Decrypt and import secrets from a teleport bundle.",
      {
        bundle: z.string().describe("Base64-encoded encrypted bundle"),
        passphrase: z.string().describe("Decryption passphrase"),
        scope: scopeSchema.default("global"),
        projectPath: projectPathSchema,
        dryRun: z
          .boolean()
          .optional()
          .default(false)
          .describe("Preview without importing"),
      },
      async (params) => {
        try {
          const payload = teleportUnpack(params.bundle, params.passphrase);
    
          if (params.dryRun) {
            const preview = payload.secrets
              .map((s) => `${s.key} [${s.scope ?? "global"}]`)
              .join("\n");
            return text(`Would import ${payload.secrets.length} secrets:\n${preview}`);
          }
    
          const o = opts(params);
          for (const s of payload.secrets) {
            setSecret(s.key, s.value, o);
          }
    
          return text(`Imported ${payload.secrets.length} secret(s) from teleport bundle`);
        } catch {
          return text("Failed to unpack: wrong passphrase or corrupted bundle", true);
        }
      },
    );
  • The core 'teleportUnpack' function in src/core/teleport.ts which performs the actual decryption and parsing of the teleport bundle.
     * Unpack and decrypt a teleport bundle.
     */
    export function teleportUnpack(
      encoded: string,
      passphrase: string,
    ): TeleportPayload {
      const bundleJson = Buffer.from(encoded, "base64").toString("utf8");
      const bundle: TeleportBundle = JSON.parse(bundleJson);
    
      if (bundle.v !== 1) {
        throw new Error(`Unsupported teleport bundle version: ${bundle.v}`);
      }
    
      const salt = Buffer.from(bundle.salt, "base64");
      const iv = Buffer.from(bundle.iv, "base64");
      const tag = Buffer.from(bundle.tag, "base64");
      const encrypted = Buffer.from(bundle.data, "base64");
      const key = deriveKey(passphrase, salt);
    
      const decipher = createDecipheriv(ALGORITHM, key, iv);
      decipher.setAuthTag(tag);
    
      const decrypted = Buffer.concat([
        decipher.update(encrypted),
        decipher.final(),
      ]);
    
      return JSON.parse(decrypted.toString("utf8"));
    }

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/I4cTime/quantum_ring'

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