mail_mcp 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e06ea684243f2124133903c64239d181b093c87e895f2716bb257d714f05aff3
4
- data.tar.gz: b986c39811d9e1f3879b082796eba93ebb2a4a781c90309b2e1bb6e576875282
3
+ metadata.gz: 2f0b9d571be35c953b87ae56a9fdf4b0fb06d025daf74679fe34f3c17d956bf2
4
+ data.tar.gz: ab679102a9001f05852218155c57fef7ddafa7ac5259cb5bd884b54ddb0ee20e
5
5
  SHA512:
6
- metadata.gz: 2ed02d68bf67c31a985199471ced7c4e9393485be999f6ed8fab254c19d55918cdc8e9d7aa3b7e35f631d0244ad3c5a38d22f21142681a613bc73aaa08b8e71d
7
- data.tar.gz: 550a20589e633d0b29c7e1cf35ea0b48e2393452c2fbc07b2b51a6ae42805c2155952c8839aee0517bd054dea975dfb024468d0a759e06c3eb7961e9fa2ce396
6
+ metadata.gz: 79c646575acf2f6e5dade303538b05622316152951fa66d3f265422ae409a12e0dbd0b42038a67deae8b30e5c4027849520bbd599b5d95714320dcf52a249ce7
7
+ data.tar.gz: 35c9e8c6ae7e4d791838a3ccf61cbfb89bfb14052514365c4ea320d8ee8e9747b5d26a7e3d03ba2284fac3184db2123bd53c28d40be2dff5fa46ab430ca7814b
data/lib/mail_mcp/app.rb CHANGED
@@ -64,6 +64,7 @@ module MailMCP
64
64
  token_endpoint: "#{base_url}/oauth/token",
65
65
  response_types_supported: ["code"],
66
66
  grant_types_supported: ["authorization_code"],
67
+ token_endpoint_auth_methods_supported: %w[client_secret_basic client_secret_post],
67
68
  code_challenge_methods_supported: ["S256"]
68
69
  })
69
70
  end
@@ -106,9 +107,8 @@ module MailMCP
106
107
  post "/oauth/token" do
107
108
  content_type :json
108
109
 
109
- grant_type = params[:grant_type]
110
- client_id = params[:client_id]
111
- client_secret = params[:client_secret]
110
+ grant_type = params[:grant_type]
111
+ client_id, client_secret = client_credentials
112
112
 
113
113
  client_config = begin
114
114
  JwtService.decode_client_id(client_id.to_s)
@@ -146,6 +146,16 @@ module MailMCP
146
146
 
147
147
  private
148
148
 
149
+ # RFC 6749 section 2.3.1: clients may authenticate with HTTP Basic, whose
150
+ # user and password are the form-encoded client_id and client_secret, or
151
+ # with both in the request body.
152
+ def client_credentials
153
+ auth = Rack::Auth::Basic::Request.new(request.env)
154
+ return [params[:client_id], params[:client_secret]] unless auth.provided? && auth.basic?
155
+
156
+ auth.credentials.map { |part| URI.decode_www_form_component(part) }
157
+ end
158
+
149
159
  def resolve_mcp_context
150
160
  auth = request.env["HTTP_AUTHORIZATION"]
151
161
  return [nil, unauthorized_response("missing bearer token")] unless auth&.start_with?("Bearer ")
@@ -1,3 +1,3 @@
1
1
  module MailMCP
2
- VERSION = "1.0.3".freeze
2
+ VERSION = "1.0.4".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mail_mcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgars Beigarts