Skip to main content
Glama

tunnel_create

Create ephemeral secrets stored only in memory with optional self-destruction via TTL or read limits, preventing disk persistence.

Instructions

Create an ephemeral secret that exists only in memory (quantum tunneling). Never persisted to disk. Optional TTL and max-reads for self-destruction.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
valueYesThe secret value
ttlSecondsNoAuto-expire after N seconds
maxReadsNoSelf-destruct after N reads

Implementation Reference

  • Registration and MCP tool handler for "tunnel_create" in src/mcp/server.ts. It calls the core logic from `src/core/tunnel.ts`.
    server.tool(
      "tunnel_create",
      "Create an ephemeral secret that exists only in memory (quantum tunneling). Never persisted to disk. Optional TTL and max-reads for self-destruction.",
      {
        value: z.string().describe("The secret value"),
        ttlSeconds: z.number().optional().describe("Auto-expire after N seconds"),
        maxReads: z.number().optional().describe("Self-destruct after N reads"),
      },
      async (params) => {
        const id = tunnelCreate(params.value, {
          ttlSeconds: params.ttlSeconds,
          maxReads: params.maxReads,
        });
        return text(id);
      },
    );
  • The actual implementation logic for tunnel_create, which manages the ephemeral in-memory storage.
    export function tunnelCreate(
      value: string,
      opts: TunnelOptions = {},
    ): string {
      const id = `tun_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
      const now = Date.now();
    
      tunnelStore.set(id, {
        value,
        createdAt: now,
        expiresAt: opts.ttlSeconds ? now + opts.ttlSeconds * 1000 : undefined,
        accessCount: 0,
        maxReads: opts.maxReads,
      });
    
      ensureCleanup();
      return id;
    }

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