Skip to content

Commit 22a82b7

Browse files
Fix markdownlint issues in example documentation
- Add language specifiers to all code blocks - Fix heading hierarchy (bold text to proper headings) - Add blank lines after headings for better readability - Escape underscores in file paths (__init__.py -> **init**.py)
1 parent 25948b3 commit 22a82b7

File tree

3 files changed

+64
-13
lines changed

3 files changed

+64
-13
lines changed

examples/servers/simple-streamablehttp-roaming/FILES.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This example demonstrates session roaming across multiple MCP server instances.
44

55
## Directory Structure
66

7-
```
7+
```text
88
simple-streamablehttp-roaming/
99
├── README.md # Comprehensive documentation
1010
├── QUICKSTART.md # 5-minute getting started guide
@@ -47,10 +47,10 @@ simple-streamablehttp-roaming/
4747

4848
### Python Package
4949

50-
- **mcp_simple_streamablehttp_roaming/__init__.py** (3 lines)
50+
- **mcp_simple_streamablehttp_roaming/**init**.py** (3 lines)
5151
- Package version information
5252

53-
- **mcp_simple_streamablehttp_roaming/__main__.py** (5 lines)
53+
- **mcp_simple_streamablehttp_roaming/**main**.py** (5 lines)
5454
- Entry point for running as module
5555

5656
- **mcp_simple_streamablehttp_roaming/server.py** (169 lines)
@@ -115,24 +115,28 @@ simple-streamablehttp-roaming/
115115
## Key Features Demonstrated
116116

117117
### 1. Session Roaming
118+
118119
- Sessions move freely between instances
119120
- No sticky sessions required
120121
- EventStore provides continuity
121122

122123
### 2. Production Deployment
124+
123125
- Docker Compose for local testing
124126
- Kubernetes manifests in README
125127
- NGINX load balancing example
126128
- Redis persistence configuration
127129

128130
### 3. Developer Experience
131+
129132
- Automated testing script
130133
- Comprehensive documentation
131134
- Quick start guide
132135
- Clear error messages
133136
- Detailed logging
134137

135138
### 4. Code Quality
139+
136140
- Type hints throughout
137141
- Comprehensive docstrings
138142
- Configuration via CLI arguments
@@ -142,6 +146,7 @@ simple-streamablehttp-roaming/
142146
## Usage Examples
143147

144148
### Local Development
149+
145150
```bash
146151
# Terminal 1
147152
uv run mcp-streamablehttp-roaming --port 3001 --instance-id instance-1
@@ -154,13 +159,15 @@ uv run mcp-streamablehttp-roaming --port 3002 --instance-id instance-2
154159
```
155160

156161
### Docker Compose
162+
157163
```bash
158164
docker-compose up -d
159165
# Access via http://localhost/mcp (load balanced)
160166
# or directly via http://localhost:3001/mcp, :3002/mcp, :3003/mcp
161167
```
162168

163169
### Manual Testing
170+
164171
```bash
165172
# Create session on Instance 1
166173
curl -X POST http://localhost:3001/mcp -H "Content-Type: application/json" ...
@@ -182,6 +189,7 @@ curl -X POST http://localhost:3002/mcp -H "MCP-Session-ID: <session-id>" ...
182189
### Minimal Code for Maximum Impact
183190

184191
**Enable session roaming with just:**
192+
185193
```python
186194
event_store = RedisEventStore(redis_url="redis://localhost:6379")
187195
manager = StreamableHTTPSessionManager(app=app, event_store=event_store)
@@ -190,6 +198,7 @@ manager = StreamableHTTPSessionManager(app=app, event_store=event_store)
190198
### No Special Session Store Needed
191199

192200
The EventStore alone enables:
201+
193202
- ✅ Event replay (resumability)
194203
- ✅ Session roaming (distributed sessions)
195204
- ✅ Horizontal scaling

examples/servers/simple-streamablehttp-roaming/QUICKSTART.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ Get up and running with session roaming in 5 minutes!
1313
### Step 1: Start Redis
1414

1515
**Using Docker:**
16+
1617
```bash
1718
docker run -d -p 6379:6379 redis:latest
1819
```
1920

2021
**Or using local Redis:**
22+
2123
```bash
2224
redis-server
2325
```
@@ -32,17 +34,20 @@ uv sync
3234
### Step 3: Start Multiple Instances
3335

3436
**Terminal 1 - Instance 1:**
37+
3538
```bash
3639
uv run mcp-streamablehttp-roaming --port 3001 --instance-id instance-1
3740
```
3841

3942
**Terminal 2 - Instance 2:**
43+
4044
```bash
4145
uv run mcp-streamablehttp-roaming --port 3002 --instance-id instance-2
4246
```
4347

4448
You should see:
45-
```
49+
50+
```text
4651
======================================================================
4752
🚀 Instance instance-1 started with SESSION ROAMING!
4853
======================================================================
@@ -56,12 +61,14 @@ You should see:
5661
### Step 4: Test Session Roaming
5762

5863
**Terminal 3 - Run Test:**
64+
5965
```bash
6066
./test_roaming.sh
6167
```
6268

6369
Expected output:
64-
```
70+
71+
```text
6572
🧪 Testing Session Roaming Across MCP Instances
6673
================================================
6774
@@ -80,6 +87,7 @@ Expected output:
8087
```
8188

8289
**What just happened?**
90+
8391
1. Session created on Instance 1
8492
2. Tool called on Instance 1 - success
8593
3. **Same session** used on Instance 2 - **also success!**
@@ -95,6 +103,7 @@ docker-compose up -d
95103
```
96104

97105
This starts:
106+
98107
- Redis (persistent event store)
99108
- 3 MCP server instances (ports 3001, 3002, 3003)
100109
- NGINX load balancer (port 80)
@@ -146,7 +155,8 @@ docker-compose logs -f mcp-instance-3
146155
```
147156

148157
Look for these log messages:
149-
```
158+
159+
```text
150160
INFO - Session abc123 roaming to this instance (EventStore enables roaming)
151161
INFO - Created transport for roaming session: abc123
152162
INFO - Instance instance-2 handling request for session abc123
@@ -179,7 +189,8 @@ curl -X POST http://localhost:3001/mcp \
179189
```
180190

181191
**Save the session ID from the response header:**
182-
```
192+
193+
```text
183194
MCP-Session-ID: a1b2c3d4e5f67890abcdef1234567890
184195
```
185196

@@ -203,6 +214,7 @@ curl -X POST http://localhost:3001/mcp \
203214
```
204215

205216
**Response shows:**
217+
206218
```json
207219
{
208220
"result": {
@@ -234,6 +246,7 @@ curl -X POST http://localhost:3002/mcp \
234246
```
235247

236248
**Response shows:**
249+
237250
```json
238251
{
239252
"result": {
@@ -252,6 +265,7 @@ curl -X POST http://localhost:3002/mcp \
252265
### What Enables Session Roaming?
253266

254267
**Just one line of code:**
268+
255269
```python
256270
session_manager = StreamableHTTPSessionManager(
257271
app=app,
@@ -260,6 +274,7 @@ session_manager = StreamableHTTPSessionManager(
260274
```
261275

262276
That's it! The `event_store` parameter enables:
277+
263278
1. ✅ Event replay (resumability)
264279
2. ✅ Session roaming (distributed sessions)
265280

@@ -276,6 +291,7 @@ When Instance 2 receives a request with an unknown session ID:
276291
### Why Does This Work?
277292

278293
Events in EventStore prove sessions existed:
294+
279295
- Session `abc123` has events in Redis
280296
- Therefore session `abc123` existed
281297
- Safe to create transport for it
@@ -288,6 +304,7 @@ Events in EventStore prove sessions existed:
288304
**Problem:** Redis not running
289305

290306
**Solution:**
307+
291308
```bash
292309
docker run -d -p 6379:6379 redis:latest
293310
```
@@ -297,13 +314,15 @@ docker run -d -p 6379:6379 redis:latest
297314
**Problem:** EventStore not configured or Redis not accessible
298315

299316
**Solution:**
317+
300318
- Check Redis is running: `redis-cli ping` (should return "PONG")
301319
- Check Redis URL in server startup
302320
- Check logs for Redis connection errors
303321

304322
### Session not roaming
305323

306324
**Checklist:**
325+
307326
- [ ] Redis running and accessible
308327
- [ ] All instances use same `--redis-url`
309328
- [ ] Session ID included in `MCP-Session-ID` header
@@ -319,6 +338,7 @@ docker run -d -p 6379:6379 redis:latest
319338
## Questions?
320339

321340
Check out:
341+
322342
- [README.md](README.md) - Full documentation
323343
- [server.py](mcp_simple_streamablehttp_roaming/server.py) - Implementation
324344
- [redis_event_store.py](mcp_simple_streamablehttp_roaming/redis_event_store.py) - EventStore implementation

0 commit comments

Comments
 (0)