crumb-mcp 0.1.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 +7 -0
- data/LICENSE +21 -0
- data/README.md +89 -0
- data/exe/crumb-mcp +18 -0
- data/lib/crumb/mcp/api_client.rb +70 -0
- data/lib/crumb/mcp/registry.rb +39 -0
- data/lib/crumb/mcp/tools/compare_deploys.rb +39 -0
- data/lib/crumb/mcp/tools/deploy_details.rb +51 -0
- data/lib/crumb/mcp/tools/find_deploys_touching.rb +46 -0
- data/lib/crumb/mcp/tools/recent_deploys.rb +47 -0
- data/lib/crumb/mcp/version.rb +5 -0
- data/lib/crumb/mcp.rb +9 -0
- data/lib/crumb-mcp.rb +1 -0
- metadata +92 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: da7be171e2bd8321f2ff39694fc935a988f8ae6231f1ae97ff2dd7be5fc8ed87
|
|
4
|
+
data.tar.gz: '0969611434b08ad6cd336414579a8014fb99a058e61d03d51f3c50634ccfb776'
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 0fb3f2b41f71fb409df580fb2f635303be27e02504437de1f909d6ac93138c88ac0b1f7f7de43b546d6eab61c0c20461c05f09a99eeeea06bc92142106901694
|
|
7
|
+
data.tar.gz: 6a5b2f8e95518b09a4a651419624040cc174c00092ef9698754e0064e876f266440b7163c0477c80cd6c5fa328f9825b62fd0a55906aaf5b2d58edb1f80991b4
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nicolás Galdámez
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# crumb-mcp
|
|
2
|
+
|
|
3
|
+
A standalone [MCP](https://modelcontextprotocol.io) server that queries one or more
|
|
4
|
+
[Crumb](../README.md) endpoints, so an AI assistant (e.g. Claude Code) can answer
|
|
5
|
+
questions about your deploys: what shipped, when, by whom, and which files changed.
|
|
6
|
+
|
|
7
|
+
Each developer runs this locally. It talks to the read API exposed by the
|
|
8
|
+
[`crumb` engine](../engine) mounted in your apps, authenticating with a read token.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
Install the gem from RubyGems — no clone needed:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
gem install crumb-mcp
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The entrypoint is `crumb-mcp`, run over stdio.
|
|
19
|
+
|
|
20
|
+
> **Working on the gem itself?** Clone the repo and `cd mcp && bundle install`; the
|
|
21
|
+
> entrypoint is then `bundle exec exe/crumb-mcp`.
|
|
22
|
+
|
|
23
|
+
## Configuration
|
|
24
|
+
|
|
25
|
+
Create `~/.config/crumb/config.yml` describing each app endpoint you want to query:
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
endpoints:
|
|
29
|
+
my-app-staging:
|
|
30
|
+
base_url: https://staging.your-app.com/crumb
|
|
31
|
+
token_env: CRUMB_READ_TOKEN_STAGING
|
|
32
|
+
repo_path: ~/code/your-app # optional, for local git lookups
|
|
33
|
+
my-app-production:
|
|
34
|
+
base_url: https://your-app.com/crumb
|
|
35
|
+
token_env: CRUMB_READ_TOKEN_PRODUCTION
|
|
36
|
+
repo_path: ~/code/your-app
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- **`base_url`** — the engine's mount URL (the same `/crumb` path the app mounts).
|
|
40
|
+
- **`token_env`** — the name of the env var holding this endpoint's read token. The
|
|
41
|
+
server reads the token from the environment, so secrets stay out of the config file.
|
|
42
|
+
- **`repo_path`** — optional local checkout, used by tools that inspect git directly.
|
|
43
|
+
|
|
44
|
+
The map keys (`my-app-staging`, …) are the endpoint **slugs** you pass to the tools;
|
|
45
|
+
omit the slug on most tools to fan out across every endpoint.
|
|
46
|
+
|
|
47
|
+
Mint a token from each app (`bin/rails crumb:tokens:mint OWNER=you@example.com` — see the
|
|
48
|
+
[engine README](../engine/README.md#read-access-tokens)) and export it under the matching
|
|
49
|
+
`token_env`:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# ~/.zshrc
|
|
53
|
+
export CRUMB_READ_TOKEN_STAGING=...
|
|
54
|
+
export CRUMB_READ_TOKEN_PRODUCTION=...
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Registering with Claude Code
|
|
58
|
+
|
|
59
|
+
If you ran `gem install crumb-mcp`, register the executable directly:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
claude mcp add crumb -- crumb-mcp
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Or skip the install step entirely and let `gem exec` fetch and run the gem on demand
|
|
66
|
+
(Ruby 3.4+ / RubyGems 3.5+):
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
claude mcp add crumb -- gem exec crumb-mcp
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Restart Claude Code so the tools register in a fresh session, then ask things like
|
|
73
|
+
*"What deployed to my-app-staging today?"*.
|
|
74
|
+
|
|
75
|
+
> **From a local checkout** (gem development): point the command at `bundle exec`:
|
|
76
|
+
> `claude mcp add crumb -- bash -c "cd /absolute/path/to/crumb/mcp && bundle exec exe/crumb-mcp"`
|
|
77
|
+
|
|
78
|
+
## Tools
|
|
79
|
+
|
|
80
|
+
| Tool | Input | Returns |
|
|
81
|
+
|------|-------|---------|
|
|
82
|
+
| `recent_deploys` | `endpoint?`, `limit?` | Most recent deploys, across all endpoints or one |
|
|
83
|
+
| `deploy_details` | `endpoint`, `id`, `include_diff?` | One deploy with commits and changed files |
|
|
84
|
+
| `compare_deploys` | `endpoint`, `from_id`, `to_id` | Union of commits/files between two deploys |
|
|
85
|
+
| `find_deploys_touching` | `path_prefix`, `endpoint?`, `limit?` | Deploys that changed files under a path prefix |
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
[MIT](https://opensource.org/licenses/MIT).
|
data/exe/crumb-mcp
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
|
|
5
|
+
require "crumb/mcp"
|
|
6
|
+
|
|
7
|
+
server = MCP::Server.new(
|
|
8
|
+
name: "crumb",
|
|
9
|
+
version: Crumb::MCP::VERSION,
|
|
10
|
+
tools: [
|
|
11
|
+
Crumb::MCP::Tools::RecentDeploysTool,
|
|
12
|
+
Crumb::MCP::Tools::DeployDetailsTool,
|
|
13
|
+
Crumb::MCP::Tools::CompareDeploysTool,
|
|
14
|
+
Crumb::MCP::Tools::FindDeploysTouchingTool
|
|
15
|
+
]
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
MCP::Server::Transports::StdioTransport.new(server).open
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require "faraday"
|
|
2
|
+
require "json"
|
|
3
|
+
require "shellwords"
|
|
4
|
+
require "uri"
|
|
5
|
+
|
|
6
|
+
module Crumb
|
|
7
|
+
module MCP
|
|
8
|
+
class ApiClient
|
|
9
|
+
class Error < StandardError; end
|
|
10
|
+
|
|
11
|
+
def self.for(slug)
|
|
12
|
+
ep = Registry.endpoint_for(slug)
|
|
13
|
+
token = ENV.fetch(ep[:token_env]) do
|
|
14
|
+
raise Error, "Missing env var #{ep[:token_env]} for endpoint #{slug}"
|
|
15
|
+
end
|
|
16
|
+
new(ep[:base_url], token, ep[:repo_path], slug)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def initialize(base_url, token, repo_path, slug)
|
|
20
|
+
@base_url = base_url.chomp("/")
|
|
21
|
+
@token = token
|
|
22
|
+
@repo_path = repo_path
|
|
23
|
+
@slug = slug
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def recent(limit: 20)
|
|
27
|
+
data = get("/deploys?limit=#{limit}")
|
|
28
|
+
(data["deploys"] || []).map { |d| d.merge("endpoint" => @slug) }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def detail(id)
|
|
32
|
+
get("/deploys/#{id}").merge("endpoint" => @slug)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def touching(path_prefix, limit: 20)
|
|
36
|
+
data = get("/deploys?touching=#{URI.encode_uri_component(path_prefix)}&limit=#{limit}")
|
|
37
|
+
(data["deploys"] || []).map { |d| d.merge("endpoint" => @slug) }
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def diff(sha, repo_path: nil)
|
|
41
|
+
dir = repo_path || @repo_path
|
|
42
|
+
raise Error, "No repo_path configured for endpoint #{@slug}" unless dir
|
|
43
|
+
`git -C #{Shellwords.escape(dir)} show #{Shellwords.escape(sha)} --stat 2>&1`
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
OPEN_TIMEOUT = 5
|
|
49
|
+
READ_TIMEOUT = 15
|
|
50
|
+
|
|
51
|
+
def get(path)
|
|
52
|
+
response = connection.get("#{@base_url}#{path}") do |req|
|
|
53
|
+
req.headers["Authorization"] = "Bearer #{@token}"
|
|
54
|
+
req.headers["Accept"] = "application/json"
|
|
55
|
+
end
|
|
56
|
+
raise Error, "HTTP #{response.status} from #{@slug}" unless response.status == 200
|
|
57
|
+
JSON.parse(response.body)
|
|
58
|
+
rescue Faraday::Error => e
|
|
59
|
+
raise Error, "Request to #{@slug} failed: #{e.message}"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def connection
|
|
63
|
+
@connection ||= Faraday.new do |f|
|
|
64
|
+
f.options.open_timeout = OPEN_TIMEOUT
|
|
65
|
+
f.options.timeout = READ_TIMEOUT
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require "yaml"
|
|
2
|
+
|
|
3
|
+
module Crumb
|
|
4
|
+
module MCP
|
|
5
|
+
class Registry
|
|
6
|
+
CONFIG_PATH = File.expand_path("~/.config/crumb/config.yml")
|
|
7
|
+
|
|
8
|
+
class << self
|
|
9
|
+
def all_slugs
|
|
10
|
+
endpoints.keys
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def endpoint_for(slug)
|
|
14
|
+
ep = endpoints[slug]
|
|
15
|
+
raise ArgumentError, "Unknown Crumb endpoint: #{slug}" unless ep
|
|
16
|
+
{
|
|
17
|
+
base_url: ep["base_url"],
|
|
18
|
+
token_env: ep["token_env"],
|
|
19
|
+
repo_path: ep["repo_path"] && File.expand_path(ep["repo_path"])
|
|
20
|
+
}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def endpoints
|
|
26
|
+
config["endpoints"] or
|
|
27
|
+
raise "No 'endpoints' key found in #{CONFIG_PATH}"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def config
|
|
31
|
+
@config ||= begin
|
|
32
|
+
raise "Crumb config not found at #{CONFIG_PATH}" unless File.exist?(CONFIG_PATH)
|
|
33
|
+
YAML.safe_load_file(CONFIG_PATH)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Crumb
|
|
2
|
+
module MCP
|
|
3
|
+
module Tools
|
|
4
|
+
class CompareDeploysTool < ::MCP::Tool
|
|
5
|
+
tool_name "compare_deploys"
|
|
6
|
+
description "Union of commits and changed files between two deploys on the same endpoint."
|
|
7
|
+
input_schema(
|
|
8
|
+
properties: {
|
|
9
|
+
endpoint: { type: "string", description: "Endpoint slug." },
|
|
10
|
+
from_id: { type: "integer", description: "Older deploy ID." },
|
|
11
|
+
to_id: { type: "integer", description: "Newer deploy ID." }
|
|
12
|
+
},
|
|
13
|
+
required: [ "endpoint", "from_id", "to_id" ]
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
class << self
|
|
17
|
+
def call(endpoint:, from_id:, to_id:, server_context: nil)
|
|
18
|
+
client = ApiClient.for(endpoint)
|
|
19
|
+
from = client.detail(from_id)
|
|
20
|
+
to = client.detail(to_id)
|
|
21
|
+
|
|
22
|
+
all_commits = (Array(from["commits"]) + Array(to["commits"]))
|
|
23
|
+
.uniq { |c| c["sha"] }
|
|
24
|
+
all_files = (Array(from["changed_files"]) + Array(to["changed_files"]))
|
|
25
|
+
.uniq { |f| f["path"] }
|
|
26
|
+
|
|
27
|
+
text = "Comparison between deploy ##{from_id} and ##{to_id} on #{endpoint}\n\n"
|
|
28
|
+
text += "Commits (#{all_commits.size} unique):\n"
|
|
29
|
+
all_commits.each { |c| text += " #{c["sha"].to_s[0, 8]} #{c["author"]} — #{c["message"]}\n" }
|
|
30
|
+
text += "\nChanged files (#{all_files.size} unique):\n"
|
|
31
|
+
all_files.each { |f| text += " #{f["change_type"]} #{f["path"]}\n" }
|
|
32
|
+
|
|
33
|
+
::MCP::Tool::Response.new([ { type: "text", text: text } ])
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module Crumb
|
|
2
|
+
module MCP
|
|
3
|
+
module Tools
|
|
4
|
+
class DeployDetailsTool < ::MCP::Tool
|
|
5
|
+
tool_name "deploy_details"
|
|
6
|
+
description "Full detail for one deploy: commits, changed files, and optionally the git diff."
|
|
7
|
+
input_schema(
|
|
8
|
+
properties: {
|
|
9
|
+
endpoint: { type: "string", description: "Endpoint slug (required)." },
|
|
10
|
+
id: { type: "integer", description: "Deploy ID." },
|
|
11
|
+
include_diff: { type: "boolean", description: "Include git diff output (slow)." }
|
|
12
|
+
},
|
|
13
|
+
required: [ "endpoint", "id" ]
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
class << self
|
|
17
|
+
def call(endpoint:, id:, include_diff: false, server_context: nil)
|
|
18
|
+
client = ApiClient.for(endpoint)
|
|
19
|
+
deploy = client.detail(id)
|
|
20
|
+
text = format_detail(deploy)
|
|
21
|
+
text += "\n\n" + client.diff(deploy["sha"]) if include_diff
|
|
22
|
+
::MCP::Tool::Response.new([ { type: "text", text: text } ])
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def format_detail(d)
|
|
28
|
+
lines = []
|
|
29
|
+
lines << "Deploy #{d["id"]} on #{d["endpoint"]}"
|
|
30
|
+
lines << "SHA: #{d["sha"]} (prev: #{d["previous_sha"]})"
|
|
31
|
+
lines << "Branch: #{d["branch"]} Author: #{d["author"]}"
|
|
32
|
+
lines << "Status: #{d["status"]} Kind: #{d["kind"]}"
|
|
33
|
+
lines << "Time: #{d["started_at"]} → #{d["finished_at"]} (#{d["duration_seconds"]}s)"
|
|
34
|
+
lines << "Reverts: deploy ##{d["reverts_deploy_id"]}" if d["reverts_deploy_id"]
|
|
35
|
+
lines << ""
|
|
36
|
+
lines << "Commits (#{Array(d["commits"]).size}):"
|
|
37
|
+
Array(d["commits"]).each do |c|
|
|
38
|
+
lines << " #{c["sha"].to_s[0, 8]} #{c["author"]} — #{c["message"]}"
|
|
39
|
+
end
|
|
40
|
+
lines << ""
|
|
41
|
+
lines << "Changed files (#{Array(d["changed_files"]).size}):"
|
|
42
|
+
Array(d["changed_files"]).each do |f|
|
|
43
|
+
lines << " #{f["change_type"]} #{f["path"]}"
|
|
44
|
+
end
|
|
45
|
+
lines.join("\n")
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module Crumb
|
|
2
|
+
module MCP
|
|
3
|
+
module Tools
|
|
4
|
+
class FindDeploysTouchingTool < ::MCP::Tool
|
|
5
|
+
tool_name "find_deploys_touching"
|
|
6
|
+
description "Find deploys that touched files matching a path prefix. Fast via indexed DB query."
|
|
7
|
+
input_schema(
|
|
8
|
+
properties: {
|
|
9
|
+
path_prefix: { type: "string", description: "Path prefix to match (e.g. 'app/models/order')." },
|
|
10
|
+
endpoint: { type: "string", description: "Endpoint slug. Omit to query all endpoints." },
|
|
11
|
+
limit: { type: "integer", description: "Max results per endpoint (default 20)." }
|
|
12
|
+
},
|
|
13
|
+
required: [ "path_prefix" ]
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
class << self
|
|
17
|
+
def call(path_prefix:, endpoint: nil, limit: 20, server_context: nil)
|
|
18
|
+
slugs = endpoint ? [ endpoint ] : Registry.all_slugs
|
|
19
|
+
deploys = []
|
|
20
|
+
errors = []
|
|
21
|
+
|
|
22
|
+
slugs.each do |slug|
|
|
23
|
+
deploys.concat(ApiClient.for(slug).touching(path_prefix, limit: limit))
|
|
24
|
+
rescue => e
|
|
25
|
+
errors << "[#{slug}] error: #{e.message}"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
deploys.sort_by! { |d| d["finished_at"].to_s }.reverse!
|
|
29
|
+
|
|
30
|
+
text =
|
|
31
|
+
if deploys.empty?
|
|
32
|
+
"No deploys found touching '#{path_prefix}'."
|
|
33
|
+
else
|
|
34
|
+
"Deploys touching '#{path_prefix}':\n\n" + deploys.map do |d|
|
|
35
|
+
"[#{d["endpoint"]}] ##{d["id"]} #{d["sha"].to_s[0, 8]} by #{d["author"]} on #{d["finished_at"]}"
|
|
36
|
+
end.join("\n")
|
|
37
|
+
end
|
|
38
|
+
text += "\n\n" + errors.join("\n") unless errors.empty?
|
|
39
|
+
|
|
40
|
+
::MCP::Tool::Response.new([ { type: "text", text: text } ])
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module Crumb
|
|
2
|
+
module MCP
|
|
3
|
+
module Tools
|
|
4
|
+
class RecentDeploysTool < ::MCP::Tool
|
|
5
|
+
tool_name "recent_deploys"
|
|
6
|
+
description "List recent deployments. Omit `endpoint` to query all configured endpoints."
|
|
7
|
+
input_schema(
|
|
8
|
+
properties: {
|
|
9
|
+
endpoint: { type: "string", description: "Endpoint slug (e.g. my-app). Omit for all." },
|
|
10
|
+
limit: { type: "integer", description: "Max results per endpoint (default 20)." }
|
|
11
|
+
}
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
class << self
|
|
15
|
+
def call(endpoint: nil, limit: 20, server_context: nil)
|
|
16
|
+
slugs = endpoint ? [ endpoint ] : Registry.all_slugs
|
|
17
|
+
deploys = []
|
|
18
|
+
errors = []
|
|
19
|
+
|
|
20
|
+
slugs.each do |slug|
|
|
21
|
+
deploys.concat(ApiClient.for(slug).recent(limit: limit))
|
|
22
|
+
rescue => e
|
|
23
|
+
errors << "[#{slug}] error: #{e.message}"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
deploys.sort_by! { |d| d["finished_at"].to_s }.reverse!
|
|
27
|
+
|
|
28
|
+
text = format_deploys(deploys)
|
|
29
|
+
text += "\n\n" + errors.join("\n") unless errors.empty?
|
|
30
|
+
::MCP::Tool::Response.new([ { type: "text", text: text } ])
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
def format_deploys(deploys)
|
|
36
|
+
return "No deployments found." if deploys.empty?
|
|
37
|
+
deploys.map do |d|
|
|
38
|
+
"[#{d["endpoint"]}] ##{d["id"]} #{d["sha"].to_s[0, 8]} — #{d["branch"]} by #{d["author"]} " \
|
|
39
|
+
"(#{d["status"]}, #{d["duration_seconds"]}s) #{d["finished_at"]} " \
|
|
40
|
+
"[#{d["commit_count"]} commits, #{d["changed_file_count"]} files]"
|
|
41
|
+
end.join("\n")
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
data/lib/crumb/mcp.rb
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
require "mcp"
|
|
2
|
+
|
|
3
|
+
require_relative "mcp/version"
|
|
4
|
+
require_relative "mcp/registry"
|
|
5
|
+
require_relative "mcp/api_client"
|
|
6
|
+
require_relative "mcp/tools/recent_deploys"
|
|
7
|
+
require_relative "mcp/tools/deploy_details"
|
|
8
|
+
require_relative "mcp/tools/compare_deploys"
|
|
9
|
+
require_relative "mcp/tools/find_deploys_touching"
|
data/lib/crumb-mcp.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require_relative "crumb/mcp"
|
metadata
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: crumb-mcp
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Nico Galdamez
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: mcp
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0.8'
|
|
19
|
+
- - ">="
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: 0.8.0
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - "~>"
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: '0.8'
|
|
29
|
+
- - ">="
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: 0.8.0
|
|
32
|
+
- !ruby/object:Gem::Dependency
|
|
33
|
+
name: faraday
|
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - "~>"
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '2.0'
|
|
39
|
+
type: :runtime
|
|
40
|
+
prerelease: false
|
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
42
|
+
requirements:
|
|
43
|
+
- - "~>"
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '2.0'
|
|
46
|
+
description: Standalone MCP server that federates across Crumb-enabled endpoints and
|
|
47
|
+
exposes deploy history as LLM tools.
|
|
48
|
+
email:
|
|
49
|
+
- nicogaldamez@gmail.com
|
|
50
|
+
executables:
|
|
51
|
+
- crumb-mcp
|
|
52
|
+
extensions: []
|
|
53
|
+
extra_rdoc_files: []
|
|
54
|
+
files:
|
|
55
|
+
- LICENSE
|
|
56
|
+
- README.md
|
|
57
|
+
- exe/crumb-mcp
|
|
58
|
+
- lib/crumb-mcp.rb
|
|
59
|
+
- lib/crumb/mcp.rb
|
|
60
|
+
- lib/crumb/mcp/api_client.rb
|
|
61
|
+
- lib/crumb/mcp/registry.rb
|
|
62
|
+
- lib/crumb/mcp/tools/compare_deploys.rb
|
|
63
|
+
- lib/crumb/mcp/tools/deploy_details.rb
|
|
64
|
+
- lib/crumb/mcp/tools/find_deploys_touching.rb
|
|
65
|
+
- lib/crumb/mcp/tools/recent_deploys.rb
|
|
66
|
+
- lib/crumb/mcp/version.rb
|
|
67
|
+
homepage: https://github.com/nicogaldamez/crumb
|
|
68
|
+
licenses:
|
|
69
|
+
- MIT
|
|
70
|
+
metadata:
|
|
71
|
+
homepage_uri: https://github.com/nicogaldamez/crumb
|
|
72
|
+
source_code_uri: https://github.com/nicogaldamez/crumb/tree/main/mcp
|
|
73
|
+
changelog_uri: https://github.com/nicogaldamez/crumb/blob/main/mcp/CHANGELOG.md
|
|
74
|
+
rubygems_mfa_required: 'true'
|
|
75
|
+
rdoc_options: []
|
|
76
|
+
require_paths:
|
|
77
|
+
- lib
|
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '3.0'
|
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
|
+
requirements:
|
|
85
|
+
- - ">="
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: '0'
|
|
88
|
+
requirements: []
|
|
89
|
+
rubygems_version: 3.7.2
|
|
90
|
+
specification_version: 4
|
|
91
|
+
summary: MCP server for Crumb deployment observability.
|
|
92
|
+
test_files: []
|