#!/bin/bash
# MCP Odoo Server - Configuration Helper
# This script helps you set up the MCP server in Claude Desktop
echo "==================================="
echo "MCP Odoo Server Configuration"
echo "==================================="
echo ""
# Get the absolute path to the build directory
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BUILD_PATH="$SCRIPT_DIR/build/index.js"
echo "Build path: $BUILD_PATH"
echo ""
# Check if build exists
if [ ! -f "$BUILD_PATH" ]; then
echo "❌ Build not found. Please run: npm run build"
exit 1
fi
echo "✅ Build found"
echo ""
# Determine the config file location based on OS
if [[ "$OSTYPE" == "darwin"* ]]; then
CONFIG_PATH="$HOME/Library/Application Support/Claude/claude_desktop_config.json"
elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
CONFIG_PATH="$APPDATA/Claude/claude_desktop_config.json"
else
CONFIG_PATH="$HOME/.config/Claude/claude_desktop_config.json"
fi
echo "Claude Desktop config location:"
echo "$CONFIG_PATH"
echo ""
# Create config directory if it doesn't exist
CONFIG_DIR=$(dirname "$CONFIG_PATH")
if [ ! -d "$CONFIG_DIR" ]; then
echo "📁 Creating config directory..."
mkdir -p "$CONFIG_DIR"
fi
# Generate the configuration JSON
cat > /tmp/odoo_mcp_config.json << EOF
{
"mcpServers": {
"odoo": {
"command": "node",
"args": [
"$BUILD_PATH"
]
}
}
}
EOF
echo "==================================="
echo "Configuration to add to Claude Desktop:"
echo "==================================="
cat /tmp/odoo_mcp_config.json
echo ""
echo "==================================="
echo ""
# Check if Claude config already exists
if [ -f "$CONFIG_PATH" ]; then
echo "⚠️ Claude Desktop config already exists."
echo " You'll need to manually merge the configuration."
echo ""
echo " Current config location: $CONFIG_PATH"
echo " New config saved to: /tmp/odoo_mcp_config.json"
echo ""
echo " To merge, add the 'odoo' entry under 'mcpServers' in your existing config."
else
echo "Creating new Claude Desktop config..."
cp /tmp/odoo_mcp_config.json "$CONFIG_PATH"
echo "✅ Configuration created!"
fi
echo ""
echo "==================================="
echo "Next Steps:"
echo "==================================="
echo "1. Restart Claude Desktop"
echo "2. Get your Odoo API key:"
echo " - Log into Odoo"
echo " - Go to My Profile → Preferences"
echo " - Click 'New API Key'"
echo " - Copy the generated key"
echo "3. In Claude, connect using:"
echo " 'Connect to my Odoo database at [host]"
echo " with database [name] and username [email]'"
echo ""
echo "For detailed instructions, see QUICKSTART.md"
echo "==================================="