Add llm-tldr integration and update documentation
- Add llm-tldr (95% token reduction) to all installation methods - Update MASTER-PROMPT.md with all 6 sources and real-life examples - Update README.md with comprehensive source guide - Update automation script with TLDR installation and MCP config - Update INTEGRATION-GUIDE.md to clarify Z.AI MCP tools work with GLM - Add MCP explanation and link to modelcontextprotocol.io Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,7 @@ INSTALL_MCP_TOOLS=true
|
||||
INSTALL_VISION_TOOLS=true
|
||||
INSTALL_WEB_TOOLS=true
|
||||
INSTALL_GITHUB_TOOLS=true
|
||||
INSTALL_TLDR=true
|
||||
INSTALL_PLUGINS=true
|
||||
INSTALL_HOOKS=true
|
||||
LAUNCH_CLAUDE=false
|
||||
@@ -295,6 +296,18 @@ select_mcp_tools() {
|
||||
INSTALL_GITHUB_TOOLS=false
|
||||
fi
|
||||
|
||||
if command -v python3 &> /dev/null && command -v pip3 &> /dev/null; then
|
||||
if confirm "Install TLDR Code Analysis? (95% token reduction, semantic search, program slicing - requires Python)" "Y"; then
|
||||
INSTALL_TLDR=true
|
||||
SELECTED_MCP_TOOLS=$((SELECTED_MCP_TOOLS + 18))
|
||||
else
|
||||
INSTALL_TLDR=false
|
||||
fi
|
||||
else
|
||||
log_warning "Python/pip3 not found - skipping TLDR Code Analysis"
|
||||
INSTALL_TLDR=false
|
||||
fi
|
||||
|
||||
if [ $SELECTED_MCP_TOOLS -eq 0 ]; then
|
||||
log_warning "No MCP tools selected"
|
||||
else
|
||||
@@ -817,6 +830,97 @@ EOF
|
||||
log_success "Permissions configured"
|
||||
}
|
||||
|
||||
install_mcp_config() {
|
||||
if [ "$INSTALL_MCP_TOOLS" = false ] && [ "$INSTALL_TLDR" = false ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
log_info "Creating MCP server configuration..."
|
||||
|
||||
local mcp_config="$CLAUDE_DIR/claude_desktop_config.json"
|
||||
local config_needed=false
|
||||
|
||||
# Check if any MCP tools need configuration
|
||||
if [ "$INSTALL_VISION_TOOLS" = true ] || [ "$INSTALL_WEB_TOOLS" = true ] || [ "$INSTALL_GITHUB_TOOLS" = true ] || [ "$INSTALL_TLDR" = true ]; then
|
||||
config_needed=true
|
||||
fi
|
||||
|
||||
if [ "$config_needed" = false ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Start building MCP config
|
||||
local mcp_servers="{"
|
||||
|
||||
# Add vision tools
|
||||
if [ "$INSTALL_VISION_TOOLS" = true ]; then
|
||||
mcp_servers="${mcp_servers}
|
||||
\"zai-vision\": {
|
||||
\"command\": \"npx\",
|
||||
\"args\": [\"@z_ai/mcp-server\"]
|
||||
},"
|
||||
fi
|
||||
|
||||
# Add web search tool
|
||||
if [ "$INSTALL_WEB_TOOLS" = true ]; then
|
||||
mcp_servers="${mcp_servers}
|
||||
\"web-search-prime\": {
|
||||
\"command\": \"npx\",
|
||||
\"args\": [\"@z_ai/coding-helper\"],
|
||||
\"env\": {
|
||||
\"TOOL\": \"web-search-prime\"
|
||||
}
|
||||
},
|
||||
\"web-reader\": {
|
||||
\"command\": \"npx\",
|
||||
\"args\": [\"@z_ai/coding-helper\"],
|
||||
\"env\": {
|
||||
\"TOOL\": \"web-reader\"
|
||||
}
|
||||
},"
|
||||
fi
|
||||
|
||||
# Add GitHub tool
|
||||
if [ "$INSTALL_GITHUB_TOOLS" = true ]; then
|
||||
mcp_servers="${mcp_servers}
|
||||
\"github-reader\": {
|
||||
\"command\": \"npx\",
|
||||
\"args\": [\"@z_ai/coding-helper\"],
|
||||
\"env\": {
|
||||
\"TOOL\": \"github-reader\"
|
||||
}
|
||||
},"
|
||||
fi
|
||||
|
||||
# Add TLDR (remove trailing comma before closing)
|
||||
if [ "$INSTALL_TLDR" = true ]; then
|
||||
# Remove trailing comma from previous entry if exists
|
||||
mcp_servers="${mcp_servers%,}"
|
||||
mcp_servers="${mcp_servers}
|
||||
,
|
||||
\"tldr\": {
|
||||
\"command\": \"tldr-mcp\",
|
||||
\"args\": [\"--project\", \".\"]
|
||||
}"
|
||||
fi
|
||||
|
||||
# Remove trailing comma if exists
|
||||
mcp_servers="${mcp_servers%,}"
|
||||
|
||||
# Close JSON
|
||||
mcp_servers="${mcp_servers}
|
||||
}"
|
||||
|
||||
# Write config file
|
||||
cat > "$mcp_config" << EOF
|
||||
{
|
||||
"mcpServers": $(echo "$mcp_servers")
|
||||
}
|
||||
EOF
|
||||
|
||||
log_success "MCP server configuration created"
|
||||
}
|
||||
|
||||
install_mcp_tools() {
|
||||
if [ "$INSTALL_MCP_TOOLS" = false ]; then
|
||||
return
|
||||
@@ -842,6 +946,31 @@ install_mcp_tools() {
|
||||
log_success "Web/GitHub MCP tools installed"
|
||||
fi
|
||||
|
||||
# Install llm-tldr for code analysis
|
||||
if [ "$INSTALL_TLDR" = true ]; then
|
||||
if command -v pip3 &> /dev/null; then
|
||||
pip3 install llm-tldr 2>/dev/null || {
|
||||
log_warning "pip3 install failed, trying pip"
|
||||
pip install llm-tldr 2>/dev/null || {
|
||||
log_error "Failed to install llm-tldr"
|
||||
log_info "Install manually: pip install llm-tldr"
|
||||
}
|
||||
}
|
||||
log_success "TLDR code analysis installed"
|
||||
|
||||
# Initialize TLDR for current directory if it's a git repo
|
||||
if [ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1; then
|
||||
log_info "Initializing TLDR for current directory..."
|
||||
tldr warm . 2>/dev/null || {
|
||||
log_warning "TLDR initialization failed - run 'tldr warm .' manually"
|
||||
}
|
||||
log_success "TLDR initialized for codebase"
|
||||
fi
|
||||
else
|
||||
log_warning "pip3 not found - skipping TLDR installation"
|
||||
fi
|
||||
fi
|
||||
|
||||
log_success "MCP tools configured: $SELECTED_MCP_TOOLS"
|
||||
}
|
||||
|
||||
@@ -912,6 +1041,7 @@ perform_installation() {
|
||||
install_agents
|
||||
install_settings
|
||||
install_local_settings
|
||||
install_mcp_config
|
||||
install_mcp_tools
|
||||
install_plugins
|
||||
install_hooks
|
||||
|
||||
Reference in New Issue
Block a user