使用说明
距离计算器MCP服务器
该项目使用Google distance Matrix API计算两个位置之间的距离。
设置
-
安装依赖项:
pip install -r requirements.txt -
创建一个
config.ini项目根目录中的文件,内容如下:[google] api_key = YOUR_API_KEY替换
YOUR_API_KEY使用您的实际Google Distance Matrix API密钥。
运行应用程序
-
启动服务器:
uvicorn main:app --reload -
API将于
http://127.0.0.1:8000.
API使用
向发送POST请求 /distance JSON有效载荷如下:
{
"origin": {
"location": "90210"
},
"destination": {
"location": "New York, NY"
}
}
运行MCP服务器
-
请确保已在中配置API密钥
config.ini如“设置”部分所述。 -
启动MCP服务器:
python mcp_server.py -
MCP服务器将在
http://127.0.0.1:8001.
gemini CLI示例