This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const buildEndpointDescription = (endpoint) => { | |
| const parts = [ | |
| `## ${endpoint.id}`, | |
| `${endpoint.method} ${endpoint.path}`, | |
| endpoint.summary, | |
| endpoint.description, | |
| ].filter(Boolean); | |
| if (endpoint.parameters.length > 0) { | |
| parts.push('\nParameters:', ...endpoint.parameters.map(parameter => ` - ${parameter}`)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const buildToolDescription = (resource, endpoints, operations) => { | |
| const endpointDescriptions = endpoints.map(buildEndpointDescription).join('\n'); | |
| return [ | |
| `Operations for ${resource} resource:\n`, | |
| endpointDescriptions, | |
| '\nUsage:', | |
| `- Set "operation" to one of: ${operations.join(', ')}`, | |
| '- Set "parameters" object with path/query/header parameters as needed', | |
| '- Set "body" object with request body data as needed', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const createResourceTool = (resource, endpoints, baseUrl) => { | |
| const operations = endpoints.map(endpoint => endpoint.id); | |
| return { | |
| name: `${resource}_operations`, | |
| description: buildToolDescription(resource, endpoints, operations), | |
| parameters: z.object({ | |
| operation: z.enum(operations), | |
| parameters: z.record(z.any()).optional(), | |
| body: z.record(z.any()).optional(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const groupEndpoints = (spec) => { | |
| const groups = new Map(); | |
| Object.entries(spec.paths || {}).forEach(([path, methods]) => { | |
| const resource = path.split('/').filter(Boolean)[0] || 'root'; | |
| if (!groups.has(resource)) { | |
| groups.set(resource, []); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function main() { | |
| const spec = await loadSpec(CONFIG.specPath); | |
| const baseUrl = spec.servers?.[0]?.url || ''; | |
| const groups = groupEndpoints(spec); | |
| const mcp = new FastMCP({ | |
| name: 'mcp-example', | |
| version: '1.0.0', | |
| }); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM k8s.gcr.io/kustomize/kustomize:v3.8.7 | |
| RUN apk update && apk add --no-cache git | |
| COPY entrypoint.sh /entrypoint.sh | |
| RUN chmod +x /entrypoint.sh | |
| ENTRYPOINT ["/entrypoint.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Update Kustomize Image" | |
| description: "Updates a Kubernetes image reference in a kustomization.yaml file and commits the change." | |
| inputs: | |
| path: | |
| description: "Path to the directory containing the kustomization.yaml file." | |
| required: true | |
| new-image-service: | |
| description: "The logical name of the image as referenced in Kustomize (the key before =)." | |
| required: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| set -euo pipefail | |
| # Usage: script.sh <path> <image_name> <image_repo> <version> | |
| if [ "$#" -ne 4 ]; then | |
| echo "Usage: $0 <path> <image_name> <image_repo> <version>" | |
| exit 1 | |
| fi | |
| TARGET_DIR="$1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: kustomize.config.k8s.io/v1beta1 | |
| kind: Kustomization | |
| namespace: services | |
| resources: | |
| - ingress.yaml | |
| - deployment.yaml | |
| images: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiVersion: kustomize.config.k8s.io/v1beta1 | |
| kind: Kustomization | |
| resources: | |
| - ./apps/simple-api/prod |
NewerOlder