Files
hermes-mcp/test-mcp-curl.sh
2026-04-29 09:52:53 -04:00

37 lines
1.1 KiB
Bash

#!/bin/bash
set -e
API_KEY="114521f3f9e6858480d6269446a446ef"
URL="http://localhost:3456/mcp"
# Initialize
INIT_RESP=$(curl -s -D - -X POST "$URL" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "x-api-key: $API_KEY" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}')
echo "=== INIT RESPONSE ==="
echo "$INIT_RESP"
echo ""
SESSION_ID=$(echo "$INIT_RESP" | grep -i "mcp-session-id:" | awk '{print $2}' | tr -d '\r')
echo "SESSION_ID: $SESSION_ID"
if [ -z "$SESSION_ID" ]; then
echo "No session ID, trying to parse body"
echo "$INIT_RESP" | tail -1 | jq .
exit 1
fi
# Call get_profile for gmail
PROFILE_RESP=$(curl -s -D - -X POST "$URL" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "x-api-key: $API_KEY" \
-H "mcp-session-id: $SESSION_ID" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_profile","arguments":{"account":"gmail"}}}')
echo "=== PROFILE RESPONSE ==="
echo "$PROFILE_RESP"