Commit ea034eb
committed
feat: Add comprehensive MCP prompts implementation
This PR adds full support for MCP prompts following the specification:
Core Features:
- Complete prompts API with message creation and validation
- Dry::Schema-based argument validation like tools
- ERB template support for structured messages
- Multiple message format support (hash, array, builder pattern)
- Support for text, image, and resource content types
Architecture Enhancements:
- Feature parity with tools (tags, metadata, annotations, authorization)
- Prompt filtering support integrated with ServerFiltering
- Stateless architecture matching resources pattern
- Auto-naming from class names (CodeReviewPrompt → code_review)
- Headers support for authorization context
API Improvements:
- Flexible messages API supporting multiple same-role messages
- MessageBuilder for fluent message construction
- Base64 validation for image content
- Comprehensive content type handling
Rails Integration:
- Rails generator support for prompts
- ApplicationPrompt base class
- Auto-discovery of prompt descendants
- Sample prompt template included
Testing & Documentation:
- Extensive test coverage (900+ lines)
- Complete documentation with examples
- Rails integration guide updates
- Template validation tests
Breaking Changes:
- Resources now stateless (documented in CHANGELOG)
Co-authored-by: @nfedyashev (review feedback)1 parent f2f815f commit ea034eb
File tree
28 files changed
+3669
-15
lines changed- docs
- examples
- prompts
- templates
- lib
- generators/fast_mcp/install
- templates
- mcp
- spec
- mcp
- templates
28 files changed
+3669
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
11 | 22 | | |
12 | 23 | | |
13 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | | - | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
272 | 293 | | |
273 | 294 | | |
274 | 295 | | |
| |||
338 | 359 | | |
339 | 360 | | |
340 | 361 | | |
| 362 | + | |
341 | 363 | | |
342 | 364 | | |
343 | 365 | | |
| |||
347 | 369 | | |
348 | 370 | | |
349 | 371 | | |
| 372 | + | |
350 | 373 | | |
351 | 374 | | |
352 | 375 | | |
| |||
398 | 421 | | |
399 | 422 | | |
400 | 423 | | |
| 424 | + | |
401 | 425 | | |
402 | 426 | | |
403 | 427 | | |
| |||
408 | 432 | | |
409 | 433 | | |
410 | 434 | | |
| 435 | + | |
411 | 436 | | |
412 | 437 | | |
413 | 438 | | |
| |||
437 | 462 | | |
438 | 463 | | |
439 | 464 | | |
440 | | - | |
| 465 | + | |
0 commit comments