-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
Β·218 lines (185 loc) Β· 5.24 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
Β·218 lines (185 loc) Β· 5.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#!/bin/bash
# Flowbite MCP Server - Quick Setup Script
# This script automates the installation and configuration process
set -e # Exit on any error
echo "π Flowbite MCP Server - Quick Setup"
echo "===================================="
# Color codes for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
echo -e "${GREEN}β
$1${NC}"
}
print_warning() {
echo -e "${YELLOW}β οΈ $1${NC}"
}
print_error() {
echo -e "${RED}β $1${NC}"
}
print_info() {
echo -e "${BLUE}βΉοΈ $1${NC}"
}
# Check prerequisites
echo "π Checking prerequisites..."
# Check Python
if command -v python3 &> /dev/null; then
PYTHON_VERSION=$(python3 --version | cut -d' ' -f2)
print_status "Python $PYTHON_VERSION found"
else
print_error "Python 3 not found. Please install Python 3.8+ first."
exit 1
fi
# Check pip
if command -v pip3 &> /dev/null || python3 -m pip --version &> /dev/null; then
print_status "pip found"
else
print_warning "pip not found. Will try to install..."
# Try to install pip
if command -v apt &> /dev/null; then
sudo apt update && sudo apt install -y python3-pip
elif command -v brew &> /dev/null; then
brew install python
else
print_error "Cannot install pip automatically. Please install it manually."
exit 1
fi
fi
# Create virtual environment
echo ""
echo "π¦ Setting up virtual environment..."
if [ -d "venv" ]; then
print_warning "Virtual environment already exists. Removing old one..."
rm -rf venv
fi
python3 -m venv venv
print_status "Virtual environment created"
# Activate virtual environment
source venv/bin/activate
print_status "Virtual environment activated"
# Upgrade pip
python -m pip install --upgrade pip
print_status "pip upgraded"
# Install dependencies
echo ""
echo "π Installing dependencies..."
# Try to install from requirements.txt
if [ -f "requirements.txt" ]; then
print_info "Installing from requirements.txt..."
pip install -r requirements.txt
print_status "Dependencies installed from requirements.txt"
else
print_info "requirements.txt not found. Installing core dependencies..."
pip install fastmcp pydantic jinja2 beautifulsoup4
print_status "Core dependencies installed"
fi
# Setup environment file
echo ""
echo "βοΈ Setting up configuration..."
if [ ! -f ".env" ]; then
if [ -f ".env.example" ]; then
cp .env.example .env
print_status "Environment file created from .env.example"
else
print_warning ".env.example not found. Creating basic .env file..."
cat > .env << EOF
# Flowbite MCP Server Configuration
MCP_SERVER_NAME=flowbite-mcp-server
MCP_SERVER_VERSION=0.1.0
DEBUG=false
LOG_LEVEL=INFO
EOF
print_status "Basic .env file created"
fi
else
print_info ".env file already exists"
fi
# Create necessary directories
echo ""
echo "π Creating directories..."
mkdir -p data/components data/examples logs
print_status "Directories created"
# Run tests
echo ""
echo "π§ͺ Running tests..."
if [ -f "test_simplified.py" ]; then
python test_simplified.py
if [ $? -eq 0 ]; then
print_status "All tests passed!"
else
print_warning "Some tests failed, but setup continues..."
fi
else
print_warning "test_simplified.py not found. Skipping tests."
fi
# Generate configuration examples
echo ""
echo "π Generating MCP configuration examples..."
# Get current directory
CURRENT_DIR=$(pwd)
# Claude Desktop configuration
cat > claude_desktop_config.json << EOF
{
"mcpServers": {
"flowbite": {
"command": "python",
"args": ["-m", "src.server"],
"cwd": "$CURRENT_DIR",
"env": {
"PYTHONPATH": "$CURRENT_DIR"
}
}
}
}
EOF
print_status "Claude Desktop config generated: claude_desktop_config.json"
# VS Code configuration
cat > vscode_settings.json << EOF
{
"mcp.servers": {
"flowbite": {
"command": "python",
"args": ["-m", "src.server"],
"cwd": "$CURRENT_DIR"
}
}
}
EOF
print_status "VS Code config generated: vscode_settings.json"
# Docker setup
if command -v docker &> /dev/null; then
print_info "Docker found. You can also use: docker-compose up"
fi
# Final instructions
echo ""
echo "π Setup completed successfully!"
echo "================================"
echo ""
print_info "Next steps:"
echo "1. Add the MCP server to your AI assistant:"
echo ""
echo " π± Claude Desktop:"
echo " - Copy contents of claude_desktop_config.json"
echo " - Add to your Claude Desktop config file"
echo " - Restart Claude Desktop"
echo ""
echo " π§ VS Code:"
echo " - Copy contents of vscode_settings.json"
echo " - Add to your VS Code settings.json"
echo " - Restart VS Code"
echo ""
echo "2. Test the integration:"
echo " - Ask Claude: 'Vygeneruj mi primary button s textom Click me'"
echo " - You should get Flowbite HTML code!"
echo ""
echo "3. Development commands:"
echo " - Start server: source venv/bin/activate && python -m src.server"
echo " - Run tests: python test_simplified.py"
echo " - View logs: tail -f logs/server.log"
echo ""
print_status "Happy coding with Flowbite MCP Server! π"
# Deactivate virtual environment
deactivate 2>/dev/null || true