RentCast MCP服务器
模型上下文协议(MCP)服务器,用于连接Claude和RentCast API。它提供了通过RentCast API访问房地产数据、估价和市场统计数据的工具。
需求
- Python 3.12或更高版本
- 模型上下文协议(MCP)Python SDK
- httpx
- python dotenv
设置
1.安装uv(推荐)
curl -LsSf https://astral.sh/uv/install.sh | sh2.克隆此存储库
git clone https://github.com/yourusername/rentcast-mcp-server.git
cd rentcast-mcp-server3.创建并激活虚拟环境
# Create virtual environment
uv venv
# Activate virtual environment
# On macOS/Linux:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate4.安装依赖项
# Option 1: Using uv (recommended)
uv sync
# Option 2: Using pip with requirements.txt
pip install -r requirements.txt
# Option 3: Install as editable package
uv pip install -e .5.设置环境变量
创建一个 .env 使用RentCast API密钥在项目根目录中创建文件:
RENTCAST_API_KEY=your_api_key_here用法
1.配置克劳德桌面
首先,全局安装MCP CLI:
uv tool install "mcp[cli]"然后将此服务器添加到您的Claude Desktop配置文件中(~/Library/Application Support/Claude/claude_desktop_config.json 在 macOS 上:
{
"mcpServers": {
"RentCast": {
"command": "/Users//.local/share/uv/tools/mcp/bin/mcp",
"args": ["run", "/full/path/to/rentcast-mcp-server/src/rentcast_mcp_server/server.py"]
}
}
}重要:替换 /full/path/to/ 与您的实际绝对路径 rentcast-mcp-server 目录。
保存配置后重新启动Claude Desktop。
2.与Claude一起使用MCP服务器
配置后,Claude Desktop将可以访问这些RentCast工具:
get_property_data:获取特定属性ID的详细属性数据get_property_valuation:获取房产价值估算get_rent_estimate:获取房产的租金估算get_market_statistics:获取邮政编码区域的市场统计数据get_property_listings:获取邮政编码区域内的活动房产列表
尝试使用Claude的示例查询:
- “获取邮政编码90210的市场统计数据”
- “显示邮政编码为10001的房产列表”
- 邮政编码02101的市场趋势是什么
开发和测试
安装开发依赖项,并使用以下命令运行测试套件:
uv sync --all-extras
pytest -v tests在本地运行服务器
要手动启动服务器(在开发或测试时很有用),请运行:
rentcast-mcp或者,您可以直接使用以下命令运行它:
uv run python src/rentcast_mcp_server/server.py全局安装MCP CLI
如果你想使用 mcp run 命令,全局安装MCP CLI:
uv tool install "mcp[cli]"然后你可以运行:
mcp run src/rentcast_mcp_server/server.py许可证
麻省理工学院
