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
80
81
82
//! A minimal MCP server over HTTP that exposes a "greet" tool and a "greeting_prompt" prompt.
//!
//! Run: `RUST_LOG=stand_in=info cargo run --example http_server --features http`
//!
//! For detailed request tracing:
//! `RUST_LOG=stand_in=debug cargo run --example http_server --features http`
//!
//! Then test with curl:
//!
//! ```bash
//! # Initialize (creates session)
//! curl -X POST http://127.0.0.1:3000/mcp \
//! -H "Content-Type: application/json" \
//! -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"0.1.0"}}}'
//!
//! # List tools (use Mcp-Session-Id from the initialize response header)
//! curl -X POST http://127.0.0.1:3000/mcp \
//! -H "Content-Type: application/json" \
//! -H "Mcp-Session-Id: <SESSION_ID>" \
//! -d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
//!
//! # Call a tool
//! curl -X POST http://127.0.0.1:3000/mcp \
//! -H "Content-Type: application/json" \
//! -H "Mcp-Session-Id: <SESSION_ID>" \
//! -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"greet","arguments":{"name":"World"}}}'
//!
//! # List prompts
//! curl -X POST http://127.0.0.1:3000/mcp \
//! -H "Content-Type: application/json" \
//! -H "Mcp-Session-Id: <SESSION_ID>" \
//! -d '{"jsonrpc":"2.0","id":4,"method":"prompts/list"}'
//!
//! # Get a prompt (name is required; style is optional)
//! curl -X POST http://127.0.0.1:3000/mcp \
//! -H "Content-Type: application/json" \
//! -H "Mcp-Session-Id: <SESSION_ID>" \
//! -d '{"jsonrpc":"2.0","id":5,"method":"prompts/get","params":{"name":"greeting_prompt","arguments":{"name":"Alice","style":"formal"}}}'
//!
//! # Terminate session
//! curl -X DELETE http://127.0.0.1:3000/mcp \
//! -H "Mcp-Session-Id: <SESSION_ID>"
//! ```
use *;
use EnvFilter;
async
async
;
async