-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathmcp.sh
More file actions
60 lines (55 loc) · 1.58 KB
/
Copy pathmcp.sh
File metadata and controls
60 lines (55 loc) · 1.58 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
baseUrl='http://localhost' # Adapt to your test case
jwtToken=$(curl -s -X 'POST' \
"$baseUrl/api/ibexa/v2/user/token/jwt" \
-H 'Content-Type: application/json' \
-d '{
"JWTInput": {
"_media-type": "application/vnd.ibexa.api.JWTInput",
"username": "admin",
"password": "publish"
}
}' | jq -r .JWT.token)
mcpSessionId=$(curl -s -i -X 'POST' "$baseUrl/mcp/example" \
-H "Authorization: Bearer $jwtToken" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-03-26",
"capabilities": {},
"clientInfo": {
"name": "test-curl-client",
"version": "1.0.0"
}
}
}' | grep 'Mcp-Session-Id:' | sed 's/Mcp-Session-Id: \([0-9a-f-]*\).*/\1/')
curl -s -i -X 'POST' "$baseUrl/mcp/example" \
-H "Authorization: Bearer $jwtToken" \
-H "Mcp-Session-Id: $mcpSessionId" \
-d '{
"jsonrpc": "2.0",
"method": "notifications/initialized"
}'
curl -s -X 'POST' "$baseUrl/mcp/example" \
-H "Authorization: Bearer $jwtToken" \
-H "Mcp-Session-Id: $mcpSessionId" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}' | jq
curl -s -X 'POST' "$baseUrl/mcp/example" \
-H "Authorization: Bearer $jwtToken" \
-H "Mcp-Session-Id: $mcpSessionId" \
-d '{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "greet",
"arguments": {
"name": "World"
}
}
}' | jq