yuki-sui commited on
Commit
d7356b6
Β·
verified Β·
1 Parent(s): ce0fb5e

Update mcp-servers/eventbrite-scraper-mcp/README.md

Browse files
mcp-servers/eventbrite-scraper-mcp/README.md CHANGED
@@ -1,331 +1,337 @@
1
- # Eventbrite Scraper MCP Server
2
-
3
- A Model Context Protocol (MCP) server for scraping and searching events from Eventbrite with comprehensive input validation and error handling.
4
-
5
- ## Overview
6
-
7
- This server provides real-time event discovery from Eventbrite through web scraping. It's designed to be lightweight, fast, and robust with built-in security measures to prevent injection attacks and malformed queries.
8
-
9
- **Server Type:** Web Scraper
10
- **Framework:** FastMCP + FastAPI
11
- **Deployment:** Blaxel, Docker, Local
12
- **Response Time:** ~2-5 seconds per search
13
-
14
- ## Features
15
-
16
- - βœ… Real-time Eventbrite event searching
17
- - βœ… Multi-parameter filtering (location, date, price, categories)
18
- - βœ… Input validation and sanitization
19
- - βœ… Rate limiting (respectful to Eventbrite servers)
20
- - βœ… Fallback HTML selectors for robustness
21
- - βœ… Structured JSON responses
22
- - βœ… User-Agent rotation
23
- - βœ… Error handling and logging
24
-
25
- ## Installation
26
-
27
- ### Prerequisites
28
- - Python 3.10+
29
- - pip or Poetry
30
-
31
- ### Setup
32
-
33
- ```bash
34
- # Clone/navigate to the server directory
35
- cd eventbrite-scraper-mcp
36
-
37
- # Install dependencies
38
- pip install -e .
39
- # OR
40
- poetry install
41
- ```
42
-
43
- ### Configuration
44
-
45
- Create a `.env` file in the root directory:
46
-
47
- ```env
48
- # Optional: Configure logging level
49
- LOG_LEVEL=INFO
50
-
51
- # Optional: Request timeout (seconds)
52
- REQUEST_TIMEOUT=10
53
- ```
54
-
55
- ## Tools
56
-
57
- ### `search_eventbrite`
58
-
59
- Search and filter events on Eventbrite.
60
-
61
- **Parameters:**
62
-
63
- | Parameter | Type | Required | Constraints | Description |
64
- |-----------|------|----------|-------------|-------------|
65
- | `location` | string | βœ… Yes | 2-100 chars, no special chars | City or region (e.g., "New York", "San Francisco") |
66
- | `start_date` | string | ❌ No | YYYY-MM-DD format | Filter events from this date onwards |
67
- | `end_date` | string | ❌ No | YYYY-MM-DD format | Filter events up to this date |
68
- | `min_price` | float | ❌ No | β‰₯ 0 | Minimum ticket price filter |
69
- | `max_price` | float | ❌ No | β‰₯ 0 | Maximum ticket price filter |
70
- | `categories` | list[string] | ❌ No | Max 10 items | Event categories (e.g., ["music", "food", "sports"]) |
71
-
72
- **Response Structure:**
73
-
74
- ```json
75
- {
76
- "success": true,
77
- "query": {
78
- "location": "New York",
79
- "start_date": "2025-06-01",
80
- "end_date": "2025-06-30",
81
- "min_price": 0,
82
- "max_price": 100,
83
- "categories": []
84
- },
85
- "events": [
86
- {
87
- "title": "Summer Music Festival",
88
- "date": "2025-06-15",
89
- "location": "New York, NY",
90
- "venue": "Central Park",
91
- "price_min": 25.0,
92
- "price_max": 75.0,
93
- "is_free": false,
94
- "url": "https://www.eventbrite.com/e/...",
95
- "source": "Eventbrite",
96
- "category": "music"
97
- }
98
- ],
99
- "count": 1,
100
- "timestamp": "2025-06-01T12:00:00Z"
101
- }
102
- ```
103
-
104
- ## Usage Examples
105
-
106
- ### Basic Search
107
-
108
- ```python
109
- from client import EventbriteScraperClient
110
-
111
- client = EventbriteScraperClient()
112
-
113
- # Search for all events in a location
114
- result = await client.search_eventbrite(
115
- location="New York"
116
- )
117
- ```
118
-
119
- ### Advanced Search with Filters
120
-
121
- ```python
122
- # Search with multiple filters
123
- result = await client.search_eventbrite(
124
- location="San Francisco",
125
- start_date="2025-07-01",
126
- end_date="2025-07-31",
127
- min_price=0,
128
- max_price=50,
129
- categories=["music", "tech"]
130
- )
131
-
132
- # Process results
133
- for event in result['events']:
134
- print(f"{event['title']} - {event['date']} at {event['venue']}")
135
- ```
136
-
137
- ## Running the Server
138
-
139
- ### Local Development
140
-
141
- ```bash
142
- # Start the server
143
- python src/server.py
144
-
145
- # Server will be available at:
146
- # http://localhost:8000
147
- # MCP endpoint: http://localhost:8000/mcp
148
- ```
149
-
150
- ### Docker
151
-
152
- ```bash
153
- # Build container
154
- docker build -t eventbrite-scraper-mcp .
155
-
156
- # Run container
157
- docker run -p 8000:8000 eventbrite-scraper-mcp
158
- ```
159
-
160
- ### Blaxel Deployment
161
-
162
- ```bash
163
- # Deploy via Blaxel CLI
164
- blaxel deploy
165
-
166
- # Configuration in blaxel.toml:
167
- # - Function timeout: 900 seconds
168
- # - Memory: 2048 MB
169
- # - HTTP trigger: /mcp (public)
170
- ```
171
-
172
- ## Input Validation
173
-
174
- All inputs are validated before processing:
175
-
176
- ### Location Validation
177
- - Length: 2-100 characters
178
- - Blocks path traversal attempts (`../`, `..\\`)
179
- - Blocks SQL injection patterns
180
- - Allows spaces and hyphens only
181
-
182
- ### Date Validation
183
- - Format: `YYYY-MM-DD`
184
- - Must be valid calendar dates
185
- - Supports past, current, and future dates
186
-
187
- ### Price Validation
188
- - Must be non-negative numbers
189
- - Supports floating-point values
190
- - `max_price` must be β‰₯ `min_price`
191
-
192
- ## Architecture
193
-
194
- ```
195
- User Request
196
- ↓
197
- Input Validation
198
- ↓
199
- Build Eventbrite URL
200
- ↓
201
- HTTP Request (with User-Agent)
202
- ↓
203
- Parse HTML with BeautifulSoup
204
- ↓
205
- Try Fallback Selectors
206
- ↓
207
- Extract Event Data
208
- ↓
209
- Return JSON Response
210
- ```
211
-
212
- ## Error Handling
213
-
214
- | Error | Status | Solution |
215
- |-------|--------|----------|
216
- | Invalid location | 400 | Provide valid 2-100 char location |
217
- | Invalid date format | 400 | Use YYYY-MM-DD format |
218
- | Network timeout | 503 | Retry after 10 seconds |
219
- | No events found | 200 | Returns empty events array |
220
- | Eventbrite blocked | 429 | Rate limiter activated, wait 60 seconds |
221
-
222
- ## Performance
223
-
224
- - **Average Response Time:** 2-5 seconds
225
- - **Timeout:** 30 seconds per request
226
- - **Rate Limiting:** 1 second sleep between requests
227
- - **Concurrent Requests:** Single-threaded (async compatible)
228
- - **Memory Usage:** ~50 MB
229
-
230
- ## Security Measures
231
-
232
- βœ… **Input Sanitization**
233
- - Blocks path traversal (`../`)
234
- - Blocks SQL injection patterns
235
- - Character whitelist enforcement
236
-
237
- βœ… **Rate Limiting**
238
- - 1-second delay between requests
239
- - Respectful to Eventbrite servers
240
-
241
- βœ… **User-Agent Rotation**
242
- - Appears as legitimate browser requests
243
-
244
- βœ… **Error Suppression**
245
- - No sensitive information in error messages
246
-
247
- ## Limitations
248
-
249
- ⚠️ **Web Scraping Constraints**
250
- - Depends on Eventbrite HTML structure
251
- - May break if Eventbrite changes selectors
252
- - Subject to rate limiting from Eventbrite
253
- - Cannot access Eventbrite API (requires authentication)
254
-
255
- ⚠️ **Coverage**
256
- - Only searches Eventbrite.com
257
- - Limited to 20 results per location search
258
- - May not include all event details
259
-
260
- ## Troubleshooting
261
-
262
- ### No events returned
263
- 1. Verify location spelling
264
- 2. Check date range validity
265
- 3. Try without category filters
266
- 4. Ensure Eventbrite isn't blocking requests
267
-
268
- ### Timeout errors
269
- 1. Increase timeout in configuration
270
- 2. Reduce search scope (narrower dates/location)
271
- 3. Check network connectivity
272
-
273
- ### Invalid JSON responses
274
- 1. Check server logs: `tail -f logs/server.log`
275
- 2. Verify input parameters
276
- 3. Ensure Eventbrite is accessible
277
-
278
- ## Dependencies
279
-
280
- ```
281
- fastmcp >= 2.0.0
282
- fastapi >= 0.104.0
283
- uvicorn >= 0.24.0
284
- requests >= 2.31.0
285
- beautifulsoup4 >= 4.12.0
286
- lxml >= 4.9.0
287
- python-dotenv >= 1.0.0
288
- ```
289
-
290
- ## Maintenance
291
-
292
- ### Regular Tasks
293
- - Monitor HTML selector changes on Eventbrite
294
- - Update User-Agent strings quarterly
295
- - Test with latest Python 3.10+ versions
296
- - Review error logs weekly
297
-
298
- ### Updating Selectors
299
- If Eventbrite changes their HTML structure:
300
-
301
- 1. Open https://www.eventbrite.com/search/
302
- 2. Inspect event card HTML
303
- 3. Update selectors in `src/server.py`
304
- 4. Run tests: `pytest tests/`
305
-
306
- ## Contributing
307
-
308
- To improve this server:
309
-
310
- 1. Test thoroughly before committing
311
- 2. Add input validation for new parameters
312
- 3. Follow existing error handling patterns
313
- 4. Document new features in this README
314
- 5. Maintain backwards compatibility
315
-
316
- ## License
317
-
318
- Same as parent project (MCP Security Hackathon)
319
-
320
- ## Support
321
-
322
- For issues or questions:
323
- 1. Check the Troubleshooting section above
324
- 2. Review server logs in `logs/`
325
- 3. File an issue in the main repository
326
- 4. Contact the MCP Security team
327
-
328
- ---
329
-
330
- **Last Updated:** 2025-06-01
331
- **Maintainer:** MCP Security Team
 
 
 
 
 
 
 
1
+ tags:
2
+ - building-mcp-track-enterprise
3
+ - building-mcp-track-consumer
4
+ - building-mcp-track-creative
5
+
6
+ ----
7
+ # Eventbrite Scraper MCP Server
8
+
9
+ A Model Context Protocol (MCP) server for scraping and searching events from Eventbrite with comprehensive input validation and error handling.
10
+
11
+ ## Overview
12
+
13
+ This server provides real-time event discovery from Eventbrite through web scraping. It's designed to be lightweight, fast, and robust with built-in security measures to prevent injection attacks and malformed queries.
14
+
15
+ **Server Type:** Web Scraper
16
+ **Framework:** FastMCP + FastAPI
17
+ **Deployment:** Blaxel, Docker, Local
18
+ **Response Time:** ~2-5 seconds per search
19
+
20
+ ## Features
21
+
22
+ - βœ… Real-time Eventbrite event searching
23
+ - βœ… Multi-parameter filtering (location, date, price, categories)
24
+ - βœ… Input validation and sanitization
25
+ - βœ… Rate limiting (respectful to Eventbrite servers)
26
+ - βœ… Fallback HTML selectors for robustness
27
+ - βœ… Structured JSON responses
28
+ - βœ… User-Agent rotation
29
+ - βœ… Error handling and logging
30
+
31
+ ## Installation
32
+
33
+ ### Prerequisites
34
+ - Python 3.10+
35
+ - pip or Poetry
36
+
37
+ ### Setup
38
+
39
+ ```bash
40
+ # Clone/navigate to the server directory
41
+ cd eventbrite-scraper-mcp
42
+
43
+ # Install dependencies
44
+ pip install -e .
45
+ # OR
46
+ poetry install
47
+ ```
48
+
49
+ ### Configuration
50
+
51
+ Create a `.env` file in the root directory:
52
+
53
+ ```env
54
+ # Optional: Configure logging level
55
+ LOG_LEVEL=INFO
56
+
57
+ # Optional: Request timeout (seconds)
58
+ REQUEST_TIMEOUT=10
59
+ ```
60
+
61
+ ## Tools
62
+
63
+ ### `search_eventbrite`
64
+
65
+ Search and filter events on Eventbrite.
66
+
67
+ **Parameters:**
68
+
69
+ | Parameter | Type | Required | Constraints | Description |
70
+ |-----------|------|----------|-------------|-------------|
71
+ | `location` | string | βœ… Yes | 2-100 chars, no special chars | City or region (e.g., "New York", "San Francisco") |
72
+ | `start_date` | string | ❌ No | YYYY-MM-DD format | Filter events from this date onwards |
73
+ | `end_date` | string | ❌ No | YYYY-MM-DD format | Filter events up to this date |
74
+ | `min_price` | float | ❌ No | β‰₯ 0 | Minimum ticket price filter |
75
+ | `max_price` | float | ❌ No | β‰₯ 0 | Maximum ticket price filter |
76
+ | `categories` | list[string] | ❌ No | Max 10 items | Event categories (e.g., ["music", "food", "sports"]) |
77
+
78
+ **Response Structure:**
79
+
80
+ ```json
81
+ {
82
+ "success": true,
83
+ "query": {
84
+ "location": "New York",
85
+ "start_date": "2025-06-01",
86
+ "end_date": "2025-06-30",
87
+ "min_price": 0,
88
+ "max_price": 100,
89
+ "categories": []
90
+ },
91
+ "events": [
92
+ {
93
+ "title": "Summer Music Festival",
94
+ "date": "2025-06-15",
95
+ "location": "New York, NY",
96
+ "venue": "Central Park",
97
+ "price_min": 25.0,
98
+ "price_max": 75.0,
99
+ "is_free": false,
100
+ "url": "https://www.eventbrite.com/e/...",
101
+ "source": "Eventbrite",
102
+ "category": "music"
103
+ }
104
+ ],
105
+ "count": 1,
106
+ "timestamp": "2025-06-01T12:00:00Z"
107
+ }
108
+ ```
109
+
110
+ ## Usage Examples
111
+
112
+ ### Basic Search
113
+
114
+ ```python
115
+ from client import EventbriteScraperClient
116
+
117
+ client = EventbriteScraperClient()
118
+
119
+ # Search for all events in a location
120
+ result = await client.search_eventbrite(
121
+ location="New York"
122
+ )
123
+ ```
124
+
125
+ ### Advanced Search with Filters
126
+
127
+ ```python
128
+ # Search with multiple filters
129
+ result = await client.search_eventbrite(
130
+ location="San Francisco",
131
+ start_date="2025-07-01",
132
+ end_date="2025-07-31",
133
+ min_price=0,
134
+ max_price=50,
135
+ categories=["music", "tech"]
136
+ )
137
+
138
+ # Process results
139
+ for event in result['events']:
140
+ print(f"{event['title']} - {event['date']} at {event['venue']}")
141
+ ```
142
+
143
+ ## Running the Server
144
+
145
+ ### Local Development
146
+
147
+ ```bash
148
+ # Start the server
149
+ python src/server.py
150
+
151
+ # Server will be available at:
152
+ # http://localhost:8000
153
+ # MCP endpoint: http://localhost:8000/mcp
154
+ ```
155
+
156
+ ### Docker
157
+
158
+ ```bash
159
+ # Build container
160
+ docker build -t eventbrite-scraper-mcp .
161
+
162
+ # Run container
163
+ docker run -p 8000:8000 eventbrite-scraper-mcp
164
+ ```
165
+
166
+ ### Blaxel Deployment
167
+
168
+ ```bash
169
+ # Deploy via Blaxel CLI
170
+ blaxel deploy
171
+
172
+ # Configuration in blaxel.toml:
173
+ # - Function timeout: 900 seconds
174
+ # - Memory: 2048 MB
175
+ # - HTTP trigger: /mcp (public)
176
+ ```
177
+
178
+ ## Input Validation
179
+
180
+ All inputs are validated before processing:
181
+
182
+ ### Location Validation
183
+ - Length: 2-100 characters
184
+ - Blocks path traversal attempts (`../`, `..\\`)
185
+ - Blocks SQL injection patterns
186
+ - Allows spaces and hyphens only
187
+
188
+ ### Date Validation
189
+ - Format: `YYYY-MM-DD`
190
+ - Must be valid calendar dates
191
+ - Supports past, current, and future dates
192
+
193
+ ### Price Validation
194
+ - Must be non-negative numbers
195
+ - Supports floating-point values
196
+ - `max_price` must be β‰₯ `min_price`
197
+
198
+ ## Architecture
199
+
200
+ ```
201
+ User Request
202
+ ↓
203
+ Input Validation
204
+ ↓
205
+ Build Eventbrite URL
206
+ ↓
207
+ HTTP Request (with User-Agent)
208
+ ↓
209
+ Parse HTML with BeautifulSoup
210
+ ↓
211
+ Try Fallback Selectors
212
+ ↓
213
+ Extract Event Data
214
+ ↓
215
+ Return JSON Response
216
+ ```
217
+
218
+ ## Error Handling
219
+
220
+ | Error | Status | Solution |
221
+ |-------|--------|----------|
222
+ | Invalid location | 400 | Provide valid 2-100 char location |
223
+ | Invalid date format | 400 | Use YYYY-MM-DD format |
224
+ | Network timeout | 503 | Retry after 10 seconds |
225
+ | No events found | 200 | Returns empty events array |
226
+ | Eventbrite blocked | 429 | Rate limiter activated, wait 60 seconds |
227
+
228
+ ## Performance
229
+
230
+ - **Average Response Time:** 2-5 seconds
231
+ - **Timeout:** 30 seconds per request
232
+ - **Rate Limiting:** 1 second sleep between requests
233
+ - **Concurrent Requests:** Single-threaded (async compatible)
234
+ - **Memory Usage:** ~50 MB
235
+
236
+ ## Security Measures
237
+
238
+ βœ… **Input Sanitization**
239
+ - Blocks path traversal (`../`)
240
+ - Blocks SQL injection patterns
241
+ - Character whitelist enforcement
242
+
243
+ βœ… **Rate Limiting**
244
+ - 1-second delay between requests
245
+ - Respectful to Eventbrite servers
246
+
247
+ βœ… **User-Agent Rotation**
248
+ - Appears as legitimate browser requests
249
+
250
+ βœ… **Error Suppression**
251
+ - No sensitive information in error messages
252
+
253
+ ## Limitations
254
+
255
+ ⚠️ **Web Scraping Constraints**
256
+ - Depends on Eventbrite HTML structure
257
+ - May break if Eventbrite changes selectors
258
+ - Subject to rate limiting from Eventbrite
259
+ - Cannot access Eventbrite API (requires authentication)
260
+
261
+ ⚠️ **Coverage**
262
+ - Only searches Eventbrite.com
263
+ - Limited to 20 results per location search
264
+ - May not include all event details
265
+
266
+ ## Troubleshooting
267
+
268
+ ### No events returned
269
+ 1. Verify location spelling
270
+ 2. Check date range validity
271
+ 3. Try without category filters
272
+ 4. Ensure Eventbrite isn't blocking requests
273
+
274
+ ### Timeout errors
275
+ 1. Increase timeout in configuration
276
+ 2. Reduce search scope (narrower dates/location)
277
+ 3. Check network connectivity
278
+
279
+ ### Invalid JSON responses
280
+ 1. Check server logs: `tail -f logs/server.log`
281
+ 2. Verify input parameters
282
+ 3. Ensure Eventbrite is accessible
283
+
284
+ ## Dependencies
285
+
286
+ ```
287
+ fastmcp >= 2.0.0
288
+ fastapi >= 0.104.0
289
+ uvicorn >= 0.24.0
290
+ requests >= 2.31.0
291
+ beautifulsoup4 >= 4.12.0
292
+ lxml >= 4.9.0
293
+ python-dotenv >= 1.0.0
294
+ ```
295
+
296
+ ## Maintenance
297
+
298
+ ### Regular Tasks
299
+ - Monitor HTML selector changes on Eventbrite
300
+ - Update User-Agent strings quarterly
301
+ - Test with latest Python 3.10+ versions
302
+ - Review error logs weekly
303
+
304
+ ### Updating Selectors
305
+ If Eventbrite changes their HTML structure:
306
+
307
+ 1. Open https://www.eventbrite.com/search/
308
+ 2. Inspect event card HTML
309
+ 3. Update selectors in `src/server.py`
310
+ 4. Run tests: `pytest tests/`
311
+
312
+ ## Contributing
313
+
314
+ To improve this server:
315
+
316
+ 1. Test thoroughly before committing
317
+ 2. Add input validation for new parameters
318
+ 3. Follow existing error handling patterns
319
+ 4. Document new features in this README
320
+ 5. Maintain backwards compatibility
321
+
322
+ ## License
323
+
324
+ Same as parent project (MCP Security Hackathon)
325
+
326
+ ## Support
327
+
328
+ For issues or questions:
329
+ 1. Check the Troubleshooting section above
330
+ 2. Review server logs in `logs/`
331
+ 3. File an issue in the main repository
332
+ 4. Contact the MCP Security team
333
+
334
+ ---
335
+
336
+ **Last Updated:** 2025-06-01
337
+ **Maintainer:** MCP Security Team