Skip to main content
Glama
AlexW00

ArtifactHub MCP Server

by AlexW00

helm-chart-values

Retrieve the values.yaml configuration file for a specific Helm chart from Artifact Hub to customize deployments.

Instructions

Get the values.yaml file for a specific Helm chart from Artifact Hub

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chartRepoYesThe Helm chart repository name
chartNameYesThe Helm chart name
versionNoThe chart version (optional, defaults to latest)

Implementation Reference

  • Handler function that fetches the Helm chart's values.yaml from Artifact Hub by first getting chart info, determining version, retrieving values, and returning as text content or error message.
    async ({ chartRepo, chartName, version }: ValuesParams) => {
    	try {
    		let packageId: string;
    		let chartVersion: string;
    
    		// First get the chart info
    		const chartInfo = await getChartInfo(chartRepo, chartName);
    		packageId = chartInfo.package_id;
    
    		// If version is not provided, use the latest version
    		chartVersion = version || chartInfo.version;
    
    		// Get the values.yaml
    		const valuesYaml = await getChartValues(packageId, chartVersion);
    
    		return {
    			content: [
    				{
    					type: "text",
    					text: valuesYaml,
    				},
    			],
    		};
    	} catch (error) {
    		return {
    			content: [
    				{
    					type: "text",
    					text: `Error retrieving values.yaml: ${(error as Error).message}`,
    				},
    			],
    		};
    	}
    }
  • Zod input schema defining parameters: chartRepo (string), chartName (string), version (optional string).
    {
    	chartRepo: z.string().describe("The Helm chart repository name"),
    	chartName: z.string().describe("The Helm chart name"),
    	version: z
    		.string()
    		.optional()
    		.describe("The chart version (optional, defaults to latest)"),
    },
  • Function that registers the 'helm-chart-values' tool with the MCP server, specifying name, description, input schema, and handler.
    export function registerValuesTool(server: McpServer) {
    	return server.tool(
    		"helm-chart-values",
    		"Get the values.yaml file for a specific Helm chart from Artifact Hub",
    		{
    			chartRepo: z.string().describe("The Helm chart repository name"),
    			chartName: z.string().describe("The Helm chart name"),
    			version: z
    				.string()
    				.optional()
    				.describe("The chart version (optional, defaults to latest)"),
    		},
    		async ({ chartRepo, chartName, version }: ValuesParams) => {
    			try {
    				let packageId: string;
    				let chartVersion: string;
    
    				// First get the chart info
    				const chartInfo = await getChartInfo(chartRepo, chartName);
    				packageId = chartInfo.package_id;
    
    				// If version is not provided, use the latest version
    				chartVersion = version || chartInfo.version;
    
    				// Get the values.yaml
    				const valuesYaml = await getChartValues(packageId, chartVersion);
    
    				return {
    					content: [
    						{
    							type: "text",
    							text: valuesYaml,
    						},
    					],
    				};
    			} catch (error) {
    				return {
    					content: [
    						{
    							type: "text",
    							text: `Error retrieving values.yaml: ${(error as Error).message}`,
    						},
    					],
    				};
    			}
    		}
    	);
    }
  • src/index.ts:18-18 (registration)
    Invokes registerValuesTool to add the tool to the main MCP server instance.
    registerValuesTool(server);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AlexW00/artifacthub-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server