Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
160 lines (150 loc) · 5.91 KB
/
Copy pathaction.yml
File metadata and controls
160 lines (150 loc) · 5.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: "MCP Discovery Action"
author: "Ali Hashemi"
description: "A GitHub Action to run the mcp-discovery CLI for printing, creating, or updating MCP server capability details"
inputs:
token:
description: "GitHub token used for creating or updating output files containing MCP server capabilities. Defaults to the built-in secrets.GITHUB_TOKEN."
required: false
default: ${{ github.token }}
command:
description: "CLI command to run (print, create, or update)"
required: true
mcp-launch-command:
description: "Command and arguments to launch the MCP server (e.g., rust-mcp-filesystem . ). Mutually exclusive with url."
required: false
url:
description: "URL of a remote streamable HTTP MCP server. Mutually exclusive with mcp-launch-command."
required: false
header:
description: "Static HTTP header(s) to send with streamable HTTP requests, one 'Name: Value' per line (repeatable)."
required: false
client-id:
description: "Pre-registered OAuth client id (omit to use dynamic client registration)."
required: false
client-secret:
description: "Pre-registered OAuth client secret."
required: false
scope:
description: "OAuth scope(s) to request."
required: false
redirect-uri:
description: "Redirect URI used by the authorization-code flow."
required: false
grant:
description: "OAuth grant type (client-credentials or authorization-code)."
required: false
filename:
description: "Output file path for create/update commands"
default: "mcp-discovery.md"
required: false
template:
description: "Built-in template for output (md, md-plain, html, txt)"
required: false
template-file:
description: "Path to a custom Handlebars template file or folder"
required: false
template-string:
description: "Custom Handlebars template content as a string"
required: false
template-url:
description: "Remote Handlebars template URL (.hbs, .zip, or .tar.gz)"
required: false
cache-dir:
description: "Cache directory for templates fetched with template-url"
required: false
log-level:
description: "Specifies the logging level for the CLI (default: info)"
default: "info"
required: false
version:
description: "CLI version (e.g., latest or v0.1.2)"
required: true
default: "latest"
runs:
using: "composite"
steps:
- name: Set mcp-discovery CLI version
id: set-url
shell: bash
run: |
if [ "${{ inputs.version }}" = "latest" ]; then
echo "INSTALLER_URL=https://github.com/rust-mcp-stack/mcp-discovery/releases/latest/download/mcp-discovery-installer.sh" >> $GITHUB_ENV
else
echo "INSTALLER_URL=https://github.com/rust-mcp-stack/mcp-discovery/releases/download/${{ inputs.version }}/mcp-discovery-installer.sh" >> $GITHUB_ENV
fi
- name: Install mcp-discovery CLI
shell: bash
run: |
curl --proto '=https' --tlsv1.2 -LsSf $INSTALLER_URL | sh
- name: Run mcp-discovery CLI
shell: bash
env:
CLI_COMMAND: ${{ inputs.command }}
MCP_LAUNCH_COMMAND: ${{ inputs.mcp-launch-command }}
URL: ${{ inputs.url }}
HEADER: ${{ inputs.header }}
CLIENT_ID: ${{ inputs.client-id }}
CLIENT_SECRET: ${{ inputs.client-secret }}
SCOPE: ${{ inputs.scope }}
REDIRECT_URI: ${{ inputs.redirect-uri }}
GRANT: ${{ inputs.grant }}
FILENAME: ${{ inputs.filename }}
TEMPLATE: ${{ inputs.template }}
TEMPLATE_FILE: ${{ inputs.template-file }}
TEMPLATE_STRING: ${{ inputs.template-string }}
TEMPLATE_URL: ${{ inputs.template-url }}
CACHE_DIR: ${{ inputs.cache-dir }}
LOG_LEVEL: ${{ inputs.log-level }}
run: |
set -euo pipefail
args=()
if [ "$CLI_COMMAND" = "create" ] || [ "$CLI_COMMAND" = "update" ]; then
if [ -n "$FILENAME" ]; then
args+=("--filename" "$FILENAME")
fi
fi
[ -n "$TEMPLATE" ] && args+=("--template" "$TEMPLATE")
[ -n "$TEMPLATE_FILE" ] && args+=("--template-file" "$GITHUB_WORKSPACE/$TEMPLATE_FILE")
[ -n "$TEMPLATE_STRING" ] && args+=("--template-string" "$TEMPLATE_STRING")
[ -n "$TEMPLATE_URL" ] && args+=("--template-url" "$TEMPLATE_URL")
[ -n "$CACHE_DIR" ] && args+=("--cache-dir" "$CACHE_DIR")
[ -n "$LOG_LEVEL" ] && args+=("--log-level" "$LOG_LEVEL")
if [ -n "$URL" ]; then
args+=("--url" "$URL")
if [ -n "$HEADER" ]; then
while IFS= read -r line; do
[ -n "$line" ] && args+=("--header" "$line")
done <<< "$HEADER"
fi
[ -n "$CLIENT_ID" ] && args+=("--client-id" "$CLIENT_ID")
[ -n "$CLIENT_SECRET" ] && args+=("--client-secret" "$CLIENT_SECRET")
[ -n "$SCOPE" ] && args+=("--scope" "$SCOPE")
[ -n "$REDIRECT_URI" ] && args+=("--redirect-uri" "$REDIRECT_URI")
[ -n "$GRANT" ] && args+=("--grant" "$GRANT")
fi
if [ -n "$MCP_LAUNCH_COMMAND" ]; then
echo "Running: mcp-discovery $CLI_COMMAND ${args[*]} -- $MCP_LAUNCH_COMMAND"
mcp-discovery "$CLI_COMMAND" "${args[@]}" -- $MCP_LAUNCH_COMMAND
else
echo "Running: mcp-discovery $CLI_COMMAND ${args[*]}"
mcp-discovery "$CLI_COMMAND" "${args[@]}"
fi
- name: Commit changes
if: ${{ (inputs.command == 'create' || inputs.command == 'update') && inputs.filename != '' }}
shell: bash
env:
FILENAME: ${{ inputs.filename }}
GITHUB_TOKEN: ${{ inputs.token }}
run: |
git config user.name "GitHub Action"
git config user.email "action@github.com"
git add "$FILENAME"
if git diff --staged --quiet; then
echo "No changes to $FILENAME"
else
git commit -m "${{ inputs.command }} $FILENAME via mcp-discovery"
git push
fi
branding:
icon: "aperture"
color: "purple"