MCP Server Info Bot (DEPRECATED) workflow (pathintegral-institute/mcpm.sh)
The MCP Server Info Bot (DEPRECATED) workflow from pathintegral-institute/mcpm.sh, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get caching, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the MCP Server Info Bot (DEPRECATED) workflow from the pathintegral-institute/mcpm.sh repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: MCP Server Info Bot (DEPRECATED)
permissions:
contents: write
pull-requests: write
issues: write
on:
workflow_dispatch:
inputs:
force_run:
description: 'Force run this deprecated workflow (not recommended)'
required: true
default: 'false'
jobs:
scrape-and-update:
runs-on: ubuntu-latest
if: github.event.inputs.force_run == 'true' && false # Disable this deprecated workflow
steps:
- name: Check if user is a maintainer
uses: actions/github-script@v6
id: check-maintainer
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const sender = context.payload.sender.login;
const { owner, repo } = context.repo;
try {
// Check if user has write access (maintainer or higher)
const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({
owner: owner,
repo: repo,
username: sender
});
const hasWriteAccess = ['admin', 'maintain', 'write'].includes(permission.permission);
if (hasWriteAccess) {
console.log(`β
User ${sender} is a maintainer with ${permission.permission} permissions`);
return true;
} else {
console.log(`β User ${sender} does not have sufficient permissions (${permission.permission})`);
return false;
}
} catch (error) {
console.log(`Error checking permissions: ${error.message}`);
return false;
}
- name: Fail if not maintainer
if: steps.check-maintainer.outputs.result != 'true'
run: |
echo "User ${{ github.event.sender.login }} does not have maintainer permissions"
exit 1
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests openai jsonschema mcp loguru pydantic ruamel-yaml
- name: Create local directory
run: mkdir -p local
- name: Extract repository URL from issue body
id: extract_url
env:
ISSUE_BODY: ${{ github.event.issue.body }}
run: |
# Extract the repository URL from the structured template format
# Look for the URL between "GitHub Repository URL" and "Description" sections
REPO_URL=$(echo "$ISSUE_BODY" | sed -n '/GitHub Repository URL/,/Description/p' | grep "https://" | head -n 1 | xargs)
# If that doesn't work, try a simpler approach as fallback
if [ -z "$REPO_URL" ]; then
REPO_URL=$(echo "$ISSUE_BODY" | grep -o "https://github.com[^ ]*" | head -n 1 | xargs)
fi
# Make sure we have the full URL (no truncation)
echo "Raw Repository URL: $REPO_URL"
# Set outputs for use in later steps
echo "repo_url=$REPO_URL" >> $GITHUB_OUTPUT
- name: Run Script with Extracted URL
id: run_script
env:
REPO_URL: ${{ steps.extract_url.outputs.repo_url }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
shell: /usr/bin/bash -e {0}
continue-on-error: true
run: |
echo "Running get_manifest.py with repository URL: $REPO_URL"
mkdir -p local
if python scripts/get_manifest.py "$REPO_URL"; then
echo "script_success=true" >> $GITHUB_OUTPUT
else
echo "script_success=false" >> $GITHUB_OUTPUT
fi
- name: Comment on issue
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue_number = context.issue.number;
const run_id = context.runId;
const repo = context.repo;
const run_url = `https://github.com/${repo.owner}/${repo.repo}/actions/runs/${run_id}`;
await github.rest.issues.createComment({
owner: repo.owner,
repo: repo.repo,
issue_number: issue_number,
body: `π€ Processing your MCP server submission...\n\nTrack progress here: [GitHub Action Run #${run_id}](${run_url})`
});
- name: Create and push new branch
if: steps.run_script.outputs.script_success == 'true'
env:
ISSUE_NUMBER: ${{ github.event.issue.number }}
shell: /usr/bin/bash -e {0}
run: |
# Create a unique branch name with issue number
BRANCH_NAME="scrape-issue-$ISSUE_NUMBER"
git config user.name "GitHub Action"
git config user.email "action@github.com"
git checkout -b "$BRANCH_NAME"
git add -f local/ mcp-registry/ # Add all files generated by the script
git commit -m "Update repo with server manifest from issue #$ISSUE_NUMBER" || echo "No changes to commit"
git push origin "$BRANCH_NAME" --force # Push to the new branch
echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV
- name: Comment on issue with success
if: steps.run_script.outputs.script_success == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue_number = context.issue.number;
const repo = context.repo;
const branch_name = process.env.branch_name;
// Generate direct PR creation URL
const pr_title = encodeURIComponent(`chore: Add server from issue #${issue_number}`);
const pr_url = `https://github.com/${repo.owner}/${repo.repo}/compare/main...${branch_name}?quick_pull=1&title=${pr_title}`;
await github.rest.issues.createComment({
owner: repo.owner,
repo: repo.repo,
issue_number: issue_number,
body: `β
Processing complete!\n\nClick here to create the pull request with one click: [Create PR](${pr_url})`
});
- name: Comment on issue with failure
if: steps.run_script.outputs.script_success == 'false'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue_number = context.issue.number;
const repo = context.repo;
const run_id = context.runId;
const run_url = `https://github.com/${repo.owner}/${repo.repo}/actions/runs/${run_id}`;
await github.rest.issues.createComment({
owner: repo.owner,
repo: repo.repo,
issue_number: issue_number,
body: `β Failed to process the server manifest. Please check the [action logs](${run_url}) for details.`
});
The same workflow, on Latchkey
Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.
name: MCP Server Info Bot (DEPRECATED) permissions: contents: write pull-requests: write issues: write on: workflow_dispatch: inputs: force_run: description: 'Force run this deprecated workflow (not recommended)' required: true default: 'false' jobs: scrape-and-update: timeout-minutes: 30 runs-on: latchkey-small if: github.event.inputs.force_run == 'true' && false # Disable this deprecated workflow steps: - name: Check if user is a maintainer uses: actions/github-script@v6 id: check-maintainer with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const sender = context.payload.sender.login; const { owner, repo } = context.repo; try { // Check if user has write access (maintainer or higher) const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({ owner: owner, repo: repo, username: sender }); const hasWriteAccess = ['admin', 'maintain', 'write'].includes(permission.permission); if (hasWriteAccess) { console.log(`β User ${sender} is a maintainer with ${permission.permission} permissions`); return true; } else { console.log(`β User ${sender} does not have sufficient permissions (${permission.permission})`); return false; } } catch (error) { console.log(`Error checking permissions: ${error.message}`); return false; } - name: Fail if not maintainer if: steps.check-maintainer.outputs.result != 'true' run: | echo "User ${{ github.event.sender.login }} does not have maintainer permissions" exit 1 - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: cache: 'pip' python-version: '3.13' - name: Install dependencies run: | python -m pip install --upgrade pip pip install requests openai jsonschema mcp loguru pydantic ruamel-yaml - name: Create local directory run: mkdir -p local - name: Extract repository URL from issue body id: extract_url env: ISSUE_BODY: ${{ github.event.issue.body }} run: | # Extract the repository URL from the structured template format # Look for the URL between "GitHub Repository URL" and "Description" sections REPO_URL=$(echo "$ISSUE_BODY" | sed -n '/GitHub Repository URL/,/Description/p' | grep "https://" | head -n 1 | xargs) # If that doesn't work, try a simpler approach as fallback if [ -z "$REPO_URL" ]; then REPO_URL=$(echo "$ISSUE_BODY" | grep -o "https://github.com[^ ]*" | head -n 1 | xargs) fi # Make sure we have the full URL (no truncation) echo "Raw Repository URL: $REPO_URL" # Set outputs for use in later steps echo "repo_url=$REPO_URL" >> $GITHUB_OUTPUT - name: Run Script with Extracted URL id: run_script env: REPO_URL: ${{ steps.extract_url.outputs.repo_url }} OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} shell: /usr/bin/bash -e {0} continue-on-error: true run: | echo "Running get_manifest.py with repository URL: $REPO_URL" mkdir -p local if python scripts/get_manifest.py "$REPO_URL"; then echo "script_success=true" >> $GITHUB_OUTPUT else echo "script_success=false" >> $GITHUB_OUTPUT fi - name: Comment on issue uses: actions/github-script@v6 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const issue_number = context.issue.number; const run_id = context.runId; const repo = context.repo; const run_url = `https://github.com/${repo.owner}/${repo.repo}/actions/runs/${run_id}`; await github.rest.issues.createComment({ owner: repo.owner, repo: repo.repo, issue_number: issue_number, body: `π€ Processing your MCP server submission...\n\nTrack progress here: [GitHub Action Run #${run_id}](${run_url})` }); - name: Create and push new branch if: steps.run_script.outputs.script_success == 'true' env: ISSUE_NUMBER: ${{ github.event.issue.number }} shell: /usr/bin/bash -e {0} run: | # Create a unique branch name with issue number BRANCH_NAME="scrape-issue-$ISSUE_NUMBER" git config user.name "GitHub Action" git config user.email "action@github.com" git checkout -b "$BRANCH_NAME" git add -f local/ mcp-registry/ # Add all files generated by the script git commit -m "Update repo with server manifest from issue #$ISSUE_NUMBER" || echo "No changes to commit" git push origin "$BRANCH_NAME" --force # Push to the new branch echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV - name: Comment on issue with success if: steps.run_script.outputs.script_success == 'true' uses: actions/github-script@v6 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const issue_number = context.issue.number; const repo = context.repo; const branch_name = process.env.branch_name; // Generate direct PR creation URL const pr_title = encodeURIComponent(`chore: Add server from issue #${issue_number}`); const pr_url = `https://github.com/${repo.owner}/${repo.repo}/compare/main...${branch_name}?quick_pull=1&title=${pr_title}`; await github.rest.issues.createComment({ owner: repo.owner, repo: repo.repo, issue_number: issue_number, body: `β Processing complete!\n\nClick here to create the pull request with one click: [Create PR](${pr_url})` }); - name: Comment on issue with failure if: steps.run_script.outputs.script_success == 'false' uses: actions/github-script@v6 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const issue_number = context.issue.number; const repo = context.repo; const run_id = context.runId; const run_url = `https://github.com/${repo.owner}/${repo.repo}/actions/runs/${run_id}`; await github.rest.issues.createComment({ owner: repo.owner, repo: repo.repo, issue_number: issue_number, body: `β Failed to process the server manifest. Please check the [action logs](${run_url}) for details.` });
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.