Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The server supports sending notifications to clients when lists of tools, prompt

The server provides three notification methods:
- `notify_tools_list_changed()` - Send a notification when the tools list changes
- `notify_prompts_list_changed()` - Send a notification when the prompts list changes
- `notify_prompts_list_changed()` - Send a notification when the prompts list changes
- `notify_resources_list_changed()` - Send a notification when the resources list changes

#### Notification Format
Expand Down Expand Up @@ -119,7 +119,6 @@ end
If you want to build a local command-line application, you can use the stdio transport:

```ruby
#!/usr/bin/env ruby
require "mcp"
require "mcp/server/transports/stdio_transport"

Expand Down Expand Up @@ -157,7 +156,7 @@ transport.open
You can run this script and then type in requests to the server at the command line.

```bash
$ ./examples/stdio_server.rb
$ ruby examples/stdio_server.rb
{"jsonrpc":"2.0","id":"1","method":"ping"}
{"jsonrpc":"2.0","id":"2","method":"tools/list"}
```
Expand Down
18 changes: 9 additions & 9 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A simple server that communicates over standard input/output. This is useful for

**Usage:**
```bash
ruby examples/stdio_server.rb
$ ruby examples/stdio_server.rb
Comment on lines 11 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're using prefixes before running commands, we should use the console language for the codeblock

```console
$ ruby examples/stdio_server.rb

(Same for the other code blocks)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think so too. That said, this repository uses bash, so a separate PR will likely change it to console.

{"jsonrpc":"2.0","id":0,"method":"tools/list"}
```

Expand All @@ -25,11 +25,11 @@ A standalone HTTP server built with Rack that implements the MCP Streamable HTTP

**Usage:**
```bash
ruby examples/http_server.rb
$ ruby examples/http_server.rb
```

The server will start on `http://localhost:9292` and provide:
- **Tools**:
- **Tools**:
- `ExampleTool` - adds two numbers
- `echo` - echoes back messages
- **Prompts**: `ExamplePrompt` - echoes back arguments as a prompt
Expand All @@ -41,12 +41,12 @@ A client that demonstrates how to interact with the HTTP server using all MCP pr
**Usage:**
1. Start the HTTP server in one terminal:
```bash
ruby examples/http_server.rb
$ ruby examples/http_server.rb
```

2. Run the client example in another terminal:
```bash
ruby examples/http_client.rb
$ ruby examples/http_client.rb
```

The client will demonstrate:
Expand All @@ -71,7 +71,7 @@ A specialized HTTP server designed to test and demonstrate Server-Sent Events (S

**Usage:**
```bash
ruby examples/streamable_http_server.rb
$ ruby examples/streamable_http_server.rb
```

The server will start on `http://localhost:9393` and provide detailed instructions for testing SSE functionality.
Expand All @@ -88,12 +88,12 @@ An interactive client that connects to the SSE stream and provides a menu-driven
**Usage:**
1. Start the SSE test server in one terminal:
```bash
ruby examples/streamable_http_server.rb
$ ruby examples/streamable_http_server.rb
```

2. Run the SSE test client in another terminal:
```bash
ruby examples/streamable_http_client.rb
$ ruby examples/streamable_http_client.rb
```

The client will:
Expand Down Expand Up @@ -133,7 +133,7 @@ curl -X POST http://localhost:9393 \

The HTTP server implements the MCP Streamable HTTP transport protocol:

1. **Initialize Session**:
1. **Initialize Session**:
- Client sends POST request with `initialize` method
- Server responds with session ID in `Mcp-Session-Id` header

Expand Down
1 change: 0 additions & 1 deletion examples/http_client.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "net/http"
Expand Down
1 change: 0 additions & 1 deletion examples/http_server.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
Expand Down
1 change: 0 additions & 1 deletion examples/stdio_server.rb
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
Expand Down
1 change: 0 additions & 1 deletion examples/streamable_http_client.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "net/http"
Expand Down
1 change: 0 additions & 1 deletion examples/streamable_http_server.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
Expand Down