Skip to content

Add basic http client support#28

Merged
koic merged 1 commit into
modelcontextprotocol:mainfrom
jcat4:add-basic-http-client-support
Sep 9, 2025
Merged

Add basic http client support#28
koic merged 1 commit into
modelcontextprotocol:mainfrom
jcat4:add-basic-http-client-support

Conversation

@jcat4

@jcat4 jcat4 commented May 28, 2025

Copy link
Copy Markdown
Contributor

Motivation and Context

Closes #3

Follow-up to #27

This adds the ability to build MCP clients with the ruby sdk. I've started with just a basic HTTP transport layer. We can add other things (i.e. streamable HTTP) later.

Per this comment, we've decided to go with a pluggable approach where:

  • You create an instance of the transport layer you want to use
  • A Client is initialized with that transport layer
  • The client receives messages (i.e. tools or call_tool)
  • The client builds a JSON-RPC request object
  • The JSON-RPC request object is passed to the transport layer's send_request method to communicate with the server
  • The transport returns a JSON-RPC response object
  • The client then parses the response and does whatever it needs to with it

For simplicity, I'm just allowing custom headers to specify auth. I didn't want to build an abstraction around different auth types prematurely. I've made authentication the responsibility of the transport layer, since that's what is responsible for communication with the server.

How Has This Been Tested?

The local gem build has been tested in 2 different internal repositories and is working as expected so far.

Breaking Changes

Just the stuff from #27

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

client implementation

6 participants