Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 26 additions & 12 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
#!/bin/bash

# Create .cursor directory if it doesn't exist
mkdir -p .cursor
mkdir -p ~/.cursor

bun install

# Create mcp.json with the current directory path
echo "{
\"mcpServers\": {
\"TalkToFigma\": {
\"command\": \"bunx\",
\"args\": [
\"cursor-talk-to-figma-mcp@latest\"
]
}
}
}" > .cursor/mcp.json
MCP_JSON_PATH="$HOME/.cursor/mcp.json"

TALKTOFIGMA_JSON='\
"TalkToFigma": {\
"command": "bunx",\
"args": [\
"cursor-talk-to-figma-mcp@latest"\
]\
}'

if [ ! -f "$MCP_JSON_PATH" ]; then
echo "{\n \"mcpServers\": {\n $TALKTOFIGMA_JSON\n }\n}" > "$MCP_JSON_PATH"
else
if ! command -v jq &> /dev/null; then
echo "Error: jq is required but not installed. Please install jq (e.g., 'brew install jq' or 'apt-get install jq') and rerun this script."
exit 1
fi

if ! jq -e ".mcpServers.TalkToFigma" "$MCP_JSON_PATH" > /dev/null; then
tmpfile=$(mktemp)
jq ".mcpServers += {TalkToFigma: {command: \"bunx\", args: [\"cursor-talk-to-figma-mcp@latest\"]}}" "$MCP_JSON_PATH" > "$tmpfile" && mv "$tmpfile" "$MCP_JSON_PATH"
else
echo "TalkToFigma already exists in mcpServers"
fi
fi