Token导航 LogoToken导航TokenDH.com
Hugo MCP Server logo
开发工具stdio官方级别未说明来源级核验

Hugo MCP Server

MCP Server

一个用于管理Hugo静态站点生成器的强大MCP服务器,提供创建、管理和部署Hugo站点的全面工具集。

工具数

0

提示词数

0

GitHub Stars

9

资源数

0
开发工具Python自动化部署

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

SunnyCloudYang

提供方

SunnyCloudYang

最后核验

2026/5/17 21:11

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uv run main.py

详细介绍

Hugo MCP服务器

一个强大的MCP(模型控制协议)服务器,用于管理Hugo静态站点生成器。此服务器为创建、管理和部署Hugo站点提供了一套全面的工具。

目录

- 环境设置工具 - 现场管理工具 - 主题管理工具 - 内容管理工具 - 预览和构建工具

安装

先决条件

  • Python 3.10+
  • uv(Python包管理器)
  • Git(强烈推荐)

安装Hugo MCP服务器

  1. 克隆存储库:
   git clone https://github.com/sunnycloudyang/hugo-mcp.git
  1. 将服务器添加到您的配置中(确保 uv 之前已安装):
   {
        "mcpServers": {
            "hugo-mcp": {
                "command": "uv",
                "args": [
                    "--directory",
                    "/ABSOLUTE/PATH/TO/PARENT/FOLDER/hugo-mcp",
                    "run",
                    "main.py"
                ]
            }
        }
    }

记得将“/AABSOLUTE/PATH/to/PARENT/FOLDER/hugo-mcp”替换为您的安装路径

  1. 打开此mcp服务器并尝试!

用法

Hugo MCP服务器提供了一组可用于管理Hugo站点的工具。每个工具都有特定的参数,并返回结构化的响应。

基本用法

  1. 手动启动服务器(如果需要):
   uv run main.py
  1. 使用MCP客户端连接到服务器。
  1. 使用这些工具来管理您的Hugo网站。

工具

环境设置工具

检查hugo安装

描述:检查是否安装了Hugo并获取其版本。

参数:无

退货:

{
  "status": "success",
  "version": "Hugo Static Site Generator v0.92.0/extended linux/amd64 BuildDate=unknown"
}

错误响应:

{
  "status": "error",
  "message": "Hugo is not installed or not in PATH"
}

先决条件:无

成功后的行动:无

失败后的行动:使用安装Hugo install_hugo 工具。

安装hugo

描述:使用适用于当前操作系统的适当方法安装Hugo。

参数:

  • version (可选):要安装的Hugo版本。默认为“最新”。

退货:

{
  "status": "success",
  "message": "Hugo installed via Homebrew"
}

错误响应:

{
  "status": "error",
  "message": "Installation failed: Command 'brew install hugo' returned non-zero exit status 1."
}

先决条件:必须安装适当的包管理器(Homebrew、apt、dnf、yum)。

成功后的行动:Hugo已安装并准备就绪。

失败后的行动:可能需要手动安装。

check_go_安装

描述:检查是否安装了Go并获取其版本。

参数:无

退货:

{
  "status": "success",
  "version": "go version go1.17.5 darwin/amd64"
}

错误响应:

{
  "status": "error",
  "message": "Go is not installed or not in PATH"
}

先决条件:无

成功后的行动:无

失败后的行动:使用安装Go install_go 工具。

安装go

描述:使用适用于当前操作系统的适当方法安装Go。

参数:

  • version (可选):要安装的Go版本。默认为“最新”。

退货:

{
  "status": "success",
  "message": "Go installed via Homebrew"
}

错误响应:

{
  "status": "error",
  "message": "Installation failed: Command 'brew install go' returned non-zero exit status 1."
}

先决条件:必须安装适当的包管理器(Homebrew、apt、dnf、yum)。

成功后的行动:Go已安装并准备使用。

失败后的行动:可能需要手动安装。

check_git_安装

描述:检查Git是否已安装并获取其配置。

参数:无

退货:

{
  "status": "success",
  "version": "git version 2.30.1 (Apple Git-130)",
  "user": {
    "name": "John Doe",
    "email": "john.doe@example.com"
  },
  "default_branch": "main"
}

错误响应:

{
  "status": "error",
  "message": "Git is not installed or not in PATH"
}

先决条件:无

成功后的行动:无

失败后的行动:使用安装Git install_git 工具。

install_git

描述:使用适用于当前操作系统的适当方法安装Git。

参数:无

退货:

{
  "status": "success",
  "message": "Git installed via Homebrew"
}

错误响应:

{
  "status": "error",
  "message": "Installation failed: Command 'brew install git' returned non-zero exit status 1."
}

先决条件:必须安装适当的包管理器(Homebrew、apt、dnf、yum)。

成功后的行动Git已安装并准备就绪。

失败后的行动:可能需要手动安装。

configure_git

描述:使用用户名和电子邮件配置Git。

参数:

  • name:要设置的用户名。
  • email:要设置的电子邮件地址。

退货:

{
  "status": "success",
  "message": "Git configured with name 'John Doe' and email 'john.doe@example.com'"
}

错误响应:

{
  "status": "error",
  "message": "Failed to configure Git: Command 'git config --global user.name John Doe' returned non-zero exit status 1."
}

先决条件:必须安装Git。

成功后的行动:Git配置了指定的用户名和电子邮件。

失败后的行动:可能需要手动配置。

现场管理工具

创建_站点

描述:创建一个新的Hugo网站。

参数:

  • site_name:要创建的站点的名称。
  • theme (可选):网站使用的主题。
  • force (可选):如果目录已存在,是否强制创建。默认为 false.
  • use_example_site (可选):是否使用主题中的示例网站。默认为 true.

退货:

{
  "status": "success",
  "path": "/path/to/site",
  "theme": "paper",
  "example_site": true,
  "author": {
    "name": "John Doe",
    "email": "john.doe@example.com"
  }
}

错误响应:

{
  "status": "error",
  "message": "Directory 'site' already exists. Use force=True to overwrite."
}

先决条件:必须安装Hugo。

成功后的行动:使用指定的主题和示例内容创建了一个新的Hugo网站。

失败后的行动:网站未创建。

主题管理工具

list_themes

描述:从官方雨果主题网站列出可用的雨果主题。

参数:无

退货:

{
  "status": "success",
  "themes": [
    {
      "name": "PaperMod",
      "url": "https://github.com/gohugoio/hugoThemes/tree/master/themes/hugo-papermod",
      "image": "https://themes.gohugo.io/themes/hugo-papermod/tn-featured_hu_275191178647f5e7.png"
    },
    {
      "name": "Hugo Blox - Tailwind",
      "url": "https://github.com/gohugoio/hugoThemes/tree/master/themes/blox-tailwind",
      "image": "https://themes.gohugo.io/themes/blox-tailwind/tn-featured_hu_8c1541d303ce3b9b.png"
    }
  ],
  "count": 150
}

错误响应:

{
  "status": "error",
  "message": "Network error: Connection refused"
}

先决条件:互联网连接。

成功后的行动:返回可用主题的列表。

失败后的行动:不返回主题。

get_theme_details

描述:获取特定Hugo主题的详细信息。

参数:

  • theme_name:要获取详细信息的主题名称。

退货:

{
  "status": "success",
  "theme": {
    "name": "Paper",
    "url": "https://github.com/gohugoio/hugoThemes/tree/master/themes/paper",
    "image": "https://themes.gohugo.io/themes/paper/tn-featured.png",
    "description": "A simple, clean, and responsive Hugo theme for personal blog.",
    "features": [
      "Responsive design",
      "Clean and minimal",
      "Fast and lightweight",
      "SEO friendly"
    ],
    "tags": ["blog", "minimal", "responsive"],
    "github_url": "https://github.com/nanxiaobei/hugo-paper",
    "demo_url": "https://themes.gohugo.io/theme/paper/",
    "installation": "git submodule add https://github.com/nanxiaobei/hugo-paper themes/paper"
  }
}

错误响应:

{
  "status": "error",
  "message": "Theme 'NonExistentTheme' not found on the Hugo themes website"
}

先决条件:互联网连接。

成功后的行动:返回主题的详细信息。

失败后的行动:不返回主题详细信息。

安装主题

描述:使用git子模块或Hugo模块安装Hugo主题。

参数:

  • site_path:通往雨果网站的路径。
  • theme_name:要安装的主题的名称。
  • theme_url:主题存储库的URL。
  • use_modules (可选):是否使用Hugo模块而不是git子模块。默认为 false.

退货:

{
  "status": "success",
  "theme": "paper",
  "method": "git_submodule"
}

错误响应:

{
  "status": "error",
  "message": "Failed to install theme: Command 'git submodule add https://github.com/nanxiaobei/hugo-paper themes/paper' returned non-zero exit status 1."
}

先决条件:

  • 必须安装Hugo。
  • 必须安装Git(对于Git子模块)。
  • 必须安装Go(对于Hugo模块)。

成功后的行动:主题已在网站中安装和配置。

失败后的行动:主题未安装。

update_theme

描述:更新已安装的Hugo主题。

参数:

  • site_path:通往雨果网站的路径。
  • theme_name:要更新的主题的名称。
  • use_modules (可选):主题是否使用Hugo模块安装。默认为 false.

退货:

{
  "status": "success",
  "theme": "paper",
  "method": "git_submodule"
}

错误响应:

{
  "status": "error",
  "message": "Failed to update theme: Command 'git submodule update --remote themes/paper' returned non-zero exit status 1."
}

先决条件:

  • 必须安装Hugo。
  • 必须安装Git(对于Git子模块)。
  • 必须安装Go(对于Hugo模块)。
  • 主题必须已安装。

成功后的行动主题已更新至最新版本。

失败后的行动:主题未更新。

内容管理工具

create_post

描述:创建一个新的Hugo帖子。

参数:

  • site_path:通往雨果网站的路径。
  • post_title:文章的标题。
  • content_type (可选):帖子的内容类型。默认为“帖子”。
  • draft (可选):帖子是否应该是草稿。默认为 true.
  • date (可选):发布日期。

退货:

{
  "status": "success",
  "file": "content/posts/my-first-post.md",
  "draft": true
}

错误响应:

{
  "status": "error",
  "message": "Site path '/path/to/site' does not exist"
}

先决条件:必须安装Hugo。

成功后的行动:在指定的内容类型目录中创建新帖子。

失败后的行动:该帖子未创建。

列表内容

描述:列出Hugo网站中的内容。

参数:

  • site_path:通往雨果网站的路径。
  • content_type (可选):要列出的内容类型。如果未指定,则列出所有内容。

退货:

{
  "status": "success",
  "content": [
    "posts/my-first-post.md",
    "posts/another-post.md",
    "pages/about.md"
  ]
}

错误响应:

{
  "status": "error",
  "message": "Site path '/path/to/site' does not exist"
}

先决条件:必须安装Hugo。

成功后的行动:返回内容文件列表。

失败后的行动:不返回任何内容。

预览和构建工具

start_preview

描述:启动Hugo本地服务器。

参数:

  • site_path:通往雨果网站的路径。
  • port (可选):要使用的端口。默认值为1313。
  • bind (可选):要绑定的地址。默认为“127.0.0.1”。
  • build_drafts (可选):是否构建草稿内容。默认为 false.
  • build_future (可选):是否构建未来内容。默认为 false.
  • build_expired (可选):是否构建过期内容。默认为 false.

退货:

{
  "status": "success",
  "url": "http://127.0.0.1:1313",
  "pid": 12345,
  "options": {
    "build_drafts": false,
    "build_future": false,
    "build_expired": false
  }
}

错误响应:

{
  "status": "error",
  "message": "Site path '/path/to/site' does not exist"
}

先决条件:必须安装Hugo。

成功后的行动:Hugo服务器已启动,可以在指定的URL访问。

失败后的行动:服务器未启动。

stop_preview

描述:停止正在运行的Hugo预览服务器。

参数:

  • pid:要停止的服务器的进程ID。

退货:

{
  "status": "success",
  "message": "Server with PID 12345 stopped"
}

错误响应:

{
  "status": "error",
  "message": "Process with PID 12345 not found"
}

先决条件:没有。

成功后的行动:Hugo服务器已停止。

失败后的行动:服务器未停止。

建筑_网站

描述:建立雨果网站进行生产。

参数:

  • site_path:通往雨果网站的路径。
  • destination (可选):目标目录。默认为“公共”。
  • clean_destination (可选):是否在构建前清理目标目录。默认为 false.
  • minify (可选):是否缩小输出。默认为 false.

退货:

{
  "status": "success",
  "destination": "/path/to/site/public",
  "output": "Built in 123 ms"
}

错误响应:

{
  "status": "error",
  "message": "Site path '/path/to/site' does not exist"
}

先决条件:必须安装Hugo。

成功后的行动:该网站已建成并准备部署。

失败后的行动:该网站尚未建成。

部署站点

描述:将Hugo站点部署到各种平台。

参数:

  • site_path:通往雨果网站的路径。
  • platform:部署平台(github页面、netlify、vercel、自定义)。
  • destination (可选):构建目标目录。默认为“公共”。
  • branch (可选):要部署到的分支。默认为“main”。
  • commit_message (可选):提交部署消息。默认为“更新站点”。
  • remote_url (可选):用于自定义部署的远程URL。
  • api_key (可选):部署平台的API密钥。
  • additional_options (可选):其他特定于平台的选项。

退货:

{
  "status": "success",
  "platform": "github-pages",
  "branch": "gh-pages",
  "url": "https://username.github.io"
}

错误响应:

{
  "status": "error",
  "message": "Deployment failed: GitHub Pages deployment failed: Command 'git push origin gh-pages --force' returned non-zero exit status 1."
}

先决条件:

  • 必须安装Hugo。
  • 必须安装Git。
  • 对于GitHub Pages:必须初始化Git存储库。
  • 对于Netlify:必须安装Netlify CLI(如果不存在,将自动安装)。
  • 对于Vercel:必须安装Vercel CLI(如果不存在,将自动安装)。

成功后的行动:该网站已部署到指定平台,并可通过返回的URL访问。

失败后的行动:站点未部署。

平台特定注意事项:

  • GitHub页面:需要一个Git存储库和可选的API密钥进行身份验证。
  • Netlify:需要Netlify CLI和API密钥(可选)进行身份验证。
  • 维塞尔:需要Vercel CLI和可选的API密钥进行身份验证。
  • 自定义:需要Git存储库和远程URL。

完整工作流示例

以下是一个完整的工作流示例(使用python脚本而不是mcp服务器工具来显示常见路线),用于创建一个具有主题的新Hugo站点:

  1. 检查是否安装了Hugo:
   result = await check_hugo_installation()
   if result["status"] != "success":
       result = await install_hugo()
  1. 检查Git是否已安装:
   result = await check_git_installation()
   if result["status"] != "success":
       result = await install_git()
  1. 配置Git:
   result = await configure_git("John Doe", "john.doe@example.com")
  1. 列出可用主题:
   result = await list_themes()
   themes = result["themes"]
  1. 获取特定主题的详细信息:
   result = await get_theme_details("Paper")
   theme_details = result["theme"]
  1. 创建一个主题为的新网站:
   result = await create_site("my-blog", theme="nanxiaobei/hugo-paper", use_example_site=True)
   site_path = result["path"]
  1. 启动预览服务器:
   result = await start_preview(site_path, build_drafts=True)
   preview_url = result["url"]
  1. 创建新帖子:
   result = await create_post(site_path, "my-first-post", draft=False)
   post_file = result["file"]
  1. 建设生产场地:
   result = await build_site(site_path, minify=True)
  1. 将网站部署到GitHub页面:
   result = await deploy_site(
       site_path=site_path,
       platform="github-pages",
       branch="gh-pages",
       commit_message="Deploy site",
       api_key="your-github-token"
   )
   deploy_url = result["url"]

故障排除

常见问题

  1. 未安装Hugo:

- 使用 install_hugo 安装Hugo的工具。

  1. 未安装Git:

- 使用 install_git 安装Git的工具。

  1. 主题安装失败:

- 检查主题URL是否正确。 - 确保Git子模块安装了Git。 - 确保为Hugo模块安装了Go。 - 阅读主题文档,检查是否有不同之处

  1. 预览服务器无法启动:

- 检查端口是否已在使用中。 - 确保站点路径正确。 - 检查您的网络

  1. 构建失败:

- 检查站点路径是否正确。 - 确保安装了所有必需的依赖项。

获取帮助

如果您遇到本文档中未涵盖的任何问题,请 打开一个问题 在GitHub存储库上。

目录标签

目录标签

开发工具Python自动化部署静态站点生成本地部署站点管理Hugo

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

token

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiotoken部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP