Remove shebang from example files

Since the example files are not executable binaries, this PR removes the shebangs.

This ensures that all examples are consistently executed via `ruby` command.
It also removes the executable permission from `examples/stdio_server.rb` using `chmod 444`,
bringing it in line with the other example files.
This commit is contained in:
Koichi ITO 2025-06-19 01:17:46 +09:00
commit 100d1a1ab3
7 changed files with 11 additions and 17 deletions

View file

@ -119,7 +119,6 @@ end
If you want to build a local command-line application, you can use the stdio transport: If you want to build a local command-line application, you can use the stdio transport:
```ruby ```ruby
#!/usr/bin/env ruby
require "mcp" require "mcp"
require "mcp/server/transports/stdio_transport" require "mcp/server/transports/stdio_transport"
@ -157,7 +156,7 @@ transport.open
You can run this script and then type in requests to the server at the command line. You can run this script and then type in requests to the server at the command line.
```bash ```bash
$ ./examples/stdio_server.rb $ ruby examples/stdio_server.rb
{"jsonrpc":"2.0","id":"1","method":"ping"} {"jsonrpc":"2.0","id":"1","method":"ping"}
{"jsonrpc":"2.0","id":"2","method":"tools/list"} {"jsonrpc":"2.0","id":"2","method":"tools/list"}
``` ```

View file

@ -9,7 +9,7 @@ A simple server that communicates over standard input/output. This is useful for
**Usage:** **Usage:**
```bash ```bash
ruby examples/stdio_server.rb $ ruby examples/stdio_server.rb
{"jsonrpc":"2.0","id":0,"method":"tools/list"} {"jsonrpc":"2.0","id":0,"method":"tools/list"}
``` ```
@ -25,7 +25,7 @@ A standalone HTTP server built with Rack that implements the MCP Streamable HTTP
**Usage:** **Usage:**
```bash ```bash
ruby examples/http_server.rb $ ruby examples/http_server.rb
``` ```
The server will start on `http://localhost:9292` and provide: The server will start on `http://localhost:9292` and provide:
@ -41,12 +41,12 @@ A client that demonstrates how to interact with the HTTP server using all MCP pr
**Usage:** **Usage:**
1. Start the HTTP server in one terminal: 1. Start the HTTP server in one terminal:
```bash ```bash
ruby examples/http_server.rb $ ruby examples/http_server.rb
``` ```
2. Run the client example in another terminal: 2. Run the client example in another terminal:
```bash ```bash
ruby examples/http_client.rb $ ruby examples/http_client.rb
``` ```
The client will demonstrate: The client will demonstrate:
@ -71,7 +71,7 @@ A specialized HTTP server designed to test and demonstrate Server-Sent Events (S
**Usage:** **Usage:**
```bash ```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. The server will start on `http://localhost:9393` and provide detailed instructions for testing SSE functionality.
@ -88,12 +88,12 @@ An interactive client that connects to the SSE stream and provides a menu-driven
**Usage:** **Usage:**
1. Start the SSE test server in one terminal: 1. Start the SSE test server in one terminal:
```bash ```bash
ruby examples/streamable_http_server.rb $ ruby examples/streamable_http_server.rb
``` ```
2. Run the SSE test client in another terminal: 2. Run the SSE test client in another terminal:
```bash ```bash
ruby examples/streamable_http_client.rb $ ruby examples/streamable_http_client.rb
``` ```
The client will: The client will:

View file

@ -1,4 +1,3 @@
#!/usr/bin/env ruby
# frozen_string_literal: true # frozen_string_literal: true
require "net/http" require "net/http"

View file

@ -1,4 +1,3 @@
#!/usr/bin/env ruby
# frozen_string_literal: true # frozen_string_literal: true
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__)) $LOAD_PATH.unshift(File.expand_path("../lib", __dir__))

1
examples/stdio_server.rb Executable file → Normal file
View file

@ -1,4 +1,3 @@
#!/usr/bin/env ruby
# frozen_string_literal: true # frozen_string_literal: true
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__)) $LOAD_PATH.unshift(File.expand_path("../lib", __dir__))

View file

@ -1,4 +1,3 @@
#!/usr/bin/env ruby
# frozen_string_literal: true # frozen_string_literal: true
require "net/http" require "net/http"

View file

@ -1,4 +1,3 @@
#!/usr/bin/env ruby
# frozen_string_literal: true # frozen_string_literal: true
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__)) $LOAD_PATH.unshift(File.expand_path("../lib", __dir__))