Skip to main content
Glama
8b-is
by 8b-is
SSE_QUICK_START.md2.23 kB
# Quick Start: Testing SSE with Curl ## 1. Install Dependencies (for test server) ```bash cd /home/hue/source/smart-tree/examples pip install -r sse_requirements.txt ``` ## 2. Start the Test Server ```bash python3 sse_test_server.py ``` This starts a server on http://localhost:8420 with: - Browser test page: http://localhost:8420 - SSE endpoint: http://localhost:8420/sse ## 3. Run Curl Tests ### Option A: Run all tests automatically ```bash ./test_sse_curl.sh ``` ### Option B: Run individual curl commands #### Basic SSE stream: ```bash curl -N -H "Accept: text/event-stream" http://localhost:8420/sse ``` #### Pretty-printed JSON events: ```bash curl -N -H "Accept: text/event-stream" http://localhost:8420/sse 2>/dev/null | \ while IFS= read -r line; do [[ $line =~ ^data: ]] && echo "$line" | cut -d' ' -f2- | jq . done ``` #### Filter specific events: ```bash curl -N -H "Accept: text/event-stream" http://localhost:8420/sse 2>/dev/null | \ grep -E '^event: (created|modified|deleted)' -A2 ``` #### With timeout (10 seconds): ```bash timeout 10 curl -N -H "Accept: text/event-stream" http://localhost:8420/sse ``` ## 4. Understanding the Output SSE events follow this format: ``` event: created id: 1234567890 data: {"type":"created","path":"/path/to/file.txt","node":{...}} event: heartbeat id: 1234567891 data: {"type":"heartbeat","count":1} ``` ## 5. Test in Browser Open http://localhost:8420 in a browser to see a visual representation of the SSE stream. ## 6. Advanced Examples See `sse_curl_examples.sh` for more advanced usage patterns including: - Event counting - Real-time monitoring display - Event filtering with jq - Performance monitoring - Event recording and replay ## Common Curl Flags for SSE - `-N` / `--no-buffer`: Disable buffering for real-time output - `-H "Accept: text/event-stream"`: Required SSE header - `--compressed`: Enable compression - `-m <seconds>`: Set maximum time - `-v`: Verbose mode (shows headers) ## Troubleshooting 1. **No output**: Check server is running on port 8420 2. **Buffered output**: Make sure to use `-N` flag 3. **Connection drops**: Normal for SSE, client should reconnect 4. **JSON parse errors**: Use `2>/dev/null` to suppress curl progress

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/8b-is/smart-tree'

If you have feedback or need assistance with the MCP directory API, please join our Discord server