forked from xdevplatform/xmcp
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwrite-env-interactive.sh
More file actions
executable file
·79 lines (66 loc) · 2.67 KB
/
Copy pathwrite-env-interactive.sh
File metadata and controls
executable file
·79 lines (66 loc) · 2.67 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
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ENV_FILE="$ROOT_DIR/.env"
read -rsp "X_OAUTH_CONSUMER_KEY: " X_OAUTH_CONSUMER_KEY; echo
read -rsp "X_OAUTH_CONSUMER_SECRET: " X_OAUTH_CONSUMER_SECRET; echo
read -rsp "X_BEARER_TOKEN: " X_BEARER_TOKEN; echo
read -rsp "CLIENT_ID (optional, needed for bookmarks): " CLIENT_ID; echo
read -rsp "CLIENT_SECRET (optional, needed for bookmarks): " CLIENT_SECRET; echo
echo "Choose tool mode:"
echo " 1) read-only"
echo " 2) read-write"
echo " 3) read-write + dm"
echo " 4) read-write + dm + bookmarks"
read -rp "Selection [1/2/3/4]: " MODE
case "$MODE" in
1)
X_API_TOOL_ALLOWLIST="getUsersMe,getUsersByUsername,getPostsById,searchPostsRecent,getUsersTimeline"
;;
2)
X_API_TOOL_ALLOWLIST="getUsersMe,getUsersByUsername,getPostsById,searchPostsRecent,getUsersTimeline,createPosts,deletePosts,likePost,unlikePost,repostPost,unrepostPost"
;;
3)
X_API_TOOL_ALLOWLIST="getUsersMe,getUsersByUsername,getPostsById,searchPostsRecent,getUsersTimeline,createPosts,deletePosts,likePost,unlikePost,repostPost,unrepostPost,createDirectMessagesByParticipantId,getDirectMessagesEventsByParticipantId,getDirectMessagesEvents,sendChatMessage,getChatConversation,getChatConversations"
;;
4)
X_API_TOOL_ALLOWLIST="getUsersMe,getUsersByUsername,getPostsById,searchPostsRecent,getUsersTimeline,createPosts,deletePosts,likePost,unlikePost,repostPost,unrepostPost,createDirectMessagesByParticipantId,getDirectMessagesEventsByParticipantId,getDirectMessagesEvents,sendChatMessage,getChatConversation,getChatConversations,getUsersBookmarks,getUsersBookmarkFolders,getUsersBookmarksByFolderId"
;;
*)
echo "Invalid selection"
exit 1
;;
esac
cat > "$ENV_FILE" <<EOF
X_OAUTH_CONSUMER_KEY=$X_OAUTH_CONSUMER_KEY
X_OAUTH_CONSUMER_SECRET=$X_OAUTH_CONSUMER_SECRET
X_BEARER_TOKEN=$X_BEARER_TOKEN
X_OAUTH_CALLBACK_HOST=127.0.0.1
X_OAUTH_CALLBACK_PORT=8976
X_OAUTH_CALLBACK_PATH=/oauth/callback
X_OAUTH_CALLBACK_TIMEOUT=1200
X_API_BASE_URL=https://api.x.com
X_API_TIMEOUT=30
X_API_DEBUG=1
MCP_HOST=127.0.0.1
MCP_PORT=8010
X_API_TOOL_ALLOWLIST=$X_API_TOOL_ALLOWLIST
MCP_SERVER_URL=http://127.0.0.1:8010/mcp
CLIENT_ID=$CLIENT_ID
CLIENT_SECRET=$CLIENT_SECRET
X_OAUTH_ACCESS_TOKEN=
X_OAUTH_ACCESS_TOKEN_SECRET=
X_OAUTH2_CALLBACK_HOST=127.0.0.1
X_OAUTH2_CALLBACK_PORT=8976
X_OAUTH2_CALLBACK_PATH=/oauth/callback
X_OAUTH2_CALLBACK_TIMEOUT=1200
X_OAUTH2_SCOPES=bookmark.read,tweet.read,users.read,offline.access
X_OAUTH2_ACCESS_TOKEN=
X_OAUTH2_REFRESH_TOKEN=
X_OAUTH2_TOKEN_TYPE=Bearer
X_OAUTH2_EXPIRES_AT=
X_OAUTH_PRINT_TOKENS=0
X_OAUTH_PRINT_AUTH_HEADER=0
EOF
echo "Wrote $ENV_FILE"
echo "Allowlist: $X_API_TOOL_ALLOWLIST"