Skip to main content
Glama
Cicatriiz

Civitai MCP Server

get_download_url

Retrieve the download URL for a specific AI model version by providing its ID, enabling direct access to the model file on Civitai's platform via the MCP server.

Instructions

Get the download URL for a specific model version

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelVersionIdYesThe ID of the model version to get download URL for

Implementation Reference

  • The primary handler function for the 'get_download_url' MCP tool. It extracts the modelVersionId from arguments, retrieves the download URL via the CivitaiClient, and returns a formatted text response with the URL and download instructions.
    private async getDownloadUrl(args: any) {
      const { modelVersionId } = args;
      const downloadUrl = this.client.getDownloadUrl(modelVersionId);
      
      return {
        content: [
          {
            type: 'text',
            text: `Download URL for model version ${modelVersionId}:\\n\\n${downloadUrl}\\n\\n` +
              `**Note:** Use \`wget "${downloadUrl}" --content-disposition\` to download with proper filename.\\n` +
              `If the model requires authentication, add your API key: \`?token=YOUR_API_KEY\``,
          },
        ],
      };
    }
  • src/index.ts:313-323 (registration)
    The tool registration entry in the getTools() method, defining the name 'get_download_url', description, and input schema (requiring modelVersionId as number).
    {
      name: 'get_download_url',
      description: 'Get the download URL for a specific model version',
      inputSchema: {
        type: 'object',
        properties: {
          modelVersionId: { type: 'number', description: 'The ID of the model version to get download URL for' },
        },
        required: ['modelVersionId'],
      },
    },
  • The input schema for the get_download_url tool, specifying an object with required 'modelVersionId' property of type number.
    inputSchema: {
      type: 'object',
      properties: {
        modelVersionId: { type: 'number', description: 'The ID of the model version to get download URL for' },
      },
      required: ['modelVersionId'],
    },
  • Supporting helper method in CivitaiClient that generates the actual download URL by calling buildUrl with the model version endpoint.
    getDownloadUrl(modelVersionId: number): string {
      return this.buildUrl(`/download/models/${modelVersionId}`);
    }

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/Cicatriiz/civitai-mcp-server'

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