内容
# Spheron Network MCP 插件
这个 MCP (模型上下文协议) 插件与 Spheron Protocol SDK 集成,提供通过 Claude 直接进行计算部署和管理的能力。
## 最近修复
- **ES模块兼容性**:修复了 fs-extra 导入,以便与 ES 模块正常工作
- **BigInt 序列化**:在 API 响应中添加了对 BigInt 值的正确处理,以防止 JSON 序列化错误
## 功能
- **部署计算资源**: 使用 YAML 配置部署计算资源
- **获取钱包余额**: 检查您不同代币的钱包余额
- **获取部署 URL**: 获取您当前活动部署的 URL
- **获取租约 ID 详情**: 获取有关租约的详细信息
## 安装
### 1. 克隆仓库
```bash
```
# 克隆仓库
git clone https://github.com/spheronFdn/spheron-mcp-plugin.git
# 导航到项目目录
cd spheron-mcp-plugin
```
### 2. 设置 Node.js 版本
#### 使用 nvm(推荐)
```bash
```
# 如果你还没有安装 nvm,请先安装它:
# 对于 macOS/Linux:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# 或者
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# 对于Windows(使用Windows子系统Linux或Git Bash):
# 请按照 https://github.com/nvm-sh/nvm 上的说明进行操作
# 重启你的终端或运行:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# 使用项目的 Node.js 版本(在 .nvmrc 中定义)
nvm use
# 如果你收到版本未安装的错误:
nvm install
nvm use
```
#### 不使用 nvm
如果您不使用 nvm,请确保您的系统 Node.js 版本为 16.0.0 或更高:
```bash
# 检查你的 Node.js 版本
node -v
# 如果版本低于 16.0.0,请从 nodejs.org 下载并安装
# https://nodejs.org/en/download/
```
### 3. 安装依赖并构建
```bash
```
# 导航到服务器目录
cd spheron-server
# 安装依赖
npm install
# 构建项目
npm run build
# 验证构建是否成功
ls -la build
```
构建过程将会:
1. 将 TypeScript 编译为 JavaScript
2. 使主文件可执行
3. 运行 Node.js 版本检查脚本
## 配置
### VS Code 配置
1. 找到或创建 MCP 设置文件:
```bash
# 对于Linux:
mkdir -p ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/
touch ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
# 对于 macOS:
mkdir -p ~/Library/Application\ Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/
touch ~/Library/Application\ Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
# 对于Windows:
# 在 %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json 创建文件
```
2. 使用你的配置编辑设置文件:
```bash
# 在您喜欢的编辑器中打开文件
# 例如:
nano ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
```
3. 找到 mcp-server 目录的绝对路径:
```bash
# 例如:
pwd
```
4. 添加以下配置(根据需要调整路径和密钥):
```json
{
"mcpServers": {
"spheron": {
"command": "node",
"args": [
"/absolute/path/to/spheron-mcp-plugin/mcp-server/build/index.js"
],
"env": {
"SPHERON_PRIVATE_KEY": "your-spheron-private-key",
"SPHERON_NETWORK": "testnet",
"PROVIDER_PROXY_URL": "https://provider-proxy.sphn.xyz",
"YAML_API_URL": "http://149.56.15.95:8080/generate"
},
"disabled": false,
"autoApprove": []
}
}
}
```
5. 或者使用 Docker 配置:
```json
{
"mcpServers": {
"spheron": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"SPHERON_PRIVATE_KEY",
"-e",
"SPHERON_NETWORK",
"-e",
"PROVIDER_PROXY_URL",
"-e",
"YAML_API_URL",
"saurrx/spheron-mcp:latest"
],
"env": {
"SPHERON_PRIVATE_KEY": "your-spheron-private-key",
"SPHERON_NETWORK": "testnet",
"PROVIDER_PROXY_URL": "https://provider-proxy.sphn.xyz",
"YAML_API_URL": "http://149.56.15.95:8080/generate"
},
"disabled": false,
"autoApprove": []
}
}
}
```
6. 保存文件并重启 VS Code
### Claude Desktop 配置
1. 找到或创建 Claude Desktop 配置文件:
```bash
# 对于 macOS:
mkdir -p ~/Library/Application\ Support/Claude/
touch ~/Library/Application\ Support/Claude/claude_desktop_config.json
# 对于Windows:
# 在 %APPDATA%\Claude\claude_desktop_config.json 创建文件
# 对于Linux:
mkdir -p ~/.config/Claude/
touch ~/.config/Claude/claude_desktop_config.json
```
2. 编辑配置文件:
```bash
# 在您喜欢的编辑器中打开文件
# 例如:
nano ~/Library/Application\ Support/Claude/claude_desktop_config.json
```
3. 添加以下配置(根据需要调整路径和密钥):
### Docker 配置
```json
{
"mcpServers": {
"spheron": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"SPHERON_PRIVATE_KEY",
"-e",
"SPHERON_NETWORK",
"-e",
"PROVIDER_PROXY_URL",
"-e",
"YAML_API_URL",
"saurrx/spheron-mcp:latest"
],
"env": {
"SPHERON_PRIVATE_KEY": "your-spheron-private-key",
"SPHERON_NETWORK": "testnet",
"PROVIDER_PROXY_URL": "https://provider-proxy.sphn.xyz",
"YAML_API_URL": "http://149.56.15.95:8080/generate"
},
"disabled": false,
"autoApprove": []
}
}
}
```
### 节点配置
找到 mcp-server 目录的绝对路径:
```bash
```
# 例如:
pwd
```
添加以下配置:
```json
{
"mcpServers": {
"spheron": {
"command": "node",
"args": [
"/absolute/path/to/spheron-mcp-plugin/mcp-server/build/index.js"
],
"env": {
"SPHERON_PRIVATE_KEY": "your-spheron-private-key",
"SPHERON_NETWORK": "testnet",
"PROVIDER_PROXY_URL": "https://provider-proxy.sphn.xyz",
"YAML_API_URL": "http://149.56.15.95:8080/generate"
},
"disabled": false,
"autoApprove": []
}
}
}
```
4. 保存文件并重启 Claude Desktop
### 光标配置
1. 找到或创建光标配置文件:
```bash
# 对于 macOS:
mkdir -p ~/Library/Application\ Support/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/
touch ~/Library/Application\ Support/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
# 对于Windows:
# 在 %APPDATA%\Cursor\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json 创建文件
# 对于Linux:
mkdir -p ~/.config/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/
touch ~/.config/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
```
2. 编辑配置文件:
```bash
# 在您喜欢的编辑器中打开文件
# 例如:
nano ~/.config/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
```
## 使用方法
安装完成后,您可以通过 Claude 使用 Spheron Protocol MCP 插件,使用以下命令:
### 部署计算
```
部署此计算配置:
version: "1.0"
services:
py-cuda:
image: quay.io/jupyter/pytorch-notebook:cuda12-pytorch-2.4.1
expose:
- port: 8888
as: 8888
to:
- global: true
env:
- JUPYTER_TOKEN=sentient
profiles:
name: py-cuda
duration: 2h
mode: provider
tier:
- community
compute:
py-cuda:
resources:
cpu:
units: 8
memory:
size: 16Gi
storage:
- size: 200Gi
gpu:
units: 1
attributes:
vendor:
nvidia:
- model: rtx4090
placement:
westcoast:
attributes:
region: us-central
pricing:
py-cuda:
token: CST
amount: 10
deployment:
py-cuda:
westcoast:
profile: py-cuda
count: 1
```
或者说:
```
在 Spheron 上部署此 jupyter notebook
```
### 检查钱包余额
```
我在 Spheron 上的 CST 余额是多少?
```
### 获取部署 URL
```
显示我租约 ID 为 12345 的部署 URL
```
### 获取租约详情
```
获取租约 ID 12345 的详情
```
## 环境变量
- `SPHERON_PRIVATE_KEY`: 您的 Spheron 私钥,用于身份验证
- `SPHERON_NETWORK`: 要使用的网络(测试网或主网)
- `PROVIDER_PROXY_URL`: 提供者代理服务器的 URL
- `YAML_API_URL`: YAML 生成 API 服务的 URL
## 许可证
MIT
连接信息
猜你喜欢
everything-claude-code
完整的 Claude Code 配置集合 - agents、skills、hooks、commands、rules、MCPs。来自 Anthropic...
Firecrawl
Firecrawl MCP Server 实现了网页抓取、爬虫和内容提取功能。
MarkItDown MCP
MarkItDown-MCP是一个轻量级服务器,用于将URI转换为Markdown。
cc-switch
跨平台的Claude Code、Codex和Gemini CLI一体化助手。
Agent-Reach
赋予你的AI Agent观察整个互联网的眼睛。读取并搜索...
servers
# 模型上下文协议服务器