Skip to content

Commit e9a9b86

Browse files
committed
Refactor getmcp.sh pages
1 parent 2542848 commit e9a9b86

File tree

4 files changed

+143
-3
lines changed

4 files changed

+143
-3
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Upload artifact
2929
uses: actions/upload-pages-artifact@v3
3030
with:
31-
path: '.'
31+
path: 'pages'
3232
- name: Deploy to GitHub Pages
3333
id: deployment
3434
uses: actions/deploy-pages@v4

CNAME renamed to pages/CNAME

File renamed without changes.

index.html renamed to pages/index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,10 @@ <h1>MCP</h1>
216216
</header>
217217

218218
<div class="coming-soon">
219-
<h2>🚀 Coming Soon</h2>
220-
<p>We're building a Homebrew-like service for managing Model Context Protocol (MCP) configs and servers. Stay tuned for a seamless configuration and management experience.</p>
219+
<h2>🚀 Quick Installation</h2>
220+
<p>Install MCP with a single command:</p>
221+
<code><span class="command-prompt">$</span> curl -sSL https://getmcp.sh/install | bash</code>
222+
<p>MCP is a Homebrew-like service for managing Model Context Protocol (MCP) configs and servers.</p>
221223
</div>
222224

223225
<h2>What to Expect</h2>

pages/install

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# Colors for terminal output
6+
RED='\033[0;31m'
7+
GREEN='\033[0;32m'
8+
YELLOW='\033[0;33m'
9+
BLUE='\033[0;34m'
10+
PURPLE='\033[0;35m'
11+
CYAN='\033[0;36m'
12+
NC='\033[0m' # No Color
13+
14+
echo -e "${BLUE}┌─────────────────────────────────────────────┐${NC}"
15+
echo -e "${BLUE}│ │${NC}"
16+
echo -e "${BLUE}${GREEN}MCP - Model Context Protocol Package Manager${BLUE}${NC}"
17+
echo -e "${BLUE}│ │${NC}"
18+
echo -e "${BLUE}└─────────────────────────────────────────────┘${NC}"
19+
echo
20+
21+
# Function to check if a command exists
22+
command_exists() {
23+
command -v "$1" >/dev/null 2>&1
24+
}
25+
26+
# Function to print info message
27+
info() {
28+
echo -e "${CYAN}INFO:${NC} $1"
29+
}
30+
31+
# Function to print error message
32+
error() {
33+
echo -e "${RED}ERROR:${NC} $1" >&2
34+
}
35+
36+
# Function to print success message
37+
success() {
38+
echo -e "${GREEN}SUCCESS:${NC} $1"
39+
}
40+
41+
# Function to check Python version
42+
check_python() {
43+
if ! command_exists python3; then
44+
error "Python 3 is not installed. MCP requires Python 3.8 or higher."
45+
echo "Please install Python 3.8+ and try again."
46+
echo "Visit https://www.python.org/downloads/ for installation instructions."
47+
exit 1
48+
fi
49+
50+
# Check Python version
51+
PYTHON_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
52+
PYTHON_MAJOR=$(echo $PYTHON_VERSION | cut -d. -f1)
53+
PYTHON_MINOR=$(echo $PYTHON_VERSION | cut -d. -f2)
54+
55+
if [ "$PYTHON_MAJOR" -lt 3 ] || ([ "$PYTHON_MAJOR" -eq 3 ] && [ "$PYTHON_MINOR" -lt 8 ]); then
56+
error "Python version $PYTHON_VERSION detected, but MCP requires Python 3.8 or higher."
57+
echo "Please upgrade your Python installation and try again."
58+
exit 1
59+
fi
60+
61+
info "Found Python $PYTHON_VERSION"
62+
}
63+
64+
# Function to install or upgrade pip
65+
ensure_pip() {
66+
if ! command_exists pip3; then
67+
info "Installing pip..."
68+
python3 -m ensurepip --upgrade || {
69+
error "Failed to install pip. Please install pip manually and try again."
70+
exit 1
71+
}
72+
else
73+
info "Upgrading pip..."
74+
python3 -m pip install --upgrade pip >/dev/null 2>&1 || true
75+
fi
76+
}
77+
78+
# Function to install MCP
79+
install_mcp() {
80+
info "Installing MCP..."
81+
82+
if command_exists pipx; then
83+
info "Using pipx to install MCP (recommended)..."
84+
pipx install mcp
85+
else
86+
# Try to use pip in user mode first
87+
python3 -m pip install --user mcp || {
88+
info "Attempting system-wide installation with sudo..."
89+
sudo python3 -m pip install mcp || {
90+
error "Failed to install MCP. Please check your permissions and try again."
91+
exit 1
92+
}
93+
}
94+
fi
95+
}
96+
97+
# Function to verify installation
98+
verify_installation() {
99+
if command_exists mcp; then
100+
MCP_VERSION=$(mcp --version 2>/dev/null || echo "Unknown")
101+
success "MCP $MCP_VERSION has been successfully installed!"
102+
echo
103+
echo -e "${PURPLE}To get started with MCP, try:${NC}"
104+
echo -e " ${CYAN}mcp --help${NC} # Show available commands"
105+
echo -e " ${CYAN}mcp list --available${NC} # List available MCP servers"
106+
echo -e " ${CYAN}mcp install <server>${NC} # Install an MCP server"
107+
echo
108+
echo -e "For more information, visit ${BLUE}https://getmcp.sh${NC}"
109+
echo
110+
else
111+
PATH_DIRS=$(echo $PATH | tr ':' '\n')
112+
USER_BIN_DIR="$HOME/.local/bin"
113+
114+
if ! echo "$PATH_DIRS" | grep -q "$USER_BIN_DIR"; then
115+
info "MCP might be installed but not in your PATH."
116+
echo "Try adding this to your shell profile (~/.bashrc, ~/.zshrc, etc.):"
117+
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
118+
echo
119+
echo "After that, restart your terminal or run:"
120+
echo " source ~/.bashrc # or ~/.zshrc, etc."
121+
else
122+
error "Installation seems to have failed. Please try again or install manually:"
123+
echo " pip install mcp"
124+
fi
125+
fi
126+
}
127+
128+
# Main installation process
129+
main() {
130+
info "Starting MCP installation..."
131+
check_python
132+
ensure_pip
133+
install_mcp
134+
verify_installation
135+
}
136+
137+
# Execute the installation
138+
main

0 commit comments

Comments
 (0)