Steam市场MCP服务器
一个模型上下文协议(MCP)服务器,为Claude提供对Steam社区市场数据的访问。这个npm包使Claude能够搜索商品、获取定价信息、分析市场趋势,并从Steam市场检索历史数据。
特性
- 🔍 搜索市场项目:按名称、游戏或类别查找项目
- 💰 价格信息:获取当前市场价格和统计数据
- 📈 价格历史记录:分析历史价格趋势和模式
- 📋 市场列表:查看特定商品的当前市场列表
- 🔥 热门商品:发现热门和流行的市场商品
- ⚡ 高性能:内置缓存和速率限制
- 🛡️ 错误处理:强大的错误处理和重试机制
- 🎮 多游戏支持:适用于所有有市场项目的Steam游戏
安装
npm install steam-market-mcp-server或全局安装:
npm install -g steam-market-mcp-server快速开始
1.配置
创建一个 .env 文件(可选):
cp .env.example .env编辑 .env 使用您的偏好文件。蒸汽API键是可选的,但建议用于更好的速率限制。
2.启动服务器
# Using npm script
npm start
# Using the CLI
steam-market-mcp start
# Or with options
steam-market-mcp start --log-level DEBUG --verbose3.配置Claude
将服务器添加到您的Claude MCP配置中:
{
"mcpServers": {
"steam-market": {
"command": "steam-market-mcp",
"args": ["start"]
}
}
}CLI使用情况
该软件包包括一个功能强大的CLI,用于测试和管理:
基本命令
# Start the MCP server
steam-market-mcp start
# Test API connectivity
steam-market-mcp test
# Validate configuration
steam-market-mcp validate
# Search for items
steam-market-mcp search "AK-47" --app-id 730
# Get item price
steam-market-mcp price "AK-47 | Redline (Field-Tested)" --app-id 730
# Show common Steam App IDs
steam-market-mcp apps
# Cache management
steam-market-mcp cache --stats
steam-market-mcp cache --clearCLI选项
# Start with custom options
steam-market-mcp start --port 3001 --log-level DEBUG --verbose
# Test with specific parameters
steam-market-mcp test --query "knife" --app-id 730
# Search with limits
steam-market-mcp search "sticker" --app-id 730 --max 20Claude的可用工具
连接后,Claude可以使用这些工具:
1.搜索_市场_商品
在Steam社区市场中搜索商品。
参数:
query(必填):搜索词(例如,“AK-47”、“刀”、“贴纸”)appId(可选):在Steam应用程序ID中搜索category(可选):项目类别筛选器maxResults(可选):返回的最大结果(1-100,默认值:10)
例子:
Claude, search for CS2 knives under $1002.获取项目价格
获取特定商品的当前价格信息。
参数:
itemName(必填):准确的市场哈希名称appId(必填):Steam应用程序IDcurrency(可选):货币代码(默认值:美元)
例子:
Claude, what's the current price of "AK-47 | Redline (Field-Tested)" in CS2?3.获取价格历史
检索历史价格数据和趋势。
参数:
itemName(必填):准确的市场哈希名称appId(必填):Steam应用程序IDdays(可选):历史天数(1-365,默认值:30)
例子:
Claude, show me the price history for this knife over the past 90 days4.获取市场列表
获取某个商品的当前市场列表。
参数:
itemName(必填):准确的市场哈希名称appId(必填):Steam应用程序IDmaxListings(可选):返回的最大列表数(1-50,默认值:10)
5.获取热门商品
从市场上获取热门/流行商品。
参数:
appId(可选):用于筛选的Steam应用IDcategory(可选):项目类别筛选器limit(可选):返回的最大项目数(1-100,默认值:20)
例子:
Claude, what are the most popular CS2 items right now?常见Steam应用程序ID
| 游戏 | 应用ID |
|---|---|
| 反恐精英2 | 730 |
| Dota 2 | 570 |
| 《堡垒2》 | 440 |
| 锈蚀 | 252490 |
| 邮政编码:578080 | |
| 秋季男生 | 1097150 |
| 门户2 | 620 |
| 左4死2 | 550 |
| Garry's Mod | 4000 |
| 白天死亡 | 381210 |
配置选项
环境变量
# Steam API Configuration
STEAM_API_KEY=your_key_here # Optional but recommended
# Server Settings
PORT=3000 # Server port
LOG_LEVEL=INFO # ERROR, WARN, INFO, DEBUG
# Cache Settings
CACHE_TTL=300 # Cache TTL in seconds
CACHE_CHECK_PERIOD=120 # Cache cleanup interval
CACHE_USE_CLONES=true # Clone objects in cache
# Rate Limiting
RATE_LIMIT_WINDOW_MS=60000 # Rate limit window
RATE_LIMIT_MAX_REQUESTS=100 # Max requests per window程序化配置
import { SteamMarketMCPServer } from 'steam-market-mcp-server';
const server = new SteamMarketMCPServer();
await server.start();克劳德互动示例
价格分析
User: "What's the current market for CS2 knives under $200?"
Claude: I'll search for CS2 knives and analyze the pricing for you.
[Uses search_market_items with query="knife", appId=730]
[Uses get_item_price for relevant items]
Based on the current Steam market data, here are CS2 knives under $200:
1. ★ Falchion Knife | Scorched (Field-Tested) - $95.32
2. ★ Gut Knife | Rust Coat (Well-Worn) - $87.15
3. ★ Shadow Daggers | Forest DDPAT (Field-Tested) - $112.45
...市场趋势
User: "Show me the price trend for AK-47 Redline over the past month"
Claude: I'll get the price history for the AK-47 Redline.
[Uses get_price_history with itemName="AK-47 | Redline (Field-Tested)", appId=730, days=30]
Here's the 30-day price trend for AK-47 | Redline (Field-Tested):
The item has shown a steady upward trend, increasing from $18.32 to $21.45 (17% increase).
Key observations:
- Highest price: $22.10 on [date]
- Lowest price: $17.89 on [date]
- Average daily volume: 127 items
...发展
从源头构建
# Clone the repository
git clone https://github.com/yourusername/steam-market-mcp-server
cd steam-market-mcp-server
# Install dependencies
npm install
# Build the project
npm run build
# Run in development mode
npm run dev
# Run tests
npm test项目结构
src/
├── index.ts # Main MCP server
├── steam-api.ts # Steam API integration
├── cache.ts # Cache management
├── logger.ts # Logging system
├── config.ts # Configuration
├── types.ts # TypeScript types
├── schemas.ts # Validation schemas
└── cli.ts # Command line interface测试
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Test API connectivity
steam-market-mcp test
# Lint code
npm run lint
npm run lint:fix性能和限制
缓存
- 搜索结果:5分钟
- 价格数据:1分钟
- 价格历史:30分钟
- 上市时间:2分钟
- 热门项目:10分钟
速率限制
- 每秒向Steam API发出1次请求
- 对故障的指数级回退
- 出现速率限制错误时自动重试
蒸汽API限值
- 无API密钥:约200个请求/天
- 使用API密钥:每天100000次请求
- 某些端点可能有其他限制
故障排除
常见问题
- “蒸汽API错误:503”
- 蒸汽API暂时关闭 - 等待并重试
- “超出费率限制”
- 你的请求太多了 - 等待速率限制重置或获取Steam API密钥
- “未找到结果”
- 检查项目名称拼写 - 验证正确的应用程序ID - 有些商品可能无法销售
- 连接错误
- 检查互联网连接 - 验证防火墙设置 - Steam可能会阻止请求
调试
# Enable debug logging
steam-market-mcp start --log-level DEBUG --verbose
# Check cache statistics
steam-market-mcp cache --stats
# Clear cache if needed
steam-market-mcp cache --clear
# Test specific functionality
steam-market-mcp test --query "test" --app-id 730贡献
- 分叉存储库
- 创建要素分支
- 进行更改
- 添加测试
- 提交拉取请求
许可证
MIT许可证-有关详细信息,请参阅许可证文件。
支持
更新日志
看 更改日志.md 查看版本历史和更新。
