Add plugin builder for one-file client install

plugin/make-plugin.{sh,ps1} stamp a user's own Freshservice API key and the
shared server token into a template and emit a personalized freshservice.plugin
(direct HTTP MCP connection — no Node/mcp-remote/config editing on clients).
Built plugins embed credentials, so *.plugin is git-ignored; the committed
template holds only placeholders. Validated with 'claude plugin validate'.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-10 08:39:27 -06:00
parent 4f9a862c25
commit 549a1b6879
7 changed files with 195 additions and 0 deletions

55
plugin/make-plugin.sh Executable file
View File

@@ -0,0 +1,55 @@
#!/usr/bin/env bash
# Build a personalized freshservice.plugin for Claude Desktop / Cowork.
#
# Each person runs this ONCE with their own Freshservice API key. The output
# .plugin file contains your key — do not share it.
#
# Usage (interactive):
# ./make-plugin.sh
# Or non-interactive:
# FS_KEY=... MCP_TOKEN=... ./make-plugin.sh
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TEMPLATE="$SCRIPT_DIR/template"
SERVER_URL="${SERVER_URL:-http://192.168.101.12:3839/mcp}"
FS_DOMAIN="${FS_DOMAIN:-pesco.freshservice.com}"
if [ -z "${FS_KEY:-}" ]; then
printf "Your Freshservice API key (Freshservice → profile picture → Profile settings → API key): "
read -r FS_KEY
fi
if [ -z "${MCP_TOKEN:-}" ]; then
printf "Shared MCP server token (ask IT / Spencer): "
read -r MCP_TOKEN
fi
[ -n "$FS_KEY" ] || { echo "ERROR: API key is required." >&2; exit 1; }
[ -n "$MCP_TOKEN" ] || { echo "ERROR: MCP token is required." >&2; exit 1; }
BUILD="$(mktemp -d)"
trap 'rm -rf "$BUILD"' EXIT
cp -R "$TEMPLATE/." "$BUILD/"
# Stamp placeholders using bash substitution (safe for special characters).
for f in "$BUILD/.mcp.json"; do
content="$(cat "$f")"
content="${content//__SERVER_URL__/$SERVER_URL}"
content="${content//__FS_DOMAIN__/$FS_DOMAIN}"
content="${content//__FS_KEY__/$FS_KEY}"
content="${content//__MCP_TOKEN__/$MCP_TOKEN}"
printf '%s' "$content" > "$f"
done
# Sanity check: no placeholders left anywhere.
if grep -rq "__[A-Z_]*__" "$BUILD"; then
echo "ERROR: unfilled placeholders remain; aborting." >&2
exit 1
fi
OUT="$SCRIPT_DIR/freshservice.plugin"
rm -f "$OUT"
(cd "$BUILD" && zip -r -q "$OUT" . -x "*.DS_Store")
echo "Built: $OUT"
echo "Install it in Claude Desktop (Cowork → Customize → add plugin), then start a new chat."
echo "REMINDER: this file contains your personal API key — don't share it."