## Motivation and Context The Installation page names faraday as the example of an optional dependency but leaves out event_stream_parser, which the HTTP client transport needs as soon as a server answers with SSE. The Transports page documents both gems, so a reader who starts from Installation learns about the second one only when a streaming response fails to parse. The Transports page also marks event_stream_parser as "optional, required only for SSE responses", which reads as a corner case. Whether a response is JSON or SSE is the server's choice, made for each response, a client must accept both, and this SDK's own server picks SSE by default and always on the modern lifecycle, so a client written for arbitrary servers needs both gems. Both pages now say so, and the Transports page spells out the one setup that can leave the gem out: a server known to answer with JSON alone, such as this SDK's server in JSON response mode serving handshake-lifecycle clients, and no listening stream. The Installation page shows the faraday-only Gemfile first and then the one that adds event_stream_parser, so both cases are visible at a glance. ## How Has This Been Tested? Documentation only; the Gemfile snippets on both pages match. ## Breaking Changes None.
53 lines
1.1 KiB
Markdown
53 lines
1.1 KiB
Markdown
---
|
|
layout: default
|
|
title: Installation
|
|
nav_order: 2
|
|
permalink: /installation/
|
|
redirect_from:
|
|
- /installation.html
|
|
---
|
|
|
|
# Installation
|
|
|
|
Install the gem and any optional dependencies for the features you use.
|
|
|
|
## Requirements
|
|
|
|
Ruby 2.7.0 or later.
|
|
|
|
## Installing the Gem
|
|
|
|
Add this line to your application's Gemfile:
|
|
|
|
```ruby
|
|
gem "mcp"
|
|
```
|
|
|
|
And then execute:
|
|
|
|
```console
|
|
$ bundle install
|
|
```
|
|
|
|
Or install it yourself as:
|
|
|
|
```console
|
|
$ gem install mcp
|
|
```
|
|
|
|
You may need to add additional dependencies depending on which features you wish to access. For example, the HTTP client transport requires the `faraday` gem:
|
|
|
|
```ruby
|
|
gem "faraday", ">= 2.0"
|
|
```
|
|
|
|
Reading SSE (`text/event-stream`) responses needs `event_stream_parser` as well.
|
|
Whether a response is JSON or SSE is the server's choice, made for each response, and this SDK's own server picks SSE by default,
|
|
so a client written for arbitrary servers needs both gems:
|
|
|
|
```ruby
|
|
gem "faraday", ">= 2.0"
|
|
gem "event_stream_parser", ">= 1.0"
|
|
```
|
|
|
|
The [Transports](/client/transports/#http-transport-layer) page describes the one setup where `faraday` alone is enough.
|