actionmcp 0.111.1 → 0.200.0

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.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -18
  3. data/Rakefile +3 -0
  4. data/app/controllers/action_mcp/application_controller.rb +166 -109
  5. data/app/controllers/action_mcp/mcp_app_renderer.rb +1 -0
  6. data/app/helpers/action_mcp/apps_helper.rb +48 -0
  7. data/app/jobs/action_mcp/tool_execution_job.rb +67 -35
  8. data/app/models/action_mcp/session/message.rb +8 -3
  9. data/app/models/action_mcp/session/task.rb +15 -5
  10. data/app/models/action_mcp/session.rb +93 -19
  11. data/config/routes.rb +1 -1
  12. data/lib/action_mcp/apps/javascript/ext_apps.LICENSE +216 -0
  13. data/lib/action_mcp/apps/javascript/ext_apps.js +78 -0
  14. data/lib/action_mcp/apps/view_manifest.rb +170 -0
  15. data/lib/action_mcp/apps.rb +17 -2
  16. data/lib/action_mcp/configuration.rb +14 -30
  17. data/lib/action_mcp/content/audio.rb +4 -1
  18. data/lib/action_mcp/content/base.rb +3 -1
  19. data/lib/action_mcp/content/image.rb +4 -1
  20. data/lib/action_mcp/content/resource.rb +15 -14
  21. data/lib/action_mcp/content/resource_link.rb +15 -5
  22. data/lib/action_mcp/content/text.rb +2 -1
  23. data/lib/action_mcp/content/validation.rb +253 -0
  24. data/lib/action_mcp/content.rb +3 -1
  25. data/lib/action_mcp/dev/runner.rb +203 -0
  26. data/lib/action_mcp/engine.rb +24 -2
  27. data/lib/action_mcp/json_rpc_handler_base.rb +7 -12
  28. data/lib/action_mcp/logging/logger.rb +16 -11
  29. data/lib/action_mcp/logging.rb +34 -1
  30. data/lib/action_mcp/middleware/origin_validation.rb +9 -13
  31. data/lib/action_mcp/output_schema_builder.rb +2 -0
  32. data/lib/action_mcp/prompt_response.rb +12 -2
  33. data/lib/action_mcp/protocol_validator.rb +513 -0
  34. data/lib/action_mcp/renderable.rb +4 -4
  35. data/lib/action_mcp/resource.rb +15 -11
  36. data/lib/action_mcp/resource_template.rb +105 -90
  37. data/lib/action_mcp/resource_templates_registry.rb +31 -97
  38. data/lib/action_mcp/schema_validator.rb +43 -0
  39. data/lib/action_mcp/server/base_session.rb +134 -28
  40. data/lib/action_mcp/server/base_session_store.rb +1 -1
  41. data/lib/action_mcp/server/capabilities.rb +10 -30
  42. data/lib/action_mcp/server/client_notifications.rb +63 -0
  43. data/lib/action_mcp/server/completions.rb +68 -0
  44. data/lib/action_mcp/server/elicitation.rb +47 -25
  45. data/lib/action_mcp/server/elicitation_request.rb +136 -51
  46. data/lib/action_mcp/server/handlers/logging_handler.rb +7 -5
  47. data/lib/action_mcp/server/handlers/prompt_handler.rb +12 -1
  48. data/lib/action_mcp/server/handlers/resource_handler.rb +41 -7
  49. data/lib/action_mcp/server/handlers/task_handler.rb +26 -0
  50. data/lib/action_mcp/server/handlers/tool_handler.rb +8 -0
  51. data/lib/action_mcp/server/json_rpc_handler.rb +5 -21
  52. data/lib/action_mcp/server/messaging_service.rb +3 -1
  53. data/lib/action_mcp/server/prompts.rb +5 -3
  54. data/lib/action_mcp/server/resources.rb +35 -2
  55. data/lib/action_mcp/server/response_collector.rb +5 -1
  56. data/lib/action_mcp/server/roots.rb +15 -2
  57. data/lib/action_mcp/server/sampling.rb +36 -1
  58. data/lib/action_mcp/server/sampling_request.rb +317 -55
  59. data/lib/action_mcp/server/tasks.rb +27 -45
  60. data/lib/action_mcp/server/tool_result.rb +27 -0
  61. data/lib/action_mcp/server/tools.rb +12 -10
  62. data/lib/action_mcp/server/transport_handler.rb +3 -0
  63. data/lib/action_mcp/server/url_elicitation_request.rb +13 -0
  64. data/lib/action_mcp/tool.rb +133 -199
  65. data/lib/action_mcp/tool_response.rb +35 -4
  66. data/lib/action_mcp/tools_registry.rb +1 -1
  67. data/lib/action_mcp/version.rb +1 -1
  68. data/lib/action_mcp.rb +2 -5
  69. data/lib/generators/action_mcp/identifier/identifier_generator.rb +1 -1
  70. data/lib/generators/action_mcp/identifier/templates/identifier.rb.erb +1 -1
  71. data/lib/generators/action_mcp/install/templates/bin/mcp +16 -4
  72. data/lib/generators/action_mcp/install/templates/mcp/config.ru.tt +2 -2
  73. data/lib/generators/action_mcp/install/templates/mcp.yml +4 -0
  74. data/lib/generators/action_mcp/resource_template/resource_template_generator.rb +18 -1
  75. data/lib/generators/action_mcp/resource_template/templates/resource_template_ui.rb.erb +27 -0
  76. data/lib/generators/action_mcp/tool/templates/tool.rb.erb +6 -0
  77. data/lib/generators/action_mcp/tool/tool_generator.rb +2 -0
  78. data/lib/generators/action_mcp/view/templates/resource_template.rb.erb +16 -0
  79. data/lib/generators/action_mcp/view/templates/view.html.erb +27 -0
  80. data/lib/generators/action_mcp/view/view_generator.rb +57 -0
  81. data/lib/tasks/action_mcp_apps.rake +17 -0
  82. data/lib/tasks/action_mcp_tasks.rake +135 -74
  83. metadata +47 -17
@@ -45,16 +45,20 @@ module ActionMCP
45
45
  return nil
46
46
  end
47
47
 
48
- task.record_step!(:job_started)
48
+ task.with_lock do
49
+ task.record_step!(:job_started) unless task.terminal?
50
+ end
49
51
  task
50
52
  end
51
53
 
52
54
  def validate_session(task)
53
55
  session = task.session
54
56
  unless session
55
- task.update(status_message: "Session not found")
56
- task.result_payload = { code: -32_603, message: "Session not found" }
57
- task.mark_failed!
57
+ fail_task(
58
+ task,
59
+ status_message: "Session not found",
60
+ result_payload: { code: -32_603, message: "Session not found" }
61
+ )
58
62
  return nil
59
63
  end
60
64
 
@@ -64,17 +68,19 @@ module ActionMCP
64
68
  def prepare_tool(session, tool_name, arguments, task)
65
69
  tool_class = session.registered_tools.find { |t| t.tool_name == tool_name }
66
70
  unless tool_class
67
- @task.update(status_message: "Tool '#{tool_name}' not found")
68
- @task.result_payload = {
69
- code: -32_601,
70
- message: "Tool '#{tool_name}' not found"
71
- }
72
- @task.mark_failed!
71
+ fail_task(
72
+ task,
73
+ status_message: "Tool '#{tool_name}' not found",
74
+ result_payload: {
75
+ code: -32_601,
76
+ message: "Tool '#{tool_name}' not found"
77
+ }
78
+ )
73
79
  return nil
74
80
  end
75
81
 
76
82
  # Create and configure tool instance
77
- tool = tool_class.new(arguments)
83
+ tool = tool_class.from_wire(arguments)
78
84
  tool.with_context({
79
85
  session: session,
80
86
  request: {
@@ -85,6 +91,25 @@ module ActionMCP
85
91
  tool.instance_variable_set(:@_task, task)
86
92
 
87
93
  tool
94
+ rescue ArgumentError, ActiveModel::UnknownAttributeError => e
95
+ fail_task(
96
+ task,
97
+ status_message: "Invalid tool input",
98
+ result_payload: Server::ToolResult.execution_error(e.message).to_h
99
+ )
100
+ nil
101
+ end
102
+
103
+ def fail_task(task, status_message:, result_payload:)
104
+ task.with_lock do
105
+ return false if task.terminal?
106
+
107
+ task.status_message = status_message
108
+ task.result_payload = result_payload
109
+ task.mark_failed!
110
+ end
111
+
112
+ true
88
113
  end
89
114
 
90
115
  def execute_with_reloader(tool, session)
@@ -104,17 +129,21 @@ module ActionMCP
104
129
  end
105
130
 
106
131
  def update_task_result(task, result)
107
- return if task.terminal? # Guard against double-complete
108
-
132
+ result = Server::ToolResult.normalize(result)
109
133
  payload = result.to_h
110
- if result.is_error || payload[:isError] || payload["isError"]
111
- task.result_payload = payload
112
- task.status_message = result.respond_to?(:error_message) ? result.error_message : "Tool returned error"
113
- task.mark_failed!
114
- else
115
- task.result_payload = payload
116
- task.record_step!(:completed)
117
- task.complete!
134
+
135
+ task.with_lock do
136
+ return if task.terminal?
137
+
138
+ if result.is_error || payload[:isError] || payload["isError"]
139
+ task.result_payload = payload
140
+ task.status_message = result.respond_to?(:error_message) ? result.error_message : "Tool returned error"
141
+ task.mark_failed!
142
+ else
143
+ task.result_payload = payload
144
+ task.record_step!(:completed)
145
+ task.complete!
146
+ end
118
147
  end
119
148
  end
120
149
 
@@ -122,24 +151,27 @@ module ActionMCP
122
151
  task_id = job.arguments.first
123
152
  task = Session::Task.find_by(id: task_id)
124
153
  return unless task&.persisted?
125
- return if task.terminal?
126
154
 
127
155
  Rails.logger.error "[ToolExecutionJob] Discarding job for task #{task_id}: #{error.class} - #{error.message}"
128
156
  Rails.logger.error error.backtrace&.first(10)&.join("\n")
129
157
 
130
- task.update(
131
- status_message: "Job failed: #{error.message}",
132
- result_payload: {
133
- code: -32_603,
134
- message: "Job failed: #{error.message}"
135
- },
136
- continuation_state: {
137
- step: :failed,
138
- error: { class: error.class.name, message: error.message },
139
- timestamp: Time.current.iso8601
140
- }
141
- )
142
- task.mark_failed!
158
+ task.with_lock do
159
+ return if task.terminal?
160
+
161
+ task.update!(
162
+ status_message: "Job failed: #{error.message}",
163
+ result_payload: {
164
+ code: -32_603,
165
+ message: "Job failed: #{error.message}"
166
+ },
167
+ continuation_state: {
168
+ step: :failed,
169
+ error: { class: error.class.name, message: error.message },
170
+ timestamp: Time.current.iso8601
171
+ }
172
+ )
173
+ task.mark_failed!
174
+ end
143
175
  end
144
176
  end
145
177
  end
@@ -142,10 +142,11 @@ module ActionMCP
142
142
  def acknowledge_request
143
143
  return unless jsonrpc_id.present?
144
144
 
145
- request_message = session.messages.find_by(
145
+ request_message = session.messages.where(
146
146
  jsonrpc_id: jsonrpc_id,
147
- message_type: "request"
148
- )
147
+ message_type: "request",
148
+ direction: opposite_direction
149
+ ).order(created_at: :desc).find { |message| message.data["id"] == data["id"] }
149
150
 
150
151
  return unless request_message
151
152
 
@@ -157,6 +158,10 @@ module ActionMCP
157
158
 
158
159
  save! if changed?
159
160
  end
161
+
162
+ def opposite_direction
163
+ direction == "server" ? "client" : "server"
164
+ end
160
165
  end
161
166
  end
162
167
  end
@@ -142,7 +142,7 @@ module ActionMCP
142
142
  end
143
143
 
144
144
  def result_ready?
145
- terminal? || input_required?
145
+ terminal?
146
146
  end
147
147
 
148
148
  # Check if task is in a non-terminal state
@@ -274,16 +274,26 @@ module ActionMCP
274
274
  # @param prompt [String] The prompt/question for the user
275
275
  # @param context [Hash] Additional context about the input request
276
276
  def await_input!(prompt:, context: {})
277
- record_step!(:awaiting_input, data: { prompt: prompt, context: context })
278
- require_input!
277
+ with_lock do
278
+ return false if terminal?
279
+
280
+ record_step!(:awaiting_input, data: { prompt: prompt, context: context })
281
+ require_input!
282
+ end
279
283
  end
280
284
 
281
285
  # Resume task from input_required state and re-enqueue job
282
286
  # @return [void]
283
287
  def resume_from_continuation!
284
- return unless input_required?
288
+ resumed = false
289
+ with_lock do
290
+ next unless input_required?
291
+
292
+ resume!
293
+ resumed = true
294
+ end
295
+ return unless resumed
285
296
 
286
- resume!
287
297
  # Re-enqueue the job to continue execution
288
298
  ActionMCP::ToolExecutionJob.perform_later(id, request_name, request_params, {})
289
299
  end
@@ -43,7 +43,7 @@ module ActionMCP
43
43
  end
44
44
 
45
45
  include MCPConsoleHelpers
46
- attribute :id, :string, default: -> { SecureRandom.hex(6) }
46
+ attribute :id, :string, default: -> { SecureRandom.hex(16) }
47
47
  has_many :messages,
48
48
  class_name: "ActionMCP::Session::Message",
49
49
  foreign_key: "session_id",
@@ -98,6 +98,46 @@ module ActionMCP
98
98
  messages.create!(data: data, direction: role)
99
99
  end
100
100
 
101
+ # Marks an in-flight request received from the peer as cancelled. JSON-RPC
102
+ # IDs are scoped by direction, so an outbound request with the same ID must
103
+ # never be selected here.
104
+ def cancel_in_flight_request(request_id)
105
+ return if request_id.nil?
106
+
107
+ request = received_requests_with_id(request_id).find do |message|
108
+ !message.request_acknowledged? && !message.request_cancelled?
109
+ end
110
+ return if request&.rpc_method == JsonRpcHandlerBase::Methods::INITIALIZE
111
+
112
+ request&.tap { |message| message.update!(request_cancelled: true) }
113
+ end
114
+
115
+ # Locates the server-originated client request associated with a progress
116
+ # token. This is intentionally limited to MCP client request methods that
117
+ # ActionMCP can issue.
118
+ def client_request_for_progress(progress_token)
119
+ return if progress_token.nil?
120
+
121
+ issued_client_requests.find do |request|
122
+ request.data.dig("params", "_meta", "progressToken") == progress_token &&
123
+ client_request_accepts_progress?(request)
124
+ end
125
+ end
126
+
127
+ # Locates the task-augmented client request which created +task_id+.
128
+ def client_request_for_task(task_id)
129
+ return unless task_id.is_a?(String) && task_id.present?
130
+
131
+ response = messages.responses.where(direction: role).order(created_at: :desc).find do |message|
132
+ message.data.dig("result", "task", "taskId") == task_id
133
+ end
134
+ return unless response
135
+
136
+ issued_client_requests_with_id(response.data["id"]).find do |request|
137
+ request.data.dig("params", "task").is_a?(Hash)
138
+ end
139
+ end
140
+
101
141
  def set_protocol_version(version)
102
142
  update(protocol_version: version)
103
143
  end
@@ -132,24 +172,17 @@ module ActionMCP
132
172
 
133
173
  def capabilities_for_protocol(capabilities)
134
174
  parsed = parsed_json_attribute(capabilities)
135
- filtered =
136
- if parsed.respond_to?(:deep_dup)
137
- parsed.deep_dup
138
- elsif parsed
139
- parsed.dup
140
- else
141
- {}
142
- end
143
- return filtered if protocol_version == "2025-11-25"
175
+ parsed ? parsed.deep_dup : {}
176
+ end
177
+
178
+ def begin_initialization!
179
+ return false unless status == "pre_initialize" && !initialized?
144
180
 
145
- filtered.delete("tasks")
146
- filtered.delete(:tasks)
147
- filtered
181
+ update(status: "initializing")
148
182
  end
149
183
 
150
184
  def initialize!
151
- # update the session initialized to true
152
- return false if initialized?
185
+ return false unless status == "initializing" && !initialized?
153
186
 
154
187
  self.initialized = true
155
188
  self.status = "initialized"
@@ -170,6 +203,10 @@ module ActionMCP
170
203
  subscriptions.find_by(uri: uri)&.destroy
171
204
  end
172
205
 
206
+ def resource_subscribed?(uri)
207
+ subscriptions.exists?(uri: uri)
208
+ end
209
+
173
210
  def send_progress_notification(progressToken:, progress:, total: nil, message: nil)
174
211
  # Create a transport handler to send the notification
175
212
  handler = ActionMCP::Server::TransportHandler.new(self)
@@ -181,10 +218,6 @@ module ActionMCP
181
218
  )
182
219
  end
183
220
 
184
- def send_progress_notification_legacy(token:, value:, message: nil)
185
- send_progress_notification(progressToken: token, progress: value, message: message)
186
- end
187
-
188
221
  # Registry management methods
189
222
  def register_tool(tool_class_or_name)
190
223
  tool_name = normalize_name(tool_class_or_name, :tool)
@@ -361,6 +394,47 @@ module ActionMCP
361
394
 
362
395
  private
363
396
 
397
+ CLIENT_REQUEST_METHODS = %w[sampling/createMessage elicitation/create].freeze
398
+ TERMINAL_CLIENT_TASK_STATUSES = %w[cancelled completed failed].freeze
399
+
400
+ def received_requests_with_id(request_id)
401
+ messages.requests
402
+ .where(direction: role, jsonrpc_id: request_id.to_s)
403
+ .order(created_at: :desc)
404
+ .select { |message| message.data["id"] == request_id }
405
+ end
406
+
407
+ def issued_client_requests
408
+ messages.requests.where(direction: writer_role).order(created_at: :desc).select do |message|
409
+ CLIENT_REQUEST_METHODS.include?(message.rpc_method)
410
+ end
411
+ end
412
+
413
+ def issued_client_requests_with_id(request_id)
414
+ issued_client_requests.select { |message| message.data["id"] == request_id }
415
+ end
416
+
417
+ def client_request_accepts_progress?(request)
418
+ return true unless request.request_acknowledged?
419
+
420
+ response = messages.responses
421
+ .where(direction: role, jsonrpc_id: request.jsonrpc_id)
422
+ .order(created_at: :desc)
423
+ .find { |message| message.data["id"] == request.data["id"] }
424
+ task = response&.data&.dig("result", "task")
425
+ return false unless task.is_a?(Hash) && task["taskId"].is_a?(String)
426
+
427
+ latest_status = messages.notifications.where(direction: role).order(created_at: :desc).filter_map do |message|
428
+ params = message.data["params"]
429
+ next unless message.data["method"] == JsonRpcHandlerBase::Methods::NOTIFICATIONS_TASKS_STATUS
430
+ next unless params.is_a?(Hash) && params["taskId"] == task["taskId"]
431
+
432
+ params["status"]
433
+ end.first
434
+
435
+ !TERMINAL_CLIENT_TASK_STATUSES.include?(latest_status || task["status"])
436
+ end
437
+
364
438
  # if this session is from a server, the writer is the client
365
439
  def writer_role
366
440
  role == "server" ? "client" : "server"
data/config/routes.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  ActionMCP::Engine.routes.draw do
4
4
  get "#{ActionMCP.configuration.base_path}/up", to: "/rails/health#show", as: :action_mcp_health_check
5
5
 
6
- # MCP 2025-03-26 Spec routes
6
+ # MCP 2025-11-25 Streamable HTTP routes
7
7
  get ActionMCP.configuration.base_path, to: "application#show", as: :mcp_get
8
8
  post ActionMCP.configuration.base_path, to: "application#create", as: :mcp_post
9
9
  delete ActionMCP.configuration.base_path, to: "application#destroy", as: :mcp_delete
@@ -0,0 +1,216 @@
1
+ The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
2
+
3
+ Contributions for which relicensing consent has been obtained are licensed under Apache-2.0. Contributions made by authors who originally licensed their work under the MIT License and who have not yet granted explicit permission to relicense remain licensed under the MIT License.
4
+
5
+ No rights beyond those granted by the applicable original license are conveyed for such contributions.
6
+
7
+ ---
8
+
9
+ Apache License
10
+ Version 2.0, January 2004
11
+ http://www.apache.org/licenses/
12
+
13
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
14
+
15
+ 1. Definitions.
16
+
17
+ "License" shall mean the terms and conditions for use, reproduction,
18
+ and distribution as defined by Sections 1 through 9 of this document.
19
+
20
+ "Licensor" shall mean the copyright owner or entity authorized by
21
+ the copyright owner that is granting the License.
22
+
23
+ "Legal Entity" shall mean the union of the acting entity and all
24
+ other entities that control, are controlled by, or are under common
25
+ control with that entity. For the purposes of this definition,
26
+ "control" means (i) the power, direct or indirect, to cause the
27
+ direction or management of such entity, whether by contract or
28
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
29
+ outstanding shares, or (iii) beneficial ownership of such entity.
30
+
31
+ "You" (or "Your") shall mean an individual or Legal Entity
32
+ exercising permissions granted by this License.
33
+
34
+ "Source" form shall mean the preferred form for making modifications,
35
+ including but not limited to software source code, documentation
36
+ source, and configuration files.
37
+
38
+ "Object" form shall mean any form resulting from mechanical
39
+ transformation or translation of a Source form, including but
40
+ not limited to compiled object code, generated documentation,
41
+ and conversions to other media types.
42
+
43
+ "Work" shall mean the work of authorship, whether in Source or
44
+ Object form, made available under the License, as indicated by a
45
+ copyright notice that is included in or attached to the work
46
+ (an example is provided in the Appendix below).
47
+
48
+ "Derivative Works" shall mean any work, whether in Source or Object
49
+ form, that is based on (or derived from) the Work and for which the
50
+ editorial revisions, annotations, elaborations, or other modifications
51
+ represent, as a whole, an original work of authorship. For the purposes
52
+ of this License, Derivative Works shall not include works that remain
53
+ separable from, or merely link (or bind by name) to the interfaces of,
54
+ the Work and Derivative Works thereof.
55
+
56
+ "Contribution" shall mean any work of authorship, including
57
+ the original version of the Work and any modifications or additions
58
+ to that Work or Derivative Works thereof, that is intentionally
59
+ submitted to the Licensor for inclusion in the Work by the copyright
60
+ owner or by an individual or Legal Entity authorized to submit on behalf
61
+ of the copyright owner. For the purposes of this definition, "submitted"
62
+ means any form of electronic, verbal, or written communication sent
63
+ to the Licensor or its representatives, including but not limited to
64
+ communication on electronic mailing lists, source code control systems,
65
+ and issue tracking systems that are managed by, or on behalf of, the
66
+ Licensor for the purpose of discussing and improving the Work, but
67
+ excluding communication that is conspicuously marked or otherwise
68
+ designated in writing by the copyright owner as "Not a Contribution."
69
+
70
+ "Contributor" shall mean Licensor and any individual or Legal Entity
71
+ on behalf of whom a Contribution has been received by Licensor and
72
+ subsequently incorporated within the Work.
73
+
74
+ 2. Grant of Copyright License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ copyright license to reproduce, prepare Derivative Works of,
78
+ publicly display, publicly perform, sublicense, and distribute the
79
+ Work and such Derivative Works in Source or Object form.
80
+
81
+ 3. Grant of Patent License. Subject to the terms and conditions of
82
+ this License, each Contributor hereby grants to You a perpetual,
83
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
84
+ (except as stated in this section) patent license to make, have made,
85
+ use, offer to sell, sell, import, and otherwise transfer the Work,
86
+ where such license applies only to those patent claims licensable
87
+ by such Contributor that are necessarily infringed by their
88
+ Contribution(s) alone or by combination of their Contribution(s)
89
+ with the Work to which such Contribution(s) was submitted. If You
90
+ institute patent litigation against any entity (including a
91
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
92
+ or a Contribution incorporated within the Work constitutes direct
93
+ or contributory patent infringement, then any patent licenses
94
+ granted to You under this License for that Work shall terminate
95
+ as of the date such litigation is filed.
96
+
97
+ 4. Redistribution. You may reproduce and distribute copies of the
98
+ Work or Derivative Works thereof in any medium, with or without
99
+ modifications, and in Source or Object form, provided that You
100
+ meet the following conditions:
101
+
102
+ (a) You must give any other recipients of the Work or
103
+ Derivative Works a copy of this License; and
104
+
105
+ (b) You must cause any modified files to carry prominent notices
106
+ stating that You changed the files; and
107
+
108
+ (c) You must retain, in the Source form of any Derivative Works
109
+ that You distribute, all copyright, patent, trademark, and
110
+ attribution notices from the Source form of the Work,
111
+ excluding those notices that do not pertain to any part of
112
+ the Derivative Works; and
113
+
114
+ (d) If the Work includes a "NOTICE" text file as part of its
115
+ distribution, then any Derivative Works that You distribute must
116
+ include a readable copy of the attribution notices contained
117
+ within such NOTICE file, excluding those notices that do not
118
+ pertain to any part of the Derivative Works, in at least one
119
+ of the following places: within a NOTICE text file distributed
120
+ as part of the Derivative Works; within the Source form or
121
+ documentation, if provided along with the Derivative Works; or,
122
+ within a display generated by the Derivative Works, if and
123
+ wherever such third-party notices normally appear. The contents
124
+ of the NOTICE file are for informational purposes only and
125
+ do not modify the License. You may add Your own attribution
126
+ notices within Derivative Works that You distribute, alongside
127
+ or as an addendum to the NOTICE text from the Work, provided
128
+ that such additional attribution notices cannot be construed
129
+ as modifying the License.
130
+
131
+ You may add Your own copyright statement to Your modifications and
132
+ may provide additional or different license terms and conditions
133
+ for use, reproduction, or distribution of Your modifications, or
134
+ for any such Derivative Works as a whole, provided Your use,
135
+ reproduction, and distribution of the Work otherwise complies with
136
+ the conditions stated in this License.
137
+
138
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
139
+ any Contribution intentionally submitted for inclusion in the Work
140
+ by You to the Licensor shall be under the terms and conditions of
141
+ this License, without any additional terms or conditions.
142
+ Notwithstanding the above, nothing herein shall supersede or modify
143
+ the terms of any separate license agreement you may have executed
144
+ with Licensor regarding such Contributions.
145
+
146
+ 6. Trademarks. This License does not grant permission to use the trade
147
+ names, trademarks, service marks, or product names of the Licensor,
148
+ except as required for reasonable and customary use in describing the
149
+ origin of the Work and reproducing the content of the NOTICE file.
150
+
151
+ 7. Disclaimer of Warranty. Unless required by applicable law or
152
+ agreed to in writing, Licensor provides the Work (and each
153
+ Contributor provides its Contributions) on an "AS IS" BASIS,
154
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
155
+ implied, including, without limitation, any warranties or conditions
156
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
157
+ PARTICULAR PURPOSE. You are solely responsible for determining the
158
+ appropriateness of using or redistributing the Work and assume any
159
+ risks associated with Your exercise of permissions under this License.
160
+
161
+ 8. Limitation of Liability. In no event and under no legal theory,
162
+ whether in tort (including negligence), contract, or otherwise,
163
+ unless required by applicable law (such as deliberate and grossly
164
+ negligent acts) or agreed to in writing, shall any Contributor be
165
+ liable to You for damages, including any direct, indirect, special,
166
+ incidental, or consequential damages of any character arising as a
167
+ result of this License or out of the use or inability to use the
168
+ Work (including but not limited to damages for loss of goodwill,
169
+ work stoppage, computer failure or malfunction, or any and all
170
+ other commercial damages or losses), even if such Contributor
171
+ has been advised of the possibility of such damages.
172
+
173
+ 9. Accepting Warranty or Additional Liability. While redistributing
174
+ the Work or Derivative Works thereof, You may choose to offer,
175
+ and charge a fee for, acceptance of support, warranty, indemnity,
176
+ or other liability obligations and/or rights consistent with this
177
+ License. However, in accepting such obligations, You may act only
178
+ on Your own behalf and on Your sole responsibility, not on behalf
179
+ of any other Contributor, and only if You agree to indemnify,
180
+ defend, and hold each Contributor harmless for any liability
181
+ incurred by, or claims asserted against, such Contributor by reason
182
+ of your accepting any such warranty or additional liability.
183
+
184
+ END OF TERMS AND CONDITIONS
185
+
186
+ ---
187
+
188
+ MIT License
189
+
190
+ Copyright (c) 2024-2025 Model Context Protocol a Series of LF Projects, LLC.
191
+
192
+ Permission is hereby granted, free of charge, to any person obtaining a copy
193
+ of this software and associated documentation files (the "Software"), to deal
194
+ in the Software without restriction, including without limitation the rights
195
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
196
+ copies of the Software, and to permit persons to whom the Software is
197
+ furnished to do so, subject to the following conditions:
198
+
199
+ The above copyright notice and this permission notice shall be included in all
200
+ copies or substantial portions of the Software.
201
+
202
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
203
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
204
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
205
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
206
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
207
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
208
+ SOFTWARE.
209
+
210
+ ---
211
+
212
+ Creative Commons Attribution 4.0 International (CC-BY-4.0)
213
+
214
+ Documentation in this project (excluding specifications) is licensed under
215
+ CC-BY-4.0. See https://creativecommons.org/licenses/by/4.0/legalcode for
216
+ the full license text.