Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AI QL Tuui dxt bundle ops

From Leeroopedia
Knowledge Sources
Domains MCPB, Packaging, Validation
Last Updated 2026-10-24 00:00 GMT

Overview

Concrete tool for unpacking MCPB bundle archives, validating manifests, and resolving manifest+user config to stdio server parameters, provided by the tuui Electron application.

Description

This module wraps the @anthropic-ai/mcpb SDK for three operations:

  • unpackDxt — Unpacks a .mcpb archive into a directory via unpackExtension.
  • getManifest — Reads and validates manifest.json using McpbManifestSchema.safeParse. Returns the validated manifest on success, or an errors object on failure.
  • getMcpConfigForDxt — Resolves a manifest + user config into McpServerConfig (= StdioServerParameters) via getMcpConfigForManifest, with a mock logger that collects messages for error reporting.

Usage

Import these functions when installing an MCPB bundle: unpack the archive, validate the manifest, merge user config, then resolve to a stdio server config for client initialization.

Code Reference

Source Location

  • Repository: tuui
  • File: src/main/mcp/dxt.ts

Signature

export async function unpackDxt(dxtUnpackOption: {
  mcpbPath: string
  outputDir: string
}): Promise<boolean>

export function getManifest(inputPath: string): McpDxtErrors | McpbManifestAny

export async function getMcpConfigForDxt(
  basePath: string,
  baseManifest: McpbManifestAny,
  userConfig: McpbUserConfigValues
): Promise<McpServerConfig>

Import

import { unpackDxt, getManifest, getMcpConfigForDxt } from './mcp/dxt'

I/O Contract

Inputs

Name Type Required Description
mcpbPath string Yes (unpackDxt) Path to saved .mcpb archive
outputDir string Yes (unpackDxt) Target extraction directory
inputPath string Yes (getManifest) Path to manifest file or directory containing manifest.json
basePath string Yes (getMcpConfigForDxt) POSIX path to unpacked bundle directory
baseManifest McpbManifestAny Yes (getMcpConfigForDxt) Validated manifest object
userConfig McpbUserConfigValues Yes (getMcpConfigForDxt) Merged user config values

Outputs

Name Type Description
unpackDxt Promise<boolean> True if extraction succeeded
getManifest McpDxtErrors Validated manifest or { errors: Array<{ field, message }> }
getMcpConfigForDxt Promise<McpServerConfig> StdioServerParameters (command, args, env); throws with logger messages if resolution fails

Usage Examples

Unpack and Validate a Bundle

import { unpackDxt, getManifest } from './mcp/dxt'

// Step 1: Unpack the archive
const success = await unpackDxt({
  mcpbPath: '/path/to/bundle.mcpb',
  outputDir: '/path/to/bundle_dir'
})

// Step 2: Validate the manifest
const manifest = getManifest('/path/to/bundle_dir')
if ('errors' in manifest) {
  console.error('Validation failed:', manifest.errors)
} else {
  console.log('Valid manifest:', manifest.server.command)
}

Resolve to Server Config

import { getMcpConfigForDxt } from './mcp/dxt'

const serverConfig = await getMcpConfigForDxt(
  '/posix/path/to/bundle',       // basePath
  validatedManifest,               // baseManifest
  { API_KEY: 'user-provided-key' } // userConfig
)
// serverConfig = { command: 'node', args: ['server.js'], env: { API_KEY: 'user-provided-key' } }

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment