Skip to main content
Glama

MCP RAG Server

run.sh3.31 kB
#!/bin/bash # Script to run the MCP Server # Make sure we're in the right directory cd "$(dirname "$0")" # Function to check if a command exists command_exists() { command -v "$1" >/dev/null 2>&1 } # Check if Python is installed if ! command_exists python; then if command_exists python3; then PYTHON=python3 else echo "Error: Python not found. Please install Python 3.7 or newer." exit 1 fi else PYTHON=python fi # Check if pip is installed if ! command_exists pip && ! command_exists pip3; then echo "Error: pip not found. Please install pip." exit 1 fi PIP_CMD=$(command_exists pip3 && echo "pip3" || echo "pip") # Check if dependencies are installed if [ ! -f "requirements.txt" ]; then echo "Error: requirements.txt not found." exit 1 fi # Create data directory if it doesn't exist mkdir -p "data" # Install dependencies if not already installed if ! $PYTHON -c "import faiss" 2>/dev/null; then echo "Installing dependencies..." $PIP_CMD install -r requirements.txt fi # Parse command line arguments INDEX=false QUERY="" DOWNLOAD_MOVE=false GITHUB_QUERY="use sui" MAX_RESULTS=100 # Show usage information usage() { echo "Usage: $0 [options]" echo "Options:" echo " --index Index documents before starting server" echo " --query \"text\" Run a query against the server (without starting it)" echo " --download-move Download Move files from GitHub before indexing" echo " --github-query \"query\" GitHub search query for Move files (default: \"use sui\")" echo " --max-results N Maximum number of results to download (default: 100)" echo " --help Show this help message" exit 0 } while [[ $# -gt 0 ]]; do case $1 in --index) INDEX=true shift ;; --download-move) DOWNLOAD_MOVE=true shift ;; --github-query) if [[ -n "$2" && "$2" != --* ]]; then GITHUB_QUERY="$2" shift 2 else echo "Error: --github-query requires a value." exit 1 fi ;; --max-results) if [[ -n "$2" && "$2" != --* ]]; then MAX_RESULTS="$2" shift 2 else echo "Error: --max-results requires a value." exit 1 fi ;; --help) usage ;; --query) if [[ -n "$2" && "$2" != --* ]]; then QUERY="$2" shift 2 else echo "Error: --query requires a value." exit 1 fi ;; *) echo "Unknown option: $1" echo "Use --help to see available options" exit 1 ;; esac done # If query mode, just run the query if [ -n "$QUERY" ]; then echo "Running query: $QUERY" $PYTHON client_example.py "$QUERY" exit 0 fi # If download mode, download Move files from GitHub if $DOWNLOAD_MOVE; then echo "Downloading Move files from GitHub with query: $GITHUB_QUERY" $PYTHON download_move_files.py --query "$GITHUB_QUERY" --max-results $MAX_RESULTS # Auto-enable indexing after download INDEX=true fi # If index mode, index documents if $INDEX; then echo "Indexing documents..." $PYTHON client_example.py --index fi # Make file executable if it's not chmod +x download_move_files.py # Start the server echo "Starting MCP Server..." $PYTHON main.py

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ProbonoBonobo/sui-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server