administrate-mcp 0.6.0 → 0.7.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: c350ad45d3f07a28fb76136a472895c5ab803c56771ade63fdfdba70a78bc874
4
- data.tar.gz: a31ed7ff75cbb2ee5dcacbe581701a46ef3358bb9d77760a3ae91dfe5938cd93
3
+ metadata.gz: e6ca1e6574d87a28b718673e692727bdb139caa3f65cf0c10f4724e4337be5e1
4
+ data.tar.gz: 26048b0567701b52fe86b1bb23ee2f3a99a7412745835e73367968e6af40914e
5
5
  SHA512:
6
- metadata.gz: 27e3a249e626a6ec2413866c87517cf418ef07a6dd25af0d048a122b4cbc92a762e3d18175522b508aa1a620b9159c7791e422ae9f5415d61000487dcb0402dc
7
- data.tar.gz: 1f5e1a59ce398562594dbf27606402e435da36391ca9a8f8c4d34443fcf33a59ebeccec925c2053290942a9c9de3629d1e9e1f7b65514296c1c75174b3254e51
6
+ metadata.gz: 00d1b9a5f09cfc1d76a3c97dcc13e58a1d14cef4c2096023e93b9fef67f436f587761a4276357b09c9ebd9440aa0a87d18ecb31c03b2dd4e661ead79269e6ac3
7
+ data.tar.gz: 34e0385f4c6acf298c821beec57472a080b7d6f52531971d35160c782423bd277f2b538eaeca30829b8dd9f7a778b966b91870058cfdb4b503a40aa0b2b64402
data/CHANGELOG.md CHANGED
@@ -8,6 +8,25 @@ minor release may change behaviour a host depends on; the entry says so when it
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.7.0] - 2026-11-20
12
+
13
+ ### Added
14
+
15
+ - Skills, the server side of the MCP Skills extension (SEP-2640). `config.skill_paths` names
16
+ directories of skills, each with its `SKILL.md`; the server then declares the
17
+ `io.modelcontextprotocol/skills` extension and serves them with their files. `config.skill_visible`
18
+ decides per request which skills are listed and readable. Without `skill_paths`, nothing changes.
19
+ See [Skills](docs/skills.md).
20
+
21
+ ### Changed
22
+
23
+ - The `mcp` dependency is now `~> 1.10`, for its Skills extension.
24
+
25
+ ### Fixed
26
+
27
+ - The name of a dynamically registered OAuth client keeps its quotes and ampersands as typed. With
28
+ recent `actionview` releases, stripping its HTML tags also escaped them, storing `"` for `"`.
29
+
11
30
  ## [0.6.0] - 2026-10-28
12
31
 
13
32
  ### Added
@@ -223,7 +242,8 @@ minor release may change behaviour a host depends on; the entry says so when it
223
242
  took the gem from git before 0.1.0 must reinstall its migrations rather than migrate
224
243
  incrementally.
225
244
 
226
- [Unreleased]: https://github.com/sorare/administrate-mcp/compare/v0.6.0...HEAD
245
+ [Unreleased]: https://github.com/sorare/administrate-mcp/compare/v0.7.0...HEAD
246
+ [0.7.0]: https://github.com/sorare/administrate-mcp/compare/v0.6.0...v0.7.0
227
247
  [0.6.0]: https://github.com/sorare/administrate-mcp/compare/v0.5.0...v0.6.0
228
248
  [0.5.0]: https://github.com/sorare/administrate-mcp/compare/v0.4.0...v0.5.0
229
249
  [0.4.0]: https://github.com/sorare/administrate-mcp/compare/v0.3.1...v0.4.0
data/README.md CHANGED
@@ -244,6 +244,12 @@ with paging, sorting, search and association links for `admin_resource_list` and
244
244
  `admin_resource_show`, a Sidekiq panel, and a base class for views of your own. Off until
245
245
  `config.tool_views` is set: [docs/tool-views.md](docs/tool-views.md).
246
246
 
247
+ ## Skills
248
+
249
+ Agent Skills served next to the tools, through the MCP Skills extension, so every client connected
250
+ to the server gets the instructions with the tools they explain. Off until `config.skill_paths` is
251
+ set: [docs/skills.md](docs/skills.md).
252
+
247
253
  ## Authentication
248
254
 
249
255
  How a request is authenticated (API key, then OAuth token, then `identity_fallback`), how to issue
@@ -22,15 +22,7 @@ module Administrate
22
22
  def build(server_context:)
23
23
  server_context[:authorization_errors] ||= []
24
24
  config = Administrate::MCP.config
25
- tools = discover_tools(server_context)
26
- server =
27
- ::MCP::Server.new(
28
- name: config.server_name,
29
- version: config.server_version,
30
- tools:,
31
- resources: tool_view_resources(tools),
32
- server_context:
33
- )
25
+ server = new_server(config, discover_tools(server_context), server_context)
34
26
  server.capabilities = server.capabilities.merge(extensions: ::MCP::Apps.capability) if config.tool_views
35
27
  server.transport =
36
28
  ::MCP::Server::Transports::StreamableHTTPTransport.new(
@@ -49,6 +41,17 @@ module Administrate
49
41
  server
50
42
  end
51
43
 
44
+ def new_server(config, tools, server_context)
45
+ ::MCP::Server.new(
46
+ name: config.server_name,
47
+ version: config.server_version,
48
+ tools:,
49
+ resources: tool_view_resources(tools),
50
+ skills: skills_for(server_context),
51
+ server_context:
52
+ )
53
+ end
54
+
52
55
  def discover_tools(server_context)
53
56
  load_host_tools
54
57
  action_tools = Actions.tools_for(server_context)
@@ -63,6 +66,13 @@ module Administrate
63
66
  tools.filter_map(&:tool_view).uniq.map(&:resource)
64
67
  end
65
68
 
69
+ def skills_for(server_context)
70
+ config = Administrate::MCP.config
71
+ return if config.skill_paths.empty?
72
+
73
+ config.skills.select { |skill| config.skill_visible.call(skill, server_context) }
74
+ end
75
+
66
76
  def built_in_tools
67
77
  names = BUILT_IN_TOOLS.dup
68
78
  names << REPORT_IMPROVEMENT_TOOL if Administrate::MCP.config.feedback_tool
@@ -33,7 +33,9 @@ module Administrate
33
33
  private
34
34
 
35
35
  def sanitize_name
36
- self.name = ActionController::Base.helpers.strip_tags(name)&.strip if name.present?
36
+ return if name.blank?
37
+
38
+ self.name = Rails::HTML::Sanitizer.best_supported_vendor.full_sanitizer.new.sanitize(name)&.strip
37
39
  end
38
40
 
39
41
  def validate_redirect_uris
@@ -101,6 +101,7 @@ class Configuration
101
101
  :authorization,
102
102
  :default_required_roles,
103
103
  :tool_paths,
104
+ :skill_visible,
104
105
  :dashboard_paths,
105
106
  :instrument,
106
107
  :on_tool_call,
@@ -118,7 +119,7 @@ class Configuration
118
119
  :has_many_field_classes,
119
120
  :field_serializers
120
121
 
121
- attr_reader :api_key_token_prefix
122
+ attr_reader :api_key_token_prefix, :skill_paths
122
123
 
123
124
  def assign_identity
124
125
  @server_name = 'administrate_mcp'
@@ -135,6 +136,8 @@ class Configuration
135
136
  @authorization = default_authorization
136
137
  @default_required_roles = []
137
138
  @tool_paths = []
139
+ @skill_paths = []
140
+ @skill_visible = ->(_skill, _server_context) { true }
138
141
  @dashboard_paths = nil
139
142
  end
140
143
 
@@ -188,6 +191,8 @@ end
188
191
  | `authorization` | Pundit if defined, else Permissive | Adapter: `authorize!`, `authorized?`, `authorize_roles!` |
189
192
  | `default_required_roles` | `[]` | Roles a tool requires unless it declares its own |
190
193
  | `tool_paths` | `[]` | Directories scanned for extra `BaseTool` subclasses |
194
+ | `skill_paths` | `[]` | Directories holding skill directories, each with its `SKILL.md`, served through the MCP Skills extension. See [Skills](skills.md) |
195
+ | `skill_visible` | `true` | Proc `(skill, server_context)`; a skill it rejects is neither listed nor readable in that request. See [Skills](skills.md) |
191
196
  | `dashboard_paths` | `app/dashboards` | Where dashboards are found |
192
197
  | `instrument` | yields | Around hook `(tool_name:, admin:, &block)` |
193
198
  | `on_tool_call` | no-op | Audit hook `(tool_name:, admin:, arguments:, scopes:)`, after the permission checks |
data/docs/skills.md ADDED
@@ -0,0 +1,47 @@
1
+ # Skills
2
+
3
+ [Back to README](../README.md)
4
+
5
+ The server can serve [Agent Skills](https://agentskills.io) alongside its tools, through the MCP
6
+ Skills extension (SEP-2640, `io.modelcontextprotocol/skills`). A skill is a directory with a
7
+ `SKILL.md` and the files it refers to. A client that supports the extension lists the skills with
8
+ `skills/list` and reads their files as `skill://<name>/...` resources. Ship a skill with the tools it
9
+ explains, so every client connected to the server gets both.
10
+
11
+ ```ruby
12
+ Administrate::MCP.configure do |c|
13
+ c.skill_paths = [Rails.root.join('config/mcp_skills')]
14
+ end
15
+ ```
16
+
17
+ Each path holds skill directories, not a skill itself:
18
+
19
+ ```
20
+ config/mcp_skills/
21
+ ├── create-record/
22
+ │ ├── SKILL.md
23
+ │ └── references/
24
+ │ └── orders.md
25
+ └── review-record/
26
+ └── SKILL.md
27
+ ```
28
+
29
+ The directory name must equal the `name` of the frontmatter. The skills are read on the first
30
+ request that serves them, and their files are checked against that read on every request: restart
31
+ the application after changing them. Without `skill_paths` the server does not declare the
32
+ extension.
33
+
34
+ ## Showing a skill to some admins only
35
+
36
+ `skill_visible` decides, for each request, which skills the server serves. A skill it rejects is
37
+ neither listed nor readable. It receives the skill and the server context, which holds `:admin` and
38
+ `:scopes`:
39
+
40
+ ```ruby
41
+ c.skill_visible = lambda do |skill, server_context|
42
+ skill.name != 'create-record' || server_context[:scopes].map(&:to_s).include?('write')
43
+ end
44
+ ```
45
+
46
+ Hiding a skill only hides its instructions: the tools it uses still run their own scope and role
47
+ checks.
@@ -49,6 +49,7 @@ module Administrate
49
49
  :authorization,
50
50
  :default_required_roles,
51
51
  :tool_paths,
52
+ :skill_visible,
52
53
  :dashboard_paths,
53
54
  :instrument,
54
55
  :on_tool_call,
@@ -68,7 +69,7 @@ module Administrate
68
69
  :has_many_field_classes,
69
70
  :field_serializers
70
71
 
71
- attr_reader :api_key_token_prefix, :uploads
72
+ attr_reader :api_key_token_prefix, :uploads, :skill_paths
72
73
 
73
74
  def initialize
74
75
  assign_identity
@@ -91,6 +92,8 @@ module Administrate
91
92
  @authorization = default_authorization
92
93
  @default_required_roles = []
93
94
  @tool_paths = []
95
+ @skill_paths = []
96
+ @skill_visible = ->(_skill, _server_context) { true }
94
97
  @dashboard_paths = nil
95
98
  end
96
99
 
@@ -127,6 +130,15 @@ module Administrate
127
130
  @api_key_token_prefix = prefix.to_s
128
131
  end
129
132
 
133
+ def skill_paths=(paths)
134
+ @skill_paths = Array(paths)
135
+ @skills = nil
136
+ end
137
+
138
+ def skills
139
+ @skills ||= skill_paths.flat_map { |path| ::MCP::Skill.from_directory(path.to_s) }
140
+ end
141
+
130
142
  def register_field(class_name, as: nil, &serializer)
131
143
  @field_serializers = @field_serializers.merge(class_name.to_s => as || serializer)
132
144
  self
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Administrate
4
4
  module MCP
5
- VERSION = '0.6.0'
5
+ VERSION = '0.7.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administrate-mcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sorare
@@ -49,14 +49,14 @@ dependencies:
49
49
  requirements:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: '1.5'
52
+ version: '1.10'
53
53
  type: :runtime
54
54
  prerelease: false
55
55
  version_requirements: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '1.5'
59
+ version: '1.10'
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: rails
62
62
  requirement: !ruby/object:Gem::Requirement
@@ -140,6 +140,7 @@ files:
140
140
  - docs/development.md
141
141
  - docs/oauth.md
142
142
  - docs/routes.md
143
+ - docs/skills.md
143
144
  - docs/tool-views.md
144
145
  - docs/uploads.md
145
146
  - lib/administrate-mcp.rb