内容
# Trailhead MCP CLI 🚀
A dependency-free, interactive command line interface (CLI) for the Salesforce Trailhead MCP server written in Python 3. It standardizes how you access, search, and view Salesforce Trailhead learning materials directly from your terminal.
---
## Features
* **Zero Dependencies**: Simply runs anywhere with Python 3. Uses standard libraries (`urllib`, `json`, `argparse`) so you don't need to run `pip install` or set up virtual environments.
* **Premium Terminal UI**: Renders text with customized ANSI coloring, layouts, emojis for content types, and borders for code blocks.
* **Interactive Markdown Renderer**: Formats headers, bullet lists, numeric lists, links, and code blocks for readability in the shell.
* **Seamless Fallbacks**: Dynamically displays full unit markdowns for modules/projects, and lists child manifests for trails/learning paths.
---
## Setup & Installation
### 1. Make it Executable
Ensure the wrapper script has execution permissions:
```bash
chmod +x trailhead
```
### 2. Run Locally
You can run it directly from this directory:
```bash
./trailhead
```
### 3. Make it Globally Accessible (Optional)
To run `trailhead` from any directory in your terminal, choose one of these methods:
* **Create a Symlink (Recommended)**:
```bash
sudo ln -s "$(pwd)/trailhead" /usr/local/bin/trailhead
```
*After this, simply type `trailhead` in any folder.*
* **Create a Shell Alias**:
Add this to your `~/.zshrc` (or `~/.bashrc`):
```bash
alias trailhead="/Users/gaurav/.gemini/antigravity-ide/scratch/trailhead-mcp/head"
```
Then reload your shell:
```bash
source ~/.zshrc
```
---
## Commands & Usage
### ℹ️ View Server Schemas (`info`)
Queries the Trailhead MCP server and prints all tool definitions, parameters, and types:
```bash
./trailhead info
```
### 🔍 Search Content (`search`)
Search the public Trailhead learning catalog. Supports filters for roles, levels, types, and locales.
```bash
# Basic keyword search
./trailhead search "Agentforce" --first 3
# Filter search by developer role and foundational level
./trailhead search "Apex" --role Developer --level Foundational
```
**Filter Options:**
* `--first`: Number of results to return (1-12, default `6`).
* `--role`: `Administrator`, `Architect`, `Business Analyst`, `Consultant`, `Developer`, `Marketer`, etc.
* `--level`: `Foundational`, `Intermediate`, `Advanced`.
* `--types`: `MODULE`, `PROJECT`, `TRAIL`, `TRAILMIX`, `SUPERBADGE`.
### 📖 Fetch Lesson Materials (`fetch`)
Retrieve the complete text/markdown content for a specific badge or trail:
```bash
# Fetch a specific project module
./trailhead fetch "quickstart-apex"
# Fetch a trail to see its children manifest
./trailhead fetch "service-cloud-for-slack"
# Fetch a trail and expand to fetch all child content at once (large download)
./trailhead fetch "service-cloud-for-slack" --expand
```
---
## MCP Server Specifications
* **MCP Server Endpoint:** `https://mcp.trailhead.salesforce.com/mcp`
* **Authentication:** None required for public content.
* **Privacy:** Queries are stateless, and no user progress or points data is collected.