hub_kernel-mcp 0.11.0 → 0.12.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c155be6194b6cb2b7bc18afec3c1da06e65389c31fcbc7e91f13337e61b9687
4
- data.tar.gz: b3f322430ac31895558ed9f52590af47d8dd87345c3b5b42db9a54712ac91222
3
+ metadata.gz: 9d02ce2d6bae9e8126d364c6dbf460f9ef630c9c9d9b2b4a2812be0886c83977
4
+ data.tar.gz: c35e0c6775fbcbb414d58e726392cb50297df1562ca5eb205a57501f26baf162
5
5
  SHA512:
6
- metadata.gz: af62f841adf4ad4e61071dcaf4b49ab956c5d4419366d888ecdd0a0a7141d7df12748b76c4690917b8959e893af46972169c8839cd83187cced21393f503a896
7
- data.tar.gz: 11d1e059e7b9edaca4f88ded7b5d105699ec0fa381d9e17c293859f109f8cbc3665014399a8da1c7f150b38d35eafab9b0b89b62be1492722a0f8402acb16ab7
6
+ metadata.gz: a1953f5a5d5519297d6ce9afb04385660152cf6623f9cebc9352a9e8b89b66241720066343ee0ef82e84bff16703dc5924d0a96577ef0cf2afbdc0c353f60474
7
+ data.tar.gz: 0c7a6a96f3ce5e956e8e81f278f267177fe887a0009e655f6057514e677f4c8a5c982f06b87e34c60c0af098f73f1d62205a325da53f343778f97a0db2226467
data/README.md CHANGED
@@ -253,6 +253,11 @@ Each approval makes its own connection, so connecting the same app to a second a
253
253
  second connection beside the first. A refreshed access token stays in the account its
254
254
  connection was approved for.
255
255
 
256
+ Each connection carries a `public_code`, a random code given when the connection is made, so a
257
+ host can address a page for one connection without its database id. No two connections share a
258
+ code. Installing the 0.12.0 migration with `bin/rails hub_kernel_mcp:install:migrations` gives
259
+ every connection made before it a code.
260
+
256
261
  A person can see the apps connected as them and disconnect one. The gem ships a section for a
257
262
  host's settings page: the `hub_kernel/mcp/connections` partial, which lists each of the person's
258
263
  connections with the app's name, when it connected and when it was last used, and the
@@ -10,6 +10,8 @@ module HubKernel
10
10
  Tokens = Data.define(:access_token, :refresh_token)
11
11
  Caller = Data.define(:person, :account)
12
12
 
13
+ has_secure_token :public_code
14
+
13
15
  belongs_to :client
14
16
 
15
17
  scope :of, ->(person) { where(person_gid: person.to_global_id.to_s) }
@@ -0,0 +1,20 @@
1
+ class AddPublicCodeToHubKernelMcpConnections < ActiveRecord::Migration[8.1]
2
+ class Connection < ActiveRecord::Base
3
+ self.table_name = "hub_kernel_mcp_connections"
4
+ end
5
+
6
+ def change
7
+ add_column :hub_kernel_mcp_connections, :public_code, :string
8
+
9
+ reversible do |direction|
10
+ direction.up do
11
+ Connection.reset_column_information
12
+ Connection.where(public_code: nil).find_each do |connection|
13
+ connection.update_columns(public_code: Connection.generate_unique_secure_token)
14
+ end
15
+ end
16
+ end
17
+
18
+ add_index :hub_kernel_mcp_connections, :public_code, unique: true
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  module HubKernel
2
2
  module Mcp
3
- VERSION = "0.11.0"
3
+ VERSION = "0.12.0"
4
4
  end
5
5
  end
@@ -393,6 +393,7 @@ connections, or when a test needs to send requests to any of these addresses.
393
393
  connection.created_at # when the person approved it
394
394
  connection.last_used_at # when its access token last signed a request in, or nil if never
395
395
  connection.account # the account picked on the approval page, or nil if none was
396
+ connection.public_code # a random code, unique to the connection, for addressing it without its id
396
397
  end
397
398
  ```
398
399
 
@@ -405,7 +406,11 @@ connections, or when a test needs to send requests to any of these addresses.
405
406
  when the person disconnects it, or when its access and refresh tokens have
406
407
  both expired and the host's prune task runs. `last_used_at` is set each time the host's sign-in accepts
407
408
  the connection's access token. Ask the developer whether a list they build
408
- should show expired connections. To show the list on a settings page with
409
+ should show expired connections. Address a host page for one connection by
410
+ its `public_code`, found with `find_by!(public_code:)` on the person's
411
+ relation, never by its `id`. Every connection has one from the moment it is
412
+ made, and the `public_code` migration gives one to every connection made
413
+ before it ran. To show the list on a settings page with
409
414
  Disconnect buttons, use the settings section `hub_kernel-mcp-install` covers
410
415
  instead of building one.
411
416
 
@@ -165,7 +165,9 @@ This local declares no entry points of its own.
165
165
  token, so neither token itself is stored. A connection keeps the account by
166
166
  its global id, and one made with no account, including every one made before
167
167
  the account was kept, has none. Each approval makes its own connection, so
168
- connecting the same app to a second account makes a second connection.
168
+ connecting the same app to a second account makes a second connection. Each
169
+ connection also carries a public code, a random code no other connection
170
+ shares, so a host can address a page for it without its database id.
169
171
  - **Refresh exchange** — the client posts its client id and its refresh token to
170
172
  the token address, asking for the refresh grant, with no sign-in. It is
171
173
  answered with a new access token and a new refresh token on the same
@@ -31,7 +31,7 @@ a signed-in person's behalf.
31
31
  - `mount HubKernel::Mcp::Discovery` — mounts the two OAuth discovery documents
32
32
  in the host's `config/routes.rb`. It must be mounted at `"/.well-known"`,
33
33
  since the endpoint's 401 header names that path.
34
- - `bin/rails hub_kernel_mcp:install:migrations` — copies the gem's nine
34
+ - `bin/rails hub_kernel_mcp:install:migrations` — copies the gem's ten
35
35
  migrations into the host's `db/migrate`. They create the
36
36
  `hub_kernel_mcp_clients` table, which holds each client that registers, the
37
37
  `hub_kernel_mcp_authorization_codes` table, which holds each code the
@@ -42,6 +42,8 @@ a signed-in person's behalf.
42
42
  `created_at`, to `hub_kernel_mcp_clients`, and a nullable `account_gid`
43
43
  column, which holds the global id of the account picked on the approval page,
44
44
  to both `hub_kernel_mcp_authorization_codes` and `hub_kernel_mcp_connections`.
45
+ The last adds a `public_code` column with a unique index to
46
+ `hub_kernel_mcp_connections` and gives every connection already there a code.
45
47
  - `HubKernel::Mcp.base_controller=` — the name, as a String, of the host
46
48
  controller the endpoint inherits from. Its before-actions, including sign-in,
47
49
  run before any hub is asked. Defaults to `"ActionController::API"`, which has
@@ -216,9 +218,9 @@ a signed-in person's behalf.
216
218
  bin/rails hub_kernel_mcp:install:migrations db:migrate
217
219
  ```
218
220
 
219
- This adds nine migrations to the host's `db/migrate` and the
221
+ This adds ten migrations to the host's `db/migrate` and the
220
222
  `hub_kernel_mcp_clients`, `hub_kernel_mcp_authorization_codes` and
221
- `hub_kernel_mcp_connections` tables to `db/schema.rb`. Commit all ten
223
+ `hub_kernel_mcp_connections` tables to `db/schema.rb`. Commit all eleven
222
224
  files.
223
225
 
224
226
  10. Add the discovery mount to `config/routes.rb`, at the site root beside the
@@ -405,8 +407,9 @@ a signed-in person's behalf.
405
407
  should answer 401.
406
408
  - Run `bin/rails hub_kernel_mcp:install:migrations db:migrate` again after
407
409
  upgrading the gem. It copies only migrations the host does not have yet. A
408
- host that installed an earlier version with fewer than nine migrations gets
409
- the missing ones this way, including the two that add `account_gid`. Until
410
+ host that installed an earlier version with fewer than ten migrations gets
411
+ the missing ones this way, including the two that add `account_gid` and the
412
+ one that adds `public_code` and gives every existing connection a code. Until
410
413
  they are run, the registration address or the token address answers status
411
414
  500 with `server_error`, the approval page says
412
415
  `Signing in failed unexpectedly`, or the token lookups and the connections
@@ -55,6 +55,7 @@ sources:
55
55
  - db/migrate/20261009000004_add_registered_from_to_hub_kernel_mcp_clients.rb
56
56
  - db/migrate/20261123175537_add_account_gid_to_hub_kernel_mcp_connections.rb
57
57
  - db/migrate/20261123175631_add_account_gid_to_hub_kernel_mcp_authorization_codes.rb
58
+ - db/migrate/20261124155922_add_public_code_to_hub_kernel_mcp_connections.rb
58
59
  - app/models/hub_kernel/mcp/client.rb
59
60
  - app/models/hub_kernel/mcp/authorization_code.rb
60
61
  - app/models/hub_kernel/mcp/connection.rb
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hub_kernel-mcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tylercschneider
@@ -87,6 +87,7 @@ files:
87
87
  - db/migrate/20261009000004_add_registered_from_to_hub_kernel_mcp_clients.rb
88
88
  - db/migrate/20261123175537_add_account_gid_to_hub_kernel_mcp_connections.rb
89
89
  - db/migrate/20261123175631_add_account_gid_to_hub_kernel_mcp_authorization_codes.rb
90
+ - db/migrate/20261124155922_add_public_code_to_hub_kernel_mcp_connections.rb
90
91
  - lib/hub_kernel-mcp.rb
91
92
  - lib/hub_kernel/mcp.rb
92
93
  - lib/hub_kernel/mcp/challenge.rb