#!/bin/bash
# MCP Run - Main entry point for MCP project
# This is the primary script that users should execute to interact with MCP
# Get the absolute path of this script and set up environment
SCRIPT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
cd "$SCRIPT_PATH"
# Set up base environment variables if needed
export MCP_ROOT="$SCRIPT_PATH"
export PYTHONPATH="$MCP_ROOT:$PYTHONPATH"
# Save the location of the runner script before any environment changes
RUNNER_SCRIPT="$SCRIPT_PATH/scripts/mcp_runner.sh"
# Check if a virtual environment exists and activate it if it does
if [ -d "$SCRIPT_PATH/.venv" ]; then
echo "Activating virtual environment..."
source "$SCRIPT_PATH/.venv/bin/activate" || {
echo "Warning: Could not activate virtual environment at $SCRIPT_PATH/.venv"
echo "Proceeding with system Python"
}
fi
# Ensure the runner script exists
if [ ! -f "$RUNNER_SCRIPT" ]; then
echo "Error: Could not find the MCP runner script at $RUNNER_SCRIPT"
echo "Please make sure you have a complete MCP installation."
exit 1
fi
# Special handling for ai-analyze command
if [ "$1" == "ai-analyze" ]; then
# Remove the first argument and pass the rest to the AI analysis function
shift
"$RUNNER_SCRIPT" "ai_analyze" "$@"
exit $?
fi
# Special handling for langflow-component command
if [ "$1" == "langflow-component" ]; then
# Remove the first argument and pass the rest to the langflow component generator
shift
"$RUNNER_SCRIPT" "generate_langflow_component" "$@"
exit $?
fi
# Special handling for langflow commands
if [ "$1" == "langflow" ]; then
# Check for subcommands
if [ "$2" == "start" ]; then
shift 2
"$RUNNER_SCRIPT" "start_langflow" "$@"
exit $?
elif [ "$2" == "stop" ]; then
shift 2
"$RUNNER_SCRIPT" "stop_langflow" "$@"
exit $?
elif [ "$2" == "status" ]; then
shift 2
"$RUNNER_SCRIPT" "check_langflow" "$@"
exit $?
elif [ "$2" == "install-component" ]; then
shift 2
"$RUNNER_SCRIPT" "install_mcp_component" "$@"
exit $?
elif [ "$2" == "test-component" ]; then
shift 2
"$RUNNER_SCRIPT" "test_mcp_component" "$@"
exit $?
elif [ "$2" == "help" ] || [ -z "$2" ]; then
echo "MCP Langflow Commands:"
echo " start - Start the Langflow server"
echo " stop - Stop the Langflow server"
echo " status - Check Langflow server status"
echo " install-component - Install the MCP component in Langflow"
echo " test-component - Test the MCP component with a chat request"
exit 0
else
echo "Unknown Langflow command: $2"
echo "Use 'langflow help' to see available commands"
exit 1
fi
fi
# Run the actual runner script, passing all arguments through
"$RUNNER_SCRIPT" "$@"
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/dvladimirov/MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server