关于 FlightAware MCP Server
FlightAware MCP Server 将 MCP 客户端连接到 FlightAware AeroAPI,提供航空数据工具,涵盖航班和机场运行、飞机信息、机场搜索及航班跟踪详情。
主要功能
- 01按标识查询航班
- 02列出机场到达和出发航班
- 03按尾号查询飞机信息
- 04按地区或查询词搜索机场
- 05获取详细航班运行数据
- 06支持 TCP 和 WebSocket 模式
适用场景
- 01查询特定航班信息
- 02查看机场到达或出发航班
- 03按尾号查找飞机
- 04按地区或关键词查找机场
MCP 相关
它通过 MCP 工具提供 FlightAware AeroAPI 的航班、机场和飞机数据,包括航班查询、机场运行、飞机查询、机场搜索及航班详情。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
FlightAware MCP 服务
用于将模型上下文协议(MCP)客户端连接到 FlightAware 的 AeroAPI,以获取实时航空数据的桥接服务。
功能
- 航班信息:获取特定航班的实时信息
- 机场运营:跟踪机场的到达和出发航班
- 飞机详情:通过尾号检索飞机信息
- 机场搜索:按地区、国家或自定义查询查找机场
- 详细跟踪:获取全面的航班运营详情
- 灵活的协议支持:支持 TCP 和 WebSocket 连接
- 轻松配置:通过环境变量或命令行简单设置
MCP 工具
此服务通过 MCP 接口提供以下工具:
getFlightByIdent
使用航班标识符获取特定航班的信息。
{
"id": "req123",
"method": "getFlightByIdent",
"params": {
"ident": "AAL100"
}
}
getFlightsForAirport
列出在特定机场到达或出发的航班。
{
"id": "req124",
"method": "getFlightsForAirport",
"params": {
"airport_code": "KJFK",
"arrivals": true,
"departures": true,
"type": "all"
}
}
getAircraftByTail
通过尾号获取特定飞机的信息。
{
"id": "req125",
"method": "getAircraftByTail",
"params": {
"tail": "N12345"
}
}
getAirportsByRegion
按国家、地区或自定义查询搜索机场。
{
"id": "req126",
"method": "getAirportsByRegion",
"params": {
"country": "US",
"region": "CA",
"query": "international"
}
}
getFlightDetails
获取特定航班的详细信息。
{
"id": "req127",
"method": "getFlightDetails",
"params": {
"ident": "AAL100"
}
}
配置
AeroAPI 密钥
使用此服务需要 FlightAware AeroAPI 密钥。
- 在 FlightAware AeroAPI 注册
- 按照其说明获取 API 密钥
安装
使用 NPX(无需安装)
使用 npx 直接运行:
npx flightaware-mcp --port 8080 --aeroapi-key YOUR_API_KEY
全局安装
全局安装后可从任意位置运行:
npm install -g flightaware-mcp
flightaware-mcp --port 8080 --aeroapi-key YOUR_API_KEY
本地安装
在项目中本地安装:
npm install flightaware-mcp
然后添加到你的 package.json 脚本中:
"scripts": {
"start-mcp": "flightaware-mcp --port 8080"
}
命令行选项
Usage: flightaware-mcp [options]
Options:
-V, --version output the version number
-p, --port <number> Port to listen on (default: "8080")
-k, --aeroapi-key <string> FlightAware AeroAPI key
-m, --mode <string> Server mode (tcp or ws) (default: "tcp")
-t, --timeout <number> Request timeout in milliseconds (default: "30000")
-d, --debug Enable debug mode with verbose logging
-h, --help display help for command
Notes:
- If you experience timeout errors (MCP error -32001), try increasing the timeout value.
- Debug mode will provide detailed logs about requests and timeouts.
- For n8n integrations, set a higher timeout value (60000 or more) if needed.
环境变量
你可以使用环境变量代替命令行参数:
AEROAPI_KEY=your_api_key
MCP_SERVER_PORT=8080
MCP_SERVER_MODE=tcp # or ws for WebSocket
MCP_REQUEST_TIMEOUT=60000 # timeout in milliseconds, increase if experiencing timeouts
DEBUG=true # enable debug mode with verbose logging
LOG_LEVEL=info # log level (error, warn, info, debug)
使用示例
MCP 客户端配置
对于支持服务配置的 MCP 客户端,可以使用以下配置:
{
"mcpServers": {
"flightaware": {
"command": "npx",
"args": [
"-y",
"flightaware-mcp"
],
"env": {
"AEROAPI_KEY": "YOUR_API_KEY_HERE"
}
}
}
}
MCP 客户端代码示例
const net = require('net');
const client = new net.Socket();
client.connect(8080, '127.0.0.1', () => {
console.log('Connected to MCP server');
// Request flight information
const request = {
id: 'req1',
method: 'getFlightByIdent',
params: {
ident: 'UAL123'
}
};
client.write(JSON.stringify(request) + '\n');
});
client.on('data', (data) => {
const response = JSON.parse(data.toString().trim());
console.log('Received response:', response);
client.end();
});
client.on('close', () => {
console.log('Connection closed');
});
使用内置客户端进行测试
此软件包包含一个便于测试的测试客户端:
# First, start the server
npm start
# In another terminal, run the test client
npm run client
开发
从源代码构建
# Clone the repository
git clone <repository-url>
cd flightaware-mcp
# Install dependencies
npm install
# Start development server
npm start
运行测试
npm test
代码检查
npm run lint
故障排除
超时错误
如果遇到超时错误(MCP error -32001: Request timed out),请尝试以下解决方案:
-
增加超时时间:
# With command line flightaware-mcp --timeout 60000 # With environment variables MCP_REQUEST_TIMEOUT=60000 flightaware-mcp -
启用调试模式以获取更多信息:
flightaware-mcp --debug -
检查网络连接:
- 确保服务具有稳定的互联网连接
- 检查是否有防火墙规则阻止出站请求
-
对于 n8n 集成:
- 设置更长的超时时间(60000ms 或更长)
- 确保 MCP 服务和 n8n 可以正常通信
- 尝试 TCP 和 WebSocket 模式(
--mode ws或--mode tcp)
-
检查 AeroAPI 速率限制:
- FlightAware AeroAPI 的速率限制取决于你的订阅
- 启用调试模式以查看详细的 API 响应信息
许可证
MIT
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。