Skip to content

Commit e3e1188

Browse files
committed
chore(mcp): add demo scripts
1 parent 1e13dcf commit e3e1188

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

demo/chat_completions.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
# Source common configuration
3+
source "$(dirname "$0")/config.sh"
4+
5+
echo "Calling MCP proxy for chat completions with model: ${MODEL_ID}"
6+
# save as variable then print it
7+
response=$(curl localhost:8080/v1/chat/completions -s \
8+
-H "Content-Type: application/json" \
9+
-H "Authorization: Bearer ${OPENAI_API_KEY}" \
10+
-d '{
11+
"model": "gpt-4o",
12+
"messages": [{
13+
"role": "user",
14+
"content": "Just call 'list_tables' action"
15+
}]
16+
}')
17+
echo "$response"

demo/codex.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# Source common configuration
3+
source "$(dirname "$0")/config.sh"
4+
5+
nvm install 22.15.1
6+
nvm use 22.15.1
7+
npm install -g @openai/codex
8+
9+
codex --provider Meta --quiet --model "${MODEL_ID}" "I gave you sqlite access via tools. Confirm you see that tool. List all tables in the database. Create 'test_table' if none exist. When errors, let me know what the error is"

demo/config.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
# Common configuration for test scripts
3+
# This file should be sourced by other scripts
4+
5+
# Default model ID to use if DEFAULT_MODEL_ID environment variable is not set
6+
DEFAULT_MODEL_FALLBACK="gpt-4o"
7+
# For codex script which uses a different default model
8+
DEFAULT_CODEX_MODEL_FALLBACK="gpt-4o"
9+
10+
if [ "$USE_CODEX" = "true" ]; then
11+
MODEL_ID=${DEFAULT_MODEL_ID:-"$DEFAULT_CODEX_MODEL_FALLBACK"}
12+
else
13+
MODEL_ID=${DEFAULT_MODEL_ID:-"$DEFAULT_MODEL_FALLBACK"}
14+
fi

demo/responses.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
# Source common configuration
3+
source "$(dirname "$0")/config.sh"
4+
5+
curl localhost:8080/responses \
6+
-H "Content-Type: application/json" \
7+
-H "Authorization: Bearer $OPENAI_API_KEY" \
8+
-d '{
9+
"model": "'"${MODEL_ID}"'",
10+
"input": "List existing tables.",
11+
"max_output_tokens": 100,
12+
"temperature": 0.7,
13+
"stream": true
14+
}'

0 commit comments

Comments
 (0)