mail_mcp 1.0.2 → 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 +4 -4
- data/lib/mail_mcp/app.rb +25 -4
- data/lib/mail_mcp/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2f0b9d571be35c953b87ae56a9fdf4b0fb06d025daf74679fe34f3c17d956bf2
|
|
4
|
+
data.tar.gz: ab679102a9001f05852218155c57fef7ddafa7ac5259cb5bd884b54ddb0ee20e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 79c646575acf2f6e5dade303538b05622316152951fa66d3f265422ae409a12e0dbd0b42038a67deae8b30e5c4027849520bbd599b5d95714320dcf52a249ce7
|
|
7
|
+
data.tar.gz: 35c9e8c6ae7e4d791838a3ccf61cbfb89bfb14052514365c4ea320d8ee8e9747b5d26a7e3d03ba2284fac3184db2123bd53c28d40be2dff5fa46ab430ca7814b
|
data/lib/mail_mcp/app.rb
CHANGED
|
@@ -37,7 +37,11 @@ module MailMCP
|
|
|
37
37
|
tools: MCP_TOOLS,
|
|
38
38
|
server_context: server_context
|
|
39
39
|
)
|
|
40
|
-
transport = MCP::Server::Transports::StreamableHTTPTransport.new(
|
|
40
|
+
transport = MCP::Server::Transports::StreamableHTTPTransport.new(
|
|
41
|
+
mcp_server,
|
|
42
|
+
stateless: true,
|
|
43
|
+
allowed_hosts: allowed_mcp_hosts
|
|
44
|
+
)
|
|
41
45
|
status_code, resp_headers, body = transport.call(env)
|
|
42
46
|
halt status_code, resp_headers, body
|
|
43
47
|
end
|
|
@@ -60,6 +64,7 @@ module MailMCP
|
|
|
60
64
|
token_endpoint: "#{base_url}/oauth/token",
|
|
61
65
|
response_types_supported: ["code"],
|
|
62
66
|
grant_types_supported: ["authorization_code"],
|
|
67
|
+
token_endpoint_auth_methods_supported: %w[client_secret_basic client_secret_post],
|
|
63
68
|
code_challenge_methods_supported: ["S256"]
|
|
64
69
|
})
|
|
65
70
|
end
|
|
@@ -102,9 +107,8 @@ module MailMCP
|
|
|
102
107
|
post "/oauth/token" do
|
|
103
108
|
content_type :json
|
|
104
109
|
|
|
105
|
-
grant_type
|
|
106
|
-
client_id
|
|
107
|
-
client_secret = params[:client_secret]
|
|
110
|
+
grant_type = params[:grant_type]
|
|
111
|
+
client_id, client_secret = client_credentials
|
|
108
112
|
|
|
109
113
|
client_config = begin
|
|
110
114
|
JwtService.decode_client_id(client_id.to_s)
|
|
@@ -142,6 +146,16 @@ module MailMCP
|
|
|
142
146
|
|
|
143
147
|
private
|
|
144
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
|
+
|
|
145
159
|
def resolve_mcp_context
|
|
146
160
|
auth = request.env["HTTP_AUTHORIZATION"]
|
|
147
161
|
return [nil, unauthorized_response("missing bearer token")] unless auth&.start_with?("Bearer ")
|
|
@@ -220,6 +234,13 @@ module MailMCP
|
|
|
220
234
|
ENV.fetch("BASE_URL")
|
|
221
235
|
end
|
|
222
236
|
|
|
237
|
+
# The MCP transport's DNS-rebinding protection only accepts loopback `Host` values
|
|
238
|
+
# out of the box. This server is reached at its public hostname, so allow-list it —
|
|
239
|
+
# a bare host name matches any port.
|
|
240
|
+
def allowed_mcp_hosts
|
|
241
|
+
[URI.parse(base_url).host]
|
|
242
|
+
end
|
|
243
|
+
|
|
223
244
|
def decode_client_id!(client_id)
|
|
224
245
|
JwtService.decode_client_id(client_id.to_s)
|
|
225
246
|
rescue JwtService::Error => e
|
data/lib/mail_mcp/version.rb
CHANGED
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.
|
|
4
|
+
version: 1.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Edgars Beigarts
|
|
@@ -71,14 +71,14 @@ dependencies:
|
|
|
71
71
|
requirements:
|
|
72
72
|
- - "~>"
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
version:
|
|
74
|
+
version: 0.25.0
|
|
75
75
|
type: :runtime
|
|
76
76
|
prerelease: false
|
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
|
79
79
|
- - "~>"
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
|
-
version:
|
|
81
|
+
version: 0.25.0
|
|
82
82
|
- !ruby/object:Gem::Dependency
|
|
83
83
|
name: puma
|
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|