Add /export and /mcp-status commands

- /export command to export session data as Markdown or JSON
  - Export for sharing with other Claude instances
  - Include session details, topics, summary, and memory items
- /mcp-status command to check MCP integration health
  - Gmail venv and credentials status
  - Calendar API dependencies
  - Delegation helpers presence
  - MCP server configuration
- Updated shell completions with 15 aliases total
- Test suite now covers 23 tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
OpenCode Test
2026-01-01 18:47:50 -08:00
parent c1a3c1812c
commit 2ff7f6b133
9 changed files with 559 additions and 4 deletions

207
automation/mcp-status.sh Executable file
View File

@@ -0,0 +1,207 @@
#!/bin/bash
# Check status of MCP integrations
# Usage: ./mcp-status.sh [--json]
set -euo pipefail
CLAUDE_DIR="${HOME}/.claude"
MCP_DIR="${CLAUDE_DIR}/mcp"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
JSON_OUTPUT=false
[[ "${1:-}" == "--json" ]] && JSON_OUTPUT=true
check_gmail() {
local status="unknown"
local details=""
# Check venv exists
local venv_dir="${MCP_DIR}/gmail/venv"
if [[ -d "$venv_dir" ]]; then
# Check python in venv
if [[ -x "${venv_dir}/bin/python" ]]; then
# Check if gmail-mcp is installed
if "${venv_dir}/bin/python" -c "import gmail_mcp" 2>/dev/null; then
# Check credentials
local creds_file="${HOME}/.gmail-mcp/credentials.json"
local token_file="${HOME}/.gmail-mcp/token.json"
if [[ -f "$creds_file" ]]; then
if [[ -f "$token_file" ]]; then
status="ready"
details="Credentials and token present"
else
status="needs_auth"
details="Credentials present, needs OAuth flow"
fi
else
status="needs_setup"
details="Missing credentials.json"
fi
else
status="incomplete"
details="gmail-mcp not installed in venv"
fi
else
status="broken"
details="Venv python not found"
fi
else
status="not_installed"
details="No venv at ${venv_dir}"
fi
if $JSON_OUTPUT; then
echo " \"gmail\": {\"status\": \"$status\", \"details\": \"$details\"}"
else
case "$status" in
ready)
echo -e "${GREEN}${NC} Gmail: $details"
;;
needs_auth)
echo -e "${YELLOW}${NC} Gmail: $details"
;;
*)
echo -e "${RED}${NC} Gmail: $details"
;;
esac
fi
}
check_gcal() {
local status="unknown"
local details=""
# GCal uses same credentials as Gmail
local creds_file="${HOME}/.gmail-mcp/credentials.json"
local token_file="${HOME}/.gmail-mcp/token.json"
# Check if google-api-python-client is available
if python3 -c "import googleapiclient.discovery" 2>/dev/null; then
if [[ -f "$creds_file" ]]; then
if [[ -f "$token_file" ]]; then
status="ready"
details="Credentials and token present"
else
status="needs_auth"
details="Credentials present, needs OAuth flow"
fi
else
status="needs_setup"
details="Missing credentials.json"
fi
else
status="missing_deps"
details="google-api-python-client not installed"
fi
if $JSON_OUTPUT; then
echo " \"gcal\": {\"status\": \"$status\", \"details\": \"$details\"}"
else
case "$status" in
ready)
echo -e "${GREEN}${NC} Calendar: $details"
;;
needs_auth|missing_deps)
echo -e "${YELLOW}${NC} Calendar: $details"
;;
*)
echo -e "${RED}${NC} Calendar: $details"
;;
esac
fi
}
check_delegation() {
local status="ready"
local gmail_helper="${MCP_DIR}/delegation/gmail_delegate.py"
local gcal_helper="${MCP_DIR}/delegation/gcal_delegate.py"
local details="Delegation helpers"
if [[ -f "$gmail_helper" ]] && [[ -f "$gcal_helper" ]]; then
status="ready"
details="Both helpers present"
elif [[ -f "$gmail_helper" ]] || [[ -f "$gcal_helper" ]]; then
status="partial"
details="Some helpers missing"
else
status="not_installed"
details="No delegation helpers found"
fi
if $JSON_OUTPUT; then
echo " \"delegation\": {\"status\": \"$status\", \"details\": \"$details\"}"
else
case "$status" in
ready)
echo -e "${GREEN}${NC} Delegation: $details"
;;
partial)
echo -e "${YELLOW}${NC} Delegation: $details"
;;
*)
echo -e "${RED}${NC} Delegation: $details"
;;
esac
fi
}
check_mcp_servers() {
# Check for .mcp.json or mcp server configurations
local mcp_config="${CLAUDE_DIR}/.mcp.json"
local status="none"
local count=0
if [[ -f "$mcp_config" ]]; then
# Count servers
count=$(python3 -c "import json; data = json.load(open('$mcp_config')); print(len(data.get('mcpServers', {})))" 2>/dev/null || echo "0")
if [[ "$count" -gt 0 ]]; then
status="configured"
else
status="empty"
fi
fi
if $JSON_OUTPUT; then
echo " \"mcp_servers\": {\"status\": \"$status\", \"count\": $count}"
else
if [[ "$status" == "configured" ]]; then
echo -e "${GREEN}${NC} MCP Servers: $count configured"
elif [[ "$status" == "empty" ]]; then
echo -e "${YELLOW}${NC} MCP Servers: Config exists but empty"
else
echo -e "${BLUE}${NC} MCP Servers: No .mcp.json found (using direct API)"
fi
fi
}
# Main output
if $JSON_OUTPUT; then
echo "{"
echo " \"timestamp\": \"$(date -Iseconds)\","
echo " \"integrations\": {"
check_gmail
echo ","
check_gcal
echo ","
check_delegation
echo ","
check_mcp_servers
echo " }"
echo "}"
else
echo ""
echo "🔌 MCP Integration Status"
echo ""
check_gmail
check_gcal
check_delegation
check_mcp_servers
echo ""
fi