Skip to main content
Glama

升级 MCP 工具

gitea_mcp_upgrade

Upgrade the Gitea MCP server to the latest version by downloading and installing from the most recent release, with optional auto-confirmation.

Instructions

Upgrade Gitea MCP tool to the latest version. Downloads and installs from the latest release.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
auto_confirmNoAuto confirm the upgrade without prompting (default: false)

Implementation Reference

  • The handler function for the 'gitea_mcp_upgrade' tool. It checks current version, optionally elicits confirmation, downloads and executes an upgrade script from a remote URL, and returns success/error response.
      async (args) => {
        logger.debug({ args }, 'gitea_mcp_upgrade called');
    
        try {
          const fs = await import('fs');
          const path = await import('path');
          const { execSync } = await import('child_process');
    
          // 读取当前版本
          const packageJsonPath = path.join(process.cwd(), 'package.json');
          let currentVersion = '1.2.0'; // 默认版本
    
          if (fs.existsSync(packageJsonPath)) {
            const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
            currentVersion = packageJson.version;
          }
    
          // 如果没有自动确认,使用 elicitation 询问用户
          if (!args.auto_confirm) {
            const result = await ctx.server.server.elicitInput({
              message: `当前版本: v${currentVersion}\n\n是否要升级到最新版本?\n\n升级过程将:\n1. 下载最新版本的发布包\n2. 安装到 ~/.gitea-mcp 目录\n3. 自动安装依赖\n\n注意:升级过程中需要保证网络连接稳定。`,
              requestedSchema: {
                type: 'object',
                properties: {
                  confirm: {
                    type: 'boolean',
                    title: '确认升级',
                    description: '是否继续升级?',
                    default: false,
                  },
                },
                required: ['confirm'],
              },
            });
    
            if (result.action !== 'accept' || !result.content?.confirm) {
              return {
                content: [
                  {
                    type: 'text',
                    text: 'Upgrade cancelled by user',
                  },
                ],
              };
            }
          }
    
          // 执行升级
          const installScriptUrl =
            'https://gitea.ktyun.cc/Kysion/entai-gitea-mcp/raw/branch/main/install-quick.sh';
    
          logger.info('Downloading and executing upgrade script...');
    
          // 下载并执行安装脚本
          const command = `bash -c "$(curl -fsSL ${installScriptUrl})"`;
    
          const output = execSync(command, {
            encoding: 'utf-8',
            stdio: 'pipe',
            maxBuffer: 10 * 1024 * 1024, // 10MB buffer
          });
    
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(
                  {
                    success: true,
                    message: 'Upgrade completed successfully',
                    currentVersion: `v${currentVersion}`,
                    output: output.substring(0, 1000), // 限制输出长度
                    note: 'Please restart your MCP client to use the new version',
                  },
                  null,
                  2
                ),
              },
            ],
          };
        } catch (error: unknown) {
          const errorMessage = error instanceof Error ? error.message : String(error);
          logger.error({ error: errorMessage }, 'Failed to upgrade MCP tool');
          return {
            content: [
              {
                type: 'text',
                text: JSON.stringify(
                  {
                    success: false,
                    error: errorMessage,
                    message: 'Upgrade failed',
                    fallback: 'You can manually upgrade by running: bash <(curl -fsSL https://gitea.ktyun.cc/Kysion/entai-gitea-mcp/raw/branch/main/install-quick.sh)',
                  },
                  null,
                  2
                ),
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Input schema for the 'gitea_mcp_upgrade' tool, defining optional 'auto_confirm' boolean parameter.
    {
      title: '升级 MCP 工具',
      description:
        'Upgrade Gitea MCP tool to the latest version. Downloads and installs from the latest release.',
      inputSchema: z.object({
        auto_confirm: z
          .boolean()
          .optional()
          .describe('Auto confirm the upgrade without prompting (default: false)'),
      }),
    },
  • src/index.ts:358-476 (registration)
    Registration of the 'gitea_mcp_upgrade' tool using mcpServer.registerTool, including name, schema, and inline handler within registerInitTools function.
      // gitea_mcp_upgrade - MCP 工具升级
      mcpServer.registerTool(
        'gitea_mcp_upgrade',
        {
          title: '升级 MCP 工具',
          description:
            'Upgrade Gitea MCP tool to the latest version. Downloads and installs from the latest release.',
          inputSchema: z.object({
            auto_confirm: z
              .boolean()
              .optional()
              .describe('Auto confirm the upgrade without prompting (default: false)'),
          }),
        },
        async (args) => {
          logger.debug({ args }, 'gitea_mcp_upgrade called');
    
          try {
            const fs = await import('fs');
            const path = await import('path');
            const { execSync } = await import('child_process');
    
            // 读取当前版本
            const packageJsonPath = path.join(process.cwd(), 'package.json');
            let currentVersion = '1.2.0'; // 默认版本
    
            if (fs.existsSync(packageJsonPath)) {
              const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
              currentVersion = packageJson.version;
            }
    
            // 如果没有自动确认,使用 elicitation 询问用户
            if (!args.auto_confirm) {
              const result = await ctx.server.server.elicitInput({
                message: `当前版本: v${currentVersion}\n\n是否要升级到最新版本?\n\n升级过程将:\n1. 下载最新版本的发布包\n2. 安装到 ~/.gitea-mcp 目录\n3. 自动安装依赖\n\n注意:升级过程中需要保证网络连接稳定。`,
                requestedSchema: {
                  type: 'object',
                  properties: {
                    confirm: {
                      type: 'boolean',
                      title: '确认升级',
                      description: '是否继续升级?',
                      default: false,
                    },
                  },
                  required: ['confirm'],
                },
              });
    
              if (result.action !== 'accept' || !result.content?.confirm) {
                return {
                  content: [
                    {
                      type: 'text',
                      text: 'Upgrade cancelled by user',
                    },
                  ],
                };
              }
            }
    
            // 执行升级
            const installScriptUrl =
              'https://gitea.ktyun.cc/Kysion/entai-gitea-mcp/raw/branch/main/install-quick.sh';
    
            logger.info('Downloading and executing upgrade script...');
    
            // 下载并执行安装脚本
            const command = `bash -c "$(curl -fsSL ${installScriptUrl})"`;
    
            const output = execSync(command, {
              encoding: 'utf-8',
              stdio: 'pipe',
              maxBuffer: 10 * 1024 * 1024, // 10MB buffer
            });
    
            return {
              content: [
                {
                  type: 'text',
                  text: JSON.stringify(
                    {
                      success: true,
                      message: 'Upgrade completed successfully',
                      currentVersion: `v${currentVersion}`,
                      output: output.substring(0, 1000), // 限制输出长度
                      note: 'Please restart your MCP client to use the new version',
                    },
                    null,
                    2
                  ),
                },
              ],
            };
          } catch (error: unknown) {
            const errorMessage = error instanceof Error ? error.message : String(error);
            logger.error({ error: errorMessage }, 'Failed to upgrade MCP tool');
            return {
              content: [
                {
                  type: 'text',
                  text: JSON.stringify(
                    {
                      success: false,
                      error: errorMessage,
                      message: 'Upgrade failed',
                      fallback: 'You can manually upgrade by running: bash <(curl -fsSL https://gitea.ktyun.cc/Kysion/entai-gitea-mcp/raw/branch/main/install-quick.sh)',
                    },
                    null,
                    2
                  ),
                },
              ],
              isError: true,
            };
          }
        }
      );
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions downloading and installing, implying a mutation that modifies the system, but fails to disclose critical behavioral traits such as required permissions, whether it restarts services, handles errors, or provides progress feedback. This is a significant gap for a tool that performs upgrades.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two concise sentences that front-load the core action and add necessary detail about the source ('from the latest release'). Every word contributes to understanding the tool's purpose without waste, making it efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a mutation that upgrades software), lack of annotations, and no output schema, the description is incomplete. It omits essential context like success/failure outcomes, side effects (e.g., service downtime), error handling, and post-upgrade steps, leaving the agent with insufficient information for reliable use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 1 parameter with 100% coverage, providing a clear description. The tool description does not add parameter details beyond the schema, but with 0 required parameters and high schema coverage, the baseline is 3. It earns a 4 because the description implicitly clarifies that the upgrade fetches the 'latest release', which contextualizes the tool's behavior without redundant parameter info.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Upgrade'), the target resource ('Gitea MCP tool'), and the scope ('to the latest version'), distinguishing it from sibling tools that handle compliance checks, workflows, issues, PRs, and user contexts. It precisely communicates what the tool does without ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, prerequisites (e.g., network access, permissions), or exclusions. It mentions downloading and installing, but lacks context on timing (e.g., after updates are available) or dependencies, leaving the agent to infer usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/SupenBysz/gitea-mcp-tool'

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