Back to MCP directory
publicPublicdnsLocal runtime

mcp-server-pagespeed

一个提供Google PageSpeed Insights分析的MCP服务器,帮助AI模型通过标准化接口分析网页性能。

article

README

🚀 @enemyrr/mcp-server-pagespeed

这是一个提供谷歌PageSpeed洞察分析的模型上下文协议(MCP)服务器。借助标准化接口,该服务器能够让AI模型对网页性能展开分析。

🚀 快速开始

📦 安装指南

在Cursor IDE中的安装与设置

  1. 克隆并构建项目:
git clone https://github.com/enemyrr/mcp-server-pagespeed.git
cd mcp-server-pagespeed
npm install
npm run build
  1. 在Cursor IDE设置中添加服务器:
    • 打开命令面板(Cmd/Ctrl + Shift + P)
    • 搜索“MCP: 添加服务器”
    • 填写字段:
      • 名称:pagespeed
      • 类型:command
      • 命令:node /绝对路径/to/mcp-server-pagespeed/build/index.js

⚠️ 重要提示

请将 /absolute/path/to/ 替换为实际的项目克隆和构建路径。

命令行使用

直接运行:

npx mcp-server-pagespeed

💻 使用示例

基础用法

use_mcp_tool({
  server_name: "pagespeed",
  tool_name: "analyze_pagespeed",
  arguments: {
    url: "https://example.com"
  }
});

此代码使用 analyze_pagespeed 工具,借助谷歌PageSpeed洞察API对网页进行分析。

✨ 主要特性

  • 实时网页性能分析
  • 详细的加载体验指标
  • 优先级改进建议
  • 完整的错误处理
  • TypeScript支持

🔧 技术细节

可用工具 - analyze_pagespeed

该工具可使用谷歌PageSpeed洞察API分析网页,返回以下内容:

  • 总体性能评分(0-100)
  • 加载体验指标
    • 首内容绘制(First Contentful Paint)
    • 首输入延迟(First Input Delay)
  • 前5个改进建议,包括:
    • 标题
    • 描述
    • 潜在影响
    • 当前值

错误处理

该服务器提供详细错误消息,涵盖以下情况:

  • 无效URL
  • API请求失败
  • 连接问题
  • 无效工具调用

🤝 贡献

欢迎贡献!请随意提交Pull Request到 https://github.com/enemyrr/mcp-server-pagespeed

📄 许可证

本项目采用MIT许可证。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client