Name | x-pages-mcp JSON |
Version |
0.1.4
JSON |
| download |
home_page | None |
Summary | MCP server for X-Pages HTML deployment service |
upload_time | 2025-08-21 10:20:34 |
maintainer | None |
docs_url | None |
author | X-Pages Team |
requires_python | >=3.10 |
license | MIT License
Copyright (c) 2024 X-Pages Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. |
keywords |
ai
claude
deployment
html
mcp
model-context-protocol
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# X-Pages MCP Server
X-Pages MCP Server是一个基于Model Context Protocol (MCP)的HTML部署服务,让AI能够直接部署HTML内容并获取访问URL。项目使用Python实现,基于FastMCP框架构建。
## 🚀 功能特性
- 🤖 **AI友好** - 通过MCP协议让AI直接部署HTML内容
- 🔧 **简单易用** - 几个命令即可完成部署和管理
- 🛡️ **安全认证** - 支持token认证,保护API访问
- 🌐 **即时访问** - 部署后立即获得可访问的网站URL
- 📄 **多格式支持** - 支持HTML、Markdown、TXT等格式文件部署
- 🔄 **完整管理** - 支持部署、删除、URL获取等完整操作
## 📦 安装
### 前置要求
- Python 3.10+
- uv (推荐) 或 pip
- 已部署的X-Pages服务
### 从PyPI安装
```bash
# 使用uvx直接运行(推荐)
uvx x-pages-mcp-stdio
uvx x-pages-mcp-http --port 8083
# 或使用uv安装到虚拟环境
uv add x-pages-mcp
uv run x-pages-mcp-stdio
# 或传统pip方式
pip install x-pages-mcp
x-pages-mcp-stdio
```
### 开发安装
```bash
# 克隆项目
git clone <repository-url>
cd x-pages-mcp
# 安装依赖
uv sync
# 或使用pip安装
pip install -e .
```
## ⚙️ 配置
### 环境变量配置
所有模式都使用相同的环境变量配置:
#### 方法1:使用 .env 文件(推荐)
在项目根目录创建 `.env` 文件:
```bash
X_PAGES_BASE_URL=https://your-domain.com
X_PAGES_API_TOKEN=your-secret-token
```
#### 方法2:直接设置环境变量
```bash
export X_PAGES_BASE_URL=https://your-domain.com
export X_PAGES_API_TOKEN=your-secret-token
```
### Claude Desktop 配置
在Claude Desktop的配置文件中添加MCP服务器:
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
```json
{
"mcpServers": {
"x-pages-html-deployment": {
"command": "uv",
"args": ["run", "x-pages-mcp-stdio"],
"env": {
"X_PAGES_BASE_URL": "https://your-domain.com",
"X_PAGES_API_TOKEN": "your-secret-token"
}
}
}
}
```
## 🚀 使用方法
### 传输模式
X-Pages MCP服务器支持两种传输模式:
#### STDIO模式(用于Claude Desktop)
标准输入输出模式,适合Claude Desktop等本地客户端:
```bash
# STDIO模式
uv run x-pages-mcp-stdio
# 或使用安装后的命令
x-pages-mcp-stdio
```
#### HTTP模式(用于API集成)
基于FastAPI的HTTP API服务,支持Web客户端和API集成:
```bash
# HTTP模式
uv run x-pages-mcp-http --host localhost --port 8083
# HTTP开发模式(支持自动重载)
uv run x-pages-mcp-http --host localhost --port 8083 --reload
# 使用安装后的命令
x-pages-mcp-http --host localhost --port 8083
```
### 开发测试
```bash
# 使用mcp-inspector测试
npx @modelcontextprotocol/inspector uv run x-pages-mcp-stdio
# 运行测试
uv run pytest
# 代码检查和格式化
uv run ruff check src/
uv run ruff format src/
# 类型检查
uv run mypy src/
```
## 🛠 可用工具
### 1. deploy_html
部署HTML内容到X-Pages服务
**参数:**
- `html_content` (string): 完整的HTML内容
**返回:**
```json
{
"success": true,
"site_name": "随机生成的24位标识符",
"deploy_url": "https://your-domain.com/site_name",
"deployed_at": "2024-01-01T00:00:00Z",
"content_length": 1024,
"message": "HTML site deployed successfully"
}
```
### 2. delete_html
从X-Pages服务删除HTML站点
**参数:**
- `site_name` (string): 要删除的站点名称
**返回:**
```json
{
"success": true,
"site_name": "my-site",
"message": "HTML site deleted successfully"
}
```
### 3. get_site_url
获取站点的访问URL
**参数:**
- `site_name` (string): 站点名称
**返回:** `"https://your-domain.com/my-site"`
### 4. create_sample_html
创建示例HTML页面内容
**参数:**
- `title` (string, 可选): HTML页面标题,默认"示例页面"
- `heading` (string, 可选): 页面主标题,默认"Hello World!"
- `content` (string, 可选): 页面内容,默认示例文本
**返回:** 完整的HTML内容,可用于部署
### 5. deploy_file
部署文件到X-Pages服务(支持多种格式)
**参数:**
- `file_path` (string): 要部署的文件路径
**支持的文件格式:**
- HTML文件 (.html, .htm)
- Markdown文件 (.md, .markdown)
- 文本文件 (.txt)
**返回:**
```json
{
"success": true,
"site_name": "随机生成的24位标识符",
"deploy_url": "https://your-domain.com/site_name",
"deployed_at": "2024-01-01T00:00:00Z",
"file_type": "markdown",
"message": "File deployed successfully"
}
```
## 💡 使用示例
### 与Claude Desktop一起使用
配置完成后,你可以在Claude Desktop中直接使用自然语言进行HTML部署:
```
用户:帮我创建一个简单的个人介绍网站并部署
Claude:我来为你创建并部署一个个人介绍网站。
首先,我会创建一个包含个人介绍的HTML页面,然后部署到X-Pages服务。
```
Claude会自动调用MCP工具来:
1. 创建HTML内容
2. 部署到X-Pages服务
3. 返回可访问的网站URL
### 命令行使用
```bash
# 启动STDIO模式的MCP服务器
uv run x-pages-mcp-stdio
# 启动HTTP模式的MCP服务器
uv run x-pages-mcp-http --host localhost --port 8083
```
## 🐳 Docker 部署
### 快速启动
```bash
# 创建环境变量文件
cp .env.example .env
# 编辑 .env 文件设置 X_PAGES_BASE_URL 和 X_PAGES_API_TOKEN
# 使用 docker-compose 启动
docker-compose up -d
# 检查服务状态
curl http://localhost:8083/health
```
### 构建和部署脚本
```bash
# 构建 Docker 镜像
./scripts/docker-build.sh
# 部署服务
./scripts/docker-deploy.sh up # 开发环境
./scripts/docker-deploy.sh --prod up # 生产环境
# 查看日志
./scripts/docker-deploy.sh logs
# 停止服务
./scripts/docker-deploy.sh down
```
详细的 Docker 部署指南请查看 `docker/README.md`。
## 🧪 测试
```bash
# 运行测试
uv run pytest
# 运行测试并显示覆盖率
uv run pytest --cov=x_pages_mcp
```
## 🛡️ 安全注意事项
1. **保护API Token** - 不要在代码中硬编码token,使用环境变量
2. **网络安全** - 确保X-Pages服务使用HTTPS
3. **输入验证** - 对HTML内容进行适当的安全检查
4. **访问控制** - 限制MCP服务器的访问权限
## 🏗️ 项目架构
### 核心组件
1. **MCP工具库** (`src/mcp_servers/xpages_mcp.py`)
- 基于FastMCP框架实现,使用模块级变量 `mcp = FastMCP("X-Pages HTML Deployment")`
- 提供5个核心工具:deploy_html, delete_html, get_site_url, create_sample_html, deploy_file
- 配置通过环境变量管理
2. **STDIO服务器** (`src/x_pages_mcp/stdio_server.py`)
- STDIO模式的独立启动器,用于Claude Desktop等客户端
- 直接导入并使用 `mcp` 变量
3. **HTTP服务器** (`src/x_pages_mcp/http_server.py`)
- HTTP模式的独立启动器,基于FastAPI
- 支持 `--reload` 开发模式
- 提供健康检查和根路径信息端点
### 项目架构原则
项目采用**直接变量引用**风格,避免不必要的函数封装:
- **MCP服务器实例**: 使用模块级变量 `mcp = FastMCP(...)` 而非工厂函数
- **FastAPI应用实例**: 使用模块级变量 `app = FastAPI(...)` 而非 `create_app()` 函数
- **直接导入使用**: `from mcp_servers.xpages_mcp import mcp` 直接使用,简洁明了
- **模块级配置**: 配置和初始化在模块导入时完成,运行时直接引用
## 📄 许可证
MIT License
## 🆘 故障排除
### 常见问题
**Q: 配置错误 "X_PAGES_BASE_URL environment variable is required"**
A: 确保设置了正确的环境变量,参考配置部分
**Q: 部署失败 "Invalid token"**
A: 检查X_PAGES_API_TOKEN是否与X-Pages服务中配置的token一致
**Q: 网络请求失败**
A: 检查X_PAGES_BASE_URL是否正确,网络连接是否正常
**Q: Claude Desktop中看不到MCP工具**
A: 检查配置文件路径和格式,重启Claude Desktop
### 调试模式
```bash
# 启用调试日志
export MCP_LOG_LEVEL=DEBUG
uv run x-pages-mcp-stdio
```
## 🔗 相关链接
- [Model Context Protocol](https://modelcontextprotocol.io/)
- [FastMCP Framework](https://github.com/jlowin/fastmcp)
- [Claude Desktop MCP 配置文档](https://docs.anthropic.com/en/docs/build-with-claude/computer-use)
Raw data
{
"_id": null,
"home_page": null,
"name": "x-pages-mcp",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "ai, claude, deployment, html, mcp, model-context-protocol",
"author": "X-Pages Team",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/97/c2/c180633593c7c242846cc4e9edec9a0b99099ea1f64cf62ab3e0f74a1943/x_pages_mcp-0.1.4.tar.gz",
"platform": null,
"description": "# X-Pages MCP Server\n\nX-Pages MCP Server\u662f\u4e00\u4e2a\u57fa\u4e8eModel Context Protocol (MCP)\u7684HTML\u90e8\u7f72\u670d\u52a1\uff0c\u8ba9AI\u80fd\u591f\u76f4\u63a5\u90e8\u7f72HTML\u5185\u5bb9\u5e76\u83b7\u53d6\u8bbf\u95eeURL\u3002\u9879\u76ee\u4f7f\u7528Python\u5b9e\u73b0\uff0c\u57fa\u4e8eFastMCP\u6846\u67b6\u6784\u5efa\u3002\n\n## \ud83d\ude80 \u529f\u80fd\u7279\u6027\n\n- \ud83e\udd16 **AI\u53cb\u597d** - \u901a\u8fc7MCP\u534f\u8bae\u8ba9AI\u76f4\u63a5\u90e8\u7f72HTML\u5185\u5bb9\n- \ud83d\udd27 **\u7b80\u5355\u6613\u7528** - \u51e0\u4e2a\u547d\u4ee4\u5373\u53ef\u5b8c\u6210\u90e8\u7f72\u548c\u7ba1\u7406\n- \ud83d\udee1\ufe0f **\u5b89\u5168\u8ba4\u8bc1** - \u652f\u6301token\u8ba4\u8bc1\uff0c\u4fdd\u62a4API\u8bbf\u95ee\n- \ud83c\udf10 **\u5373\u65f6\u8bbf\u95ee** - \u90e8\u7f72\u540e\u7acb\u5373\u83b7\u5f97\u53ef\u8bbf\u95ee\u7684\u7f51\u7ad9URL\n- \ud83d\udcc4 **\u591a\u683c\u5f0f\u652f\u6301** - \u652f\u6301HTML\u3001Markdown\u3001TXT\u7b49\u683c\u5f0f\u6587\u4ef6\u90e8\u7f72\n- \ud83d\udd04 **\u5b8c\u6574\u7ba1\u7406** - \u652f\u6301\u90e8\u7f72\u3001\u5220\u9664\u3001URL\u83b7\u53d6\u7b49\u5b8c\u6574\u64cd\u4f5c\n\n## \ud83d\udce6 \u5b89\u88c5\n\n### \u524d\u7f6e\u8981\u6c42\n\n- Python 3.10+\n- uv (\u63a8\u8350) \u6216 pip\n- \u5df2\u90e8\u7f72\u7684X-Pages\u670d\u52a1\n\n### \u4ecePyPI\u5b89\u88c5\n\n```bash\n# \u4f7f\u7528uvx\u76f4\u63a5\u8fd0\u884c\uff08\u63a8\u8350\uff09\nuvx x-pages-mcp-stdio\nuvx x-pages-mcp-http --port 8083\n\n# \u6216\u4f7f\u7528uv\u5b89\u88c5\u5230\u865a\u62df\u73af\u5883\nuv add x-pages-mcp\nuv run x-pages-mcp-stdio\n\n# \u6216\u4f20\u7edfpip\u65b9\u5f0f\npip install x-pages-mcp\nx-pages-mcp-stdio\n```\n\n### \u5f00\u53d1\u5b89\u88c5\n\n```bash\n# \u514b\u9686\u9879\u76ee\ngit clone <repository-url>\ncd x-pages-mcp\n\n# \u5b89\u88c5\u4f9d\u8d56\nuv sync\n\n# \u6216\u4f7f\u7528pip\u5b89\u88c5\npip install -e .\n```\n\n## \u2699\ufe0f \u914d\u7f6e\n\n### \u73af\u5883\u53d8\u91cf\u914d\u7f6e\n\n\u6240\u6709\u6a21\u5f0f\u90fd\u4f7f\u7528\u76f8\u540c\u7684\u73af\u5883\u53d8\u91cf\u914d\u7f6e\uff1a\n\n#### \u65b9\u6cd51\uff1a\u4f7f\u7528 .env \u6587\u4ef6\uff08\u63a8\u8350\uff09\n\n\u5728\u9879\u76ee\u6839\u76ee\u5f55\u521b\u5efa `.env` \u6587\u4ef6\uff1a\n\n```bash\nX_PAGES_BASE_URL=https://your-domain.com\nX_PAGES_API_TOKEN=your-secret-token\n```\n\n#### \u65b9\u6cd52\uff1a\u76f4\u63a5\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\n\n```bash\nexport X_PAGES_BASE_URL=https://your-domain.com\nexport X_PAGES_API_TOKEN=your-secret-token\n```\n\n### Claude Desktop \u914d\u7f6e\n\n\u5728Claude Desktop\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0MCP\u670d\u52a1\u5668\uff1a\n\n**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`\n**Windows**: `%APPDATA%\\Claude\\claude_desktop_config.json`\n\n```json\n{\n \"mcpServers\": {\n \"x-pages-html-deployment\": {\n \"command\": \"uv\",\n \"args\": [\"run\", \"x-pages-mcp-stdio\"],\n \"env\": {\n \"X_PAGES_BASE_URL\": \"https://your-domain.com\",\n \"X_PAGES_API_TOKEN\": \"your-secret-token\"\n }\n }\n }\n}\n```\n\n## \ud83d\ude80 \u4f7f\u7528\u65b9\u6cd5\n\n### \u4f20\u8f93\u6a21\u5f0f\n\nX-Pages MCP\u670d\u52a1\u5668\u652f\u6301\u4e24\u79cd\u4f20\u8f93\u6a21\u5f0f\uff1a\n\n#### STDIO\u6a21\u5f0f\uff08\u7528\u4e8eClaude Desktop\uff09\n\n\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u6a21\u5f0f\uff0c\u9002\u5408Claude Desktop\u7b49\u672c\u5730\u5ba2\u6237\u7aef\uff1a\n\n```bash\n# STDIO\u6a21\u5f0f\nuv run x-pages-mcp-stdio\n\n# \u6216\u4f7f\u7528\u5b89\u88c5\u540e\u7684\u547d\u4ee4\nx-pages-mcp-stdio\n```\n\n#### HTTP\u6a21\u5f0f\uff08\u7528\u4e8eAPI\u96c6\u6210\uff09\n\n\u57fa\u4e8eFastAPI\u7684HTTP API\u670d\u52a1\uff0c\u652f\u6301Web\u5ba2\u6237\u7aef\u548cAPI\u96c6\u6210\uff1a\n\n```bash\n# HTTP\u6a21\u5f0f\nuv run x-pages-mcp-http --host localhost --port 8083\n\n# HTTP\u5f00\u53d1\u6a21\u5f0f\uff08\u652f\u6301\u81ea\u52a8\u91cd\u8f7d\uff09\nuv run x-pages-mcp-http --host localhost --port 8083 --reload\n\n# \u4f7f\u7528\u5b89\u88c5\u540e\u7684\u547d\u4ee4\nx-pages-mcp-http --host localhost --port 8083\n```\n\n### \u5f00\u53d1\u6d4b\u8bd5\n\n```bash\n# \u4f7f\u7528mcp-inspector\u6d4b\u8bd5\nnpx @modelcontextprotocol/inspector uv run x-pages-mcp-stdio\n\n# \u8fd0\u884c\u6d4b\u8bd5\nuv run pytest\n\n# \u4ee3\u7801\u68c0\u67e5\u548c\u683c\u5f0f\u5316\nuv run ruff check src/\nuv run ruff format src/\n\n# \u7c7b\u578b\u68c0\u67e5\nuv run mypy src/\n```\n\n## \ud83d\udee0 \u53ef\u7528\u5de5\u5177\n\n### 1. deploy_html\n\u90e8\u7f72HTML\u5185\u5bb9\u5230X-Pages\u670d\u52a1\n\n**\u53c2\u6570\uff1a**\n- `html_content` (string): \u5b8c\u6574\u7684HTML\u5185\u5bb9\n\n**\u8fd4\u56de\uff1a**\n```json\n{\n \"success\": true,\n \"site_name\": \"\u968f\u673a\u751f\u6210\u768424\u4f4d\u6807\u8bc6\u7b26\",\n \"deploy_url\": \"https://your-domain.com/site_name\",\n \"deployed_at\": \"2024-01-01T00:00:00Z\",\n \"content_length\": 1024,\n \"message\": \"HTML site deployed successfully\"\n}\n```\n\n### 2. delete_html\n\u4eceX-Pages\u670d\u52a1\u5220\u9664HTML\u7ad9\u70b9\n\n**\u53c2\u6570\uff1a**\n- `site_name` (string): \u8981\u5220\u9664\u7684\u7ad9\u70b9\u540d\u79f0\n\n**\u8fd4\u56de\uff1a**\n```json\n{\n \"success\": true,\n \"site_name\": \"my-site\",\n \"message\": \"HTML site deleted successfully\"\n}\n```\n\n### 3. get_site_url\n\u83b7\u53d6\u7ad9\u70b9\u7684\u8bbf\u95eeURL\n\n**\u53c2\u6570\uff1a**\n- `site_name` (string): \u7ad9\u70b9\u540d\u79f0\n\n**\u8fd4\u56de\uff1a** `\"https://your-domain.com/my-site\"`\n\n### 4. create_sample_html\n\u521b\u5efa\u793a\u4f8bHTML\u9875\u9762\u5185\u5bb9\n\n**\u53c2\u6570\uff1a**\n- `title` (string, \u53ef\u9009): HTML\u9875\u9762\u6807\u9898\uff0c\u9ed8\u8ba4\"\u793a\u4f8b\u9875\u9762\"\n- `heading` (string, \u53ef\u9009): \u9875\u9762\u4e3b\u6807\u9898\uff0c\u9ed8\u8ba4\"Hello World!\"\n- `content` (string, \u53ef\u9009): \u9875\u9762\u5185\u5bb9\uff0c\u9ed8\u8ba4\u793a\u4f8b\u6587\u672c\n\n**\u8fd4\u56de\uff1a** \u5b8c\u6574\u7684HTML\u5185\u5bb9\uff0c\u53ef\u7528\u4e8e\u90e8\u7f72\n\n### 5. deploy_file\n\u90e8\u7f72\u6587\u4ef6\u5230X-Pages\u670d\u52a1\uff08\u652f\u6301\u591a\u79cd\u683c\u5f0f\uff09\n\n**\u53c2\u6570\uff1a**\n- `file_path` (string): \u8981\u90e8\u7f72\u7684\u6587\u4ef6\u8def\u5f84\n\n**\u652f\u6301\u7684\u6587\u4ef6\u683c\u5f0f\uff1a**\n- HTML\u6587\u4ef6 (.html, .htm)\n- Markdown\u6587\u4ef6 (.md, .markdown)\n- \u6587\u672c\u6587\u4ef6 (.txt)\n\n**\u8fd4\u56de\uff1a**\n```json\n{\n \"success\": true,\n \"site_name\": \"\u968f\u673a\u751f\u6210\u768424\u4f4d\u6807\u8bc6\u7b26\",\n \"deploy_url\": \"https://your-domain.com/site_name\",\n \"deployed_at\": \"2024-01-01T00:00:00Z\",\n \"file_type\": \"markdown\",\n \"message\": \"File deployed successfully\"\n}\n```\n\n## \ud83d\udca1 \u4f7f\u7528\u793a\u4f8b\n\n### \u4e0eClaude Desktop\u4e00\u8d77\u4f7f\u7528\n\n\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u4f60\u53ef\u4ee5\u5728Claude Desktop\u4e2d\u76f4\u63a5\u4f7f\u7528\u81ea\u7136\u8bed\u8a00\u8fdb\u884cHTML\u90e8\u7f72\uff1a\n\n```\n\u7528\u6237\uff1a\u5e2e\u6211\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u4e2a\u4eba\u4ecb\u7ecd\u7f51\u7ad9\u5e76\u90e8\u7f72\n\nClaude\uff1a\u6211\u6765\u4e3a\u4f60\u521b\u5efa\u5e76\u90e8\u7f72\u4e00\u4e2a\u4e2a\u4eba\u4ecb\u7ecd\u7f51\u7ad9\u3002\n\n\u9996\u5148\uff0c\u6211\u4f1a\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u4e2a\u4eba\u4ecb\u7ecd\u7684HTML\u9875\u9762\uff0c\u7136\u540e\u90e8\u7f72\u5230X-Pages\u670d\u52a1\u3002\n```\n\nClaude\u4f1a\u81ea\u52a8\u8c03\u7528MCP\u5de5\u5177\u6765\uff1a\n1. \u521b\u5efaHTML\u5185\u5bb9\n2. \u90e8\u7f72\u5230X-Pages\u670d\u52a1\n3. \u8fd4\u56de\u53ef\u8bbf\u95ee\u7684\u7f51\u7ad9URL\n\n### \u547d\u4ee4\u884c\u4f7f\u7528\n\n```bash\n# \u542f\u52a8STDIO\u6a21\u5f0f\u7684MCP\u670d\u52a1\u5668\nuv run x-pages-mcp-stdio\n\n# \u542f\u52a8HTTP\u6a21\u5f0f\u7684MCP\u670d\u52a1\u5668\nuv run x-pages-mcp-http --host localhost --port 8083\n```\n\n## \ud83d\udc33 Docker \u90e8\u7f72\n\n### \u5feb\u901f\u542f\u52a8\n\n```bash\n# \u521b\u5efa\u73af\u5883\u53d8\u91cf\u6587\u4ef6\ncp .env.example .env\n# \u7f16\u8f91 .env \u6587\u4ef6\u8bbe\u7f6e X_PAGES_BASE_URL \u548c X_PAGES_API_TOKEN\n\n# \u4f7f\u7528 docker-compose \u542f\u52a8\ndocker-compose up -d\n\n# \u68c0\u67e5\u670d\u52a1\u72b6\u6001\ncurl http://localhost:8083/health\n```\n\n### \u6784\u5efa\u548c\u90e8\u7f72\u811a\u672c\n\n```bash\n# \u6784\u5efa Docker \u955c\u50cf\n./scripts/docker-build.sh\n\n# \u90e8\u7f72\u670d\u52a1\n./scripts/docker-deploy.sh up # \u5f00\u53d1\u73af\u5883\n./scripts/docker-deploy.sh --prod up # \u751f\u4ea7\u73af\u5883\n\n# \u67e5\u770b\u65e5\u5fd7\n./scripts/docker-deploy.sh logs\n\n# \u505c\u6b62\u670d\u52a1\n./scripts/docker-deploy.sh down\n```\n\n\u8be6\u7ec6\u7684 Docker \u90e8\u7f72\u6307\u5357\u8bf7\u67e5\u770b `docker/README.md`\u3002\n\n## \ud83e\uddea \u6d4b\u8bd5\n\n```bash\n# \u8fd0\u884c\u6d4b\u8bd5\nuv run pytest\n\n# \u8fd0\u884c\u6d4b\u8bd5\u5e76\u663e\u793a\u8986\u76d6\u7387\nuv run pytest --cov=x_pages_mcp\n```\n\n## \ud83d\udee1\ufe0f \u5b89\u5168\u6ce8\u610f\u4e8b\u9879\n\n1. **\u4fdd\u62a4API Token** - \u4e0d\u8981\u5728\u4ee3\u7801\u4e2d\u786c\u7f16\u7801token\uff0c\u4f7f\u7528\u73af\u5883\u53d8\u91cf\n2. **\u7f51\u7edc\u5b89\u5168** - \u786e\u4fddX-Pages\u670d\u52a1\u4f7f\u7528HTTPS\n3. **\u8f93\u5165\u9a8c\u8bc1** - \u5bf9HTML\u5185\u5bb9\u8fdb\u884c\u9002\u5f53\u7684\u5b89\u5168\u68c0\u67e5\n4. **\u8bbf\u95ee\u63a7\u5236** - \u9650\u5236MCP\u670d\u52a1\u5668\u7684\u8bbf\u95ee\u6743\u9650\n\n## \ud83c\udfd7\ufe0f \u9879\u76ee\u67b6\u6784\n\n### \u6838\u5fc3\u7ec4\u4ef6\n\n1. **MCP\u5de5\u5177\u5e93** (`src/mcp_servers/xpages_mcp.py`)\n - \u57fa\u4e8eFastMCP\u6846\u67b6\u5b9e\u73b0\uff0c\u4f7f\u7528\u6a21\u5757\u7ea7\u53d8\u91cf `mcp = FastMCP(\"X-Pages HTML Deployment\")`\n - \u63d0\u4f9b5\u4e2a\u6838\u5fc3\u5de5\u5177\uff1adeploy_html, delete_html, get_site_url, create_sample_html, deploy_file\n - \u914d\u7f6e\u901a\u8fc7\u73af\u5883\u53d8\u91cf\u7ba1\u7406\n\n2. **STDIO\u670d\u52a1\u5668** (`src/x_pages_mcp/stdio_server.py`)\n - STDIO\u6a21\u5f0f\u7684\u72ec\u7acb\u542f\u52a8\u5668\uff0c\u7528\u4e8eClaude Desktop\u7b49\u5ba2\u6237\u7aef\n - \u76f4\u63a5\u5bfc\u5165\u5e76\u4f7f\u7528 `mcp` \u53d8\u91cf\n\n3. **HTTP\u670d\u52a1\u5668** (`src/x_pages_mcp/http_server.py`)\n - HTTP\u6a21\u5f0f\u7684\u72ec\u7acb\u542f\u52a8\u5668\uff0c\u57fa\u4e8eFastAPI\n - \u652f\u6301 `--reload` \u5f00\u53d1\u6a21\u5f0f\n - \u63d0\u4f9b\u5065\u5eb7\u68c0\u67e5\u548c\u6839\u8def\u5f84\u4fe1\u606f\u7aef\u70b9\n\n### \u9879\u76ee\u67b6\u6784\u539f\u5219\n\n\u9879\u76ee\u91c7\u7528**\u76f4\u63a5\u53d8\u91cf\u5f15\u7528**\u98ce\u683c\uff0c\u907f\u514d\u4e0d\u5fc5\u8981\u7684\u51fd\u6570\u5c01\u88c5\uff1a\n\n- **MCP\u670d\u52a1\u5668\u5b9e\u4f8b**: \u4f7f\u7528\u6a21\u5757\u7ea7\u53d8\u91cf `mcp = FastMCP(...)` \u800c\u975e\u5de5\u5382\u51fd\u6570\n- **FastAPI\u5e94\u7528\u5b9e\u4f8b**: \u4f7f\u7528\u6a21\u5757\u7ea7\u53d8\u91cf `app = FastAPI(...)` \u800c\u975e `create_app()` \u51fd\u6570\n- **\u76f4\u63a5\u5bfc\u5165\u4f7f\u7528**: `from mcp_servers.xpages_mcp import mcp` \u76f4\u63a5\u4f7f\u7528\uff0c\u7b80\u6d01\u660e\u4e86\n- **\u6a21\u5757\u7ea7\u914d\u7f6e**: \u914d\u7f6e\u548c\u521d\u59cb\u5316\u5728\u6a21\u5757\u5bfc\u5165\u65f6\u5b8c\u6210\uff0c\u8fd0\u884c\u65f6\u76f4\u63a5\u5f15\u7528\n\n## \ud83d\udcc4 \u8bb8\u53ef\u8bc1\n\nMIT License\n\n## \ud83c\udd98 \u6545\u969c\u6392\u9664\n\n### \u5e38\u89c1\u95ee\u9898\n\n**Q: \u914d\u7f6e\u9519\u8bef \"X_PAGES_BASE_URL environment variable is required\"**\nA: \u786e\u4fdd\u8bbe\u7f6e\u4e86\u6b63\u786e\u7684\u73af\u5883\u53d8\u91cf\uff0c\u53c2\u8003\u914d\u7f6e\u90e8\u5206\n\n**Q: \u90e8\u7f72\u5931\u8d25 \"Invalid token\"**\nA: \u68c0\u67e5X_PAGES_API_TOKEN\u662f\u5426\u4e0eX-Pages\u670d\u52a1\u4e2d\u914d\u7f6e\u7684token\u4e00\u81f4\n\n**Q: \u7f51\u7edc\u8bf7\u6c42\u5931\u8d25**\nA: \u68c0\u67e5X_PAGES_BASE_URL\u662f\u5426\u6b63\u786e\uff0c\u7f51\u7edc\u8fde\u63a5\u662f\u5426\u6b63\u5e38\n\n**Q: Claude Desktop\u4e2d\u770b\u4e0d\u5230MCP\u5de5\u5177**\nA: \u68c0\u67e5\u914d\u7f6e\u6587\u4ef6\u8def\u5f84\u548c\u683c\u5f0f\uff0c\u91cd\u542fClaude Desktop\n\n### \u8c03\u8bd5\u6a21\u5f0f\n\n```bash\n# \u542f\u7528\u8c03\u8bd5\u65e5\u5fd7\nexport MCP_LOG_LEVEL=DEBUG\nuv run x-pages-mcp-stdio\n```\n\n## \ud83d\udd17 \u76f8\u5173\u94fe\u63a5\n\n- [Model Context Protocol](https://modelcontextprotocol.io/)\n- [FastMCP Framework](https://github.com/jlowin/fastmcp)\n- [Claude Desktop MCP \u914d\u7f6e\u6587\u6863](https://docs.anthropic.com/en/docs/build-with-claude/computer-use)",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2024 X-Pages Team\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.",
"summary": "MCP server for X-Pages HTML deployment service",
"version": "0.1.4",
"project_urls": {
"Bug Tracker": "https://github.com/xingshulin/x-pages-mcp/issues",
"Documentation": "https://github.com/xingshulin/x-pages-mcp/blob/main/README.md",
"Homepage": "https://github.com/xingshulin/x-pages-mcp",
"Repository": "https://github.com/xingshulin/x-pages-mcp"
},
"split_keywords": [
"ai",
" claude",
" deployment",
" html",
" mcp",
" model-context-protocol"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e8aaeac6ed0a7ce3e2005d1b7698d7569492afff2c2a809af25d043217b92e04",
"md5": "39980690d1930d1c3bdaf7e1e08b49f6",
"sha256": "56a4f93d03f1b89fd4496f5ac5d27f43c77b4b7b9ed06224b48537bbbcd17d3a"
},
"downloads": -1,
"filename": "x_pages_mcp-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "39980690d1930d1c3bdaf7e1e08b49f6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 17740,
"upload_time": "2025-08-21T10:20:32",
"upload_time_iso_8601": "2025-08-21T10:20:32.237108Z",
"url": "https://files.pythonhosted.org/packages/e8/aa/eac6ed0a7ce3e2005d1b7698d7569492afff2c2a809af25d043217b92e04/x_pages_mcp-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "97c2c180633593c7c242846cc4e9edec9a0b99099ea1f64cf62ab3e0f74a1943",
"md5": "e218165907616056555d0af8f704e895",
"sha256": "38b6945c6cd8fe7738816b7a28c7329b0c1a7a16a564140a5423403d323ed5ee"
},
"downloads": -1,
"filename": "x_pages_mcp-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "e218165907616056555d0af8f704e895",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 102073,
"upload_time": "2025-08-21T10:20:34",
"upload_time_iso_8601": "2025-08-21T10:20:34.018648Z",
"url": "https://files.pythonhosted.org/packages/97/c2/c180633593c7c242846cc4e9edec9a0b99099ea1f64cf62ab3e0f74a1943/x_pages_mcp-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-21 10:20:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "xingshulin",
"github_project": "x-pages-mcp",
"github_not_found": true,
"lcname": "x-pages-mcp"
}