Skip to content

Commit

Permalink
🚑 Fix protocol providers and crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
wesen committed Feb 22, 2025
1 parent 14947dd commit da5d146
Show file tree
Hide file tree
Showing 12 changed files with 635 additions and 21 deletions.
10 changes: 8 additions & 2 deletions cmd/go-go-mcp/cmds/server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
glazed_layers "github.com/go-go-golems/glazed/pkg/cmds/layers"
"github.com/go-go-golems/glazed/pkg/cmds/parameters"
"github.com/go-go-golems/go-go-mcp/cmd/go-go-mcp/cmds/server/layers"
"github.com/go-go-golems/go-go-mcp/pkg/resources"
"github.com/go-go-golems/go-go-mcp/pkg/server"
"github.com/go-go-golems/go-go-mcp/pkg/transport"
"github.com/go-go-golems/go-go-mcp/pkg/transport/sse"
Expand Down Expand Up @@ -116,8 +117,13 @@ func (c *StartCommand) Run(
return err
}

// Create and start server with transport
s := server.NewServer(logger, t, server.WithToolProvider(toolProvider))
// Create resource provider
resourceProvider := resources.NewRegistry()

// Create and start server with transport and providers
s := server.NewServer(logger, t,
server.WithToolProvider(toolProvider),
server.WithResourceProvider(resourceProvider))

// Create a context that will be cancelled on SIGINT/SIGTERM
ctx, stop := signal.NotifyContext(ctx, os.Interrupt, syscall.SIGTERM)
Expand Down
41 changes: 41 additions & 0 deletions examples/pages/costume-contest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
components:
- title:
content: "🎭 Halloween Costume Contest"
id: contest-title

- text:
content: "Vote for the spookiest, most creative costume of the year! Each contestant has put their heart (and maybe some actual organs) into their costumes."
id: contest-description

- list:
type: ul
items:
- title:
content: "🧟‍♂️ Zombie Businessman"
- text:
content: "Bob from accounting really committed to the role - he hasn't showered in weeks!"
- button:
text: "Vote for Bob"
type: primary
onclick: "alert('Your vote for Zombie Bob has been counted!')"
- title:
content: "🧙‍♀️ Techno Witch"
- text:
content: "Sarah's costume combines traditional witchcraft with RGB lighting - truly spellbinding!"
- button:
text: "Vote for Sarah"
type: primary
onclick: "alert('Your vote for Techno Witch has been counted!')"
- title:
content: "👻 Ghost in the Machine"
- text:
content: "Mike dressed up as a haunted computer - blue screen of death included!"
- button:
text: "Vote for Mike"
type: primary
onclick: "alert('Your vote for Ghost Mike has been counted!')"

- text:
content: "Voting closes at midnight on Halloween. The winner gets a one-way ticket to the shadow realm! (Just kidding, they get a gift card)"
id: voting-rules-text

86 changes: 86 additions & 0 deletions examples/pages/gorilla.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
components:
- title:
content: 🦍 GORILLA GAME 🦍

- text:
content: Lead your gorilla through the jungle, collect bananas, and avoid dangers!

- form:
id: game-controls
components:
- list:
type: ul
items:
- Health:
text:
content: "❤️❤️❤️"
id: health-display
- Score:
text:
content: "🍌 0"
id: score-display
- Level:
text:
content: "🌴 1"
id: level-display

- list:
type: ul
items:
- button:
text: "⬅️ Left"
type: primary
id: move-left
- button:
text: "⬆️ Jump"
type: primary
id: move-up
- button:
text: "➡️ Right"
type: primary
id: move-right

- list:
type: ul
items:
- button:
text: "🎮 Start Game"
type: success
id: start-game
- button:
text: "⏸️ Pause"
type: secondary
id: pause-game
- button:
text: "🔄 Restart"
type: danger
id: restart-game

- form:
id: game-settings
components:
- title:
content: Settings
- checkbox:
label: "🔊 Sound Effects"
checked: true
id: sound-toggle
- checkbox:
label: "🎵 Background Music"
checked: true
id: music-toggle
- input:
type: text
placeholder: Enter player name
id: player-name
required: true

- text:
content: "High Scores 🏆"

- list:
type: ol
items:
- "King Kong: 2000 🍌"
- "Mighty Joe: 1500 🍌"
- "Donkey Kong: 1000 🍌"
56 changes: 56 additions & 0 deletions examples/pages/halloween-party.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
components:
- title:
content: "🎪 Halloween Party RSVP"
id: party-title

- text:
content: "Join us for the spookiest party of the year! There will be treats, tricks, and maybe a few uninvited ghostly guests..."
id: party-description

- form:
id: rsvp-form
components:
- input:
type: text
placeholder: "Your Name (mortal or otherwise)"
required: true
id: name-input
- input:
type: email
placeholder: "Email Address"
required: true
id: email-input
- input:
type: text
placeholder: "Your Costume Plan"
required: true
id: costume-input
- checkbox:
label: "I'll bring a spooky snack to share 🍪"
id: snack-checkbox
- checkbox:
label: "I'm bringing a plus-one (living guests only, please) 👥"
id: guest-checkbox
- list:
type: ul
items:
- text:
content: "🎵 Music preferences:"
- checkbox:
label: "Monster Mash"
id: music-1
- checkbox:
label: "Thriller"
id: music-2
- checkbox:
label: "Ghostbusters Theme"
id: music-3
- textarea:
placeholder: "Any dietary restrictions? (Blood type preferences?)"
rows: 2
id: dietary-input
- button:
text: "RSVP to Party"
type: success
onclick: "alert('Your soul is on the guest list!')"
id: submit-btn
45 changes: 45 additions & 0 deletions examples/pages/haunted-house.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
components:
- title:
content: "🏚️ Book Your Haunted House Tour"
id: tour-title

- text:
content: "Dare to explore our haunted mansion? Fill out the form below to reserve your spot in our terrifying tour. Remember, the ghosts are waiting..."
id: tour-description

- form:
id: tour-form
components:
- input:
type: text
placeholder: "Your Name (if you survive...)"
required: true
id: name-input
- input:
type: email
placeholder: "Email (for ghost communications)"
required: true
id: email-input
- input:
type: date
placeholder: "Select your doom date"
required: true
id: date-input
- input:
type: number
placeholder: "Number of brave souls"
required: true
id: guests-input
- checkbox:
label: "I acknowledge that the spirits may possess my soul 👻"
required: true
id: waiver-checkbox
- textarea:
placeholder: "Any last words or special requests?"
rows: 3
id: comments-input
- button:
text: "Book If You Dare"
type: danger
onclick: "alert('Your fate is sealed...')"
id: submit-btn
49 changes: 49 additions & 0 deletions examples/pages/todo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
components:
- title:
content: What would you like to tackle next?
id: priority-title

- text:
content: I see you have several items that need attention. Let's organize them by priority and type.
id: context-text

- list:
type: ul
items:
- Review Dependencies:
button:
text: Review Nokogiri Update (#316)
type: secondary
- Calendar Integration:
button:
text: Review Calendar CLI PR (#315)
type: primary
- Coaching Features:
button:
text: Review Coaching Chat PR (#311)
type: primary

- form:
id: task-input-form
components:
- title:
content: Add New Task
- input:
type: text
placeholder: What else needs to be done?
id: new-task
required: true
- textarea:
placeholder: Add any important context or notes
rows: 3
id: task-notes
- checkbox:
label: High Priority
id: priority-flag
- button:
text: Add Task
type: success

- text:
content: Would you like me to help you analyze any of these items in detail?
id: help-offer
50 changes: 50 additions & 0 deletions examples/pages/trick-or-treat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
components:
- title:
content: "🎃 Trick-or-Treat Checklist"
id: checklist-title

- text:
content: "Make sure you're prepared for a night of spooky fun! Check off these essential items before heading out."
id: checklist-description

- form:
id: checklist-form
components:
- title:
content: "Essential Items:"
- checkbox:
label: "🎭 Costume (properly fitted for maximum candy acquisition)"
id: costume-check
- checkbox:
label: "🎒 Candy collection bag/bucket (reinforced for heavy loads)"
id: bag-check
- checkbox:
label: "🔦 Flashlight (to spot friendly ghosts)"
id: flashlight-check
- checkbox:
label: "📱 Phone (for emergency ghost selfies)"
id: phone-check
- checkbox:
label: "🧥 Warm layer (ghosts make the air chilly)"
id: warmth-check

- title:
content: "Safety Measures:"
- checkbox:
label: "👥 Buddy system arranged"
id: buddy-check
- checkbox:
label: "🗺️ Route planned (avoiding known werewolf territories)"
id: route-check
- checkbox:
label: "⌚ Watch/time-keeping device (to return before turning into a pumpkin)"
id: time-check
- checkbox:
label: "🔋 All devices charged (for documenting paranormal activities)"
id: battery-check

- button:
text: "Ready to Haunt!"
type: primary
onclick: "alert('Happy haunting! Remember: the ghosts are more scared of you than you are of them... maybe.')"
id: ready-btn
36 changes: 36 additions & 0 deletions examples/pages/welcome.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
components:
- title:
content: "🎃 Welcome to Spookyville! 👻"
id: main-title

- text:
content: "The night is dark, the moon is bright, welcome to our Halloween site! Explore our haunted pages and discover the spooky delights that await..."
id: welcome-text

- list:
type: ul
items:
- title:
content: "🏚️ Haunted House Tour"
- text:
content: "Book your tour through our haunted mansion, if you dare..."
- button:
text: "Book Tour"
type: danger
onclick: "alert('Beware! The ghosts await...')"
- title:
content: "🎭 Costume Contest"
- text:
content: "Vote for the spookiest costume of the year!"
- button:
text: "Vote Now"
type: primary
onclick: "alert('Choose wisely...')"
- title:
content: "🎪 Halloween Party"
- text:
content: "Join us for a night of frightful fun!"
- button:
text: "RSVP"
type: success
onclick: "alert('We will be waiting for you...')"
Loading

0 comments on commit da5d146

Please sign in to comment.