Token导航 LogoToken导航TokenDH.com
Aerospace MCP logo
运维云端stdio官方级别未说明来源级核验

Aerospace MCP

MCP Server

一个全面的航空航天研究和飞行规划服务,提供HTTP API和模型上下文协议(MCP)集成,支持机场解析、航线计算、飞机性能估计和轨道力学计算。

工具数

44

提示词数

0

GitHub Stars

3

资源数

0
PythonClaude云端部署Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

cheesejaguar

提供方

cheesejaguar

最后核验

2026/5/17 20:22

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uv run aerospace-mcp-http

详细介绍

航空航天MCP-飞行计划API和MCP服务器

![Python 3.11+](https://www.python.org/downloads/) ![FastAPI](https://fastapi.tiangolo.com/) ![OpenAP](https://github.com/TUDelft-CNS-ATM/openap) ![MCP Compatible](https://modelcontextprotocol.io/) ![NumPy](https://numpy.org/) ![GPU Ready](https://cupy.dev/) ![License: MIT](https://opensource.org/licenses/MIT)

全面的航空航天研究和飞行计划服务,提供HTTP API和模型上下文协议(MCP)集成。建于 FastMCP 用于简化MCP服务器开发。具有智能机场分辨率、大圆航线计算、飞机性能估计、大气建模、坐标系变换、气动分析、螺旋桨性能建模、火箭轨迹优化、轨道力学计算和航空航天运行的航天器轨迹规划等功能。

⚠️ 安全免责声明

此软件仅用于教育、研究和开发目的

  • 不适用于真正的导航:不用于实际飞行计划或导航
  • 未认证:该系统未经任何航空当局认证
  • 仅估算:性能计算是理论估计
  • 无天气数据:不考虑天气、航行通告或空域限制
  • 无责任:作者对使用的任何后果不承担任何责任

对于真正的飞行计划,始终使用经过认证的航空软件,并咨询官方来源,包括航行通告、天气预报和空中交通管制。

🚀 快速开始

选项1:紫外线(推荐)

# Install UV (fast Python package manager)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone and setup
git clone https://github.com/cheesejaguar/aerospace-mcp.git
cd aerospace-mcp
uv venv && source .venv/bin/activate  # Windows: .venv\Scripts\activate
uv sync

# Copy env and configure (optional but recommended)
cp .env.example .env
# Edit .env as needed (host/port/log level, optional LLM tools)

# Run HTTP server (package entrypoint)
uv run aerospace-mcp-http

# Alternatively (developer style)
uvicorn main:app --reload --host 0.0.0.0 --port 8080

# Test the API
curl "http://localhost:8080/health"

选项2:Docker

git clone https://github.com/cheesejaguar/aerospace-mcp.git
cd aerospace-mcp
docker build -t aerospace-mcp .
docker run -p 8080:8080 aerospace-mcp

# Test the API
curl "http://localhost:8080/health"

选项3:MCP客户端(克劳德桌面)

添加到您的Claude Desktop配置中:

{
  "mcpServers": {
    "aerospace-mcp": {
      "command": "uv",
      "args": ["run", "aerospace-mcp"],
      "cwd": "/path/to/aerospace-mcp",
      "env": {
        "LLM_TOOLS_ENABLED": "true",
        "OPENAI_API_KEY": "your-openai-api-key-here"
      }
    }
  }
}

备注:The env 部分是可选的,只有当您想启用AI驱动的代理工具以增强用户体验时才需要。

MCP通过CLI

# Start the MCP server (stdio)
uv run aerospace-mcp

# Start in SSE mode (optional)
uv run aerospace-mcp sse 0.0.0.0 8001

📋 目录

✨ 特性

核心能力

  • 机场决议:智能城市到机场地图,全球28000多个机场
  • 路线规划:具有测地线精度的大圆距离计算
  • 性能估计:通过OpenAP计算飞机特定燃料和时间
  • 大气建模:ISA大气剖面图,可选增强精度
  • 坐标变换:ECEF、ECI、用于航空航天分析的大地坐标系转换
  • 多个接口:HTTP REST API和模型上下文协议(MCP)支持
  • 实时处理:飞行计划请求的响应时间低于秒

空间和轨道力学能力

  • 🛰️ 轨道元素和状态向量:开普勒元素和笛卡尔状态向量之间的转换
  • 🌍 轨道传播:使用RK4方法对J2扰动进行数值积分
  • 🗺️ 地面轨迹计算:计算卫星地面轨迹,用于任务规划
  • 🔄 霍曼转让:计算最佳双脉冲轨道转移
  • 🤝 轨道交会:规划多机动交会序列
  • 🎯 轨迹优化:遗传算法和粒子群优化
  • 📊 不确定性分析:用于轨道鲁棒性评估的蒙特卡洛抽样
  • 🚀 朗伯问题:给定飞行时间的两体轨迹确定

支持的操作

  • ✅ 按城市名称或IATA代码搜索机场
  • ✅ 基于折线生成的飞行路线规划
  • ✅ 飞机性能评估(190+种飞机类型)
  • ✅ 燃油消耗和飞行时间计算
  • ✅ 大圆距离计算
  • ✅ 多段行程规划
  • ✅ 飞机对比分析
  • ✅ 大气剖面计算(ISA标准大气)
  • ✅ 风廓线建模(对数/幂律)
  • ✅ 坐标系变换(ECEF、ECI、大地测量)
  • ✅ 机翼空气动力学分析(VLM,升力线理论)
  • ✅ 翼型极性生成和数据库访问
  • ✅ 飞机稳定性导数计算
  • ✅ 螺旋桨性能分析(BEMT)
  • ✅ 无人机能量优化与续航能力估算
  • ✅ 电机螺旋桨匹配分析
  • ✅ 大气一体化三维自由度火箭弹道仿真
  • ✅ 用于任务规划的火箭尺寸估算
  • ✅ 优化发射角度以获得最佳性能
  • ✅ 利用梯度下降法优化推力剖面
  • ✅ 设计研究的轨迹灵敏度分析
  • ✅ 系统能力发现和状态报告
  • 轨道力学计算 (开普勒元素、状态向量、传播)
  • 地面轨迹计算 用于卫星跟踪和可视化
  • 霍曼转移计划 用于轨道机动和任务设计
  • 轨道交会规划 用于航天器近距离运行
  • 轨迹优化 利用遗传算法和粒子群优化
  • 蒙特卡罗不确定性分析 用于弹道鲁棒性评估
  • 兰伯特问题解决 用于确定两体轨迹
  • 猪排地块生成 行星际转移机会分析
  • 可选SPICE集成 回退到简化星历模型
  • 密度高度计算 用于绩效规划
  • 空速转换 (IAS/CAS/EAS/TAS/Mach)
  • 失速速度计算 适用于不同的配置
  • 重量和平衡 CG极限计算
  • 起飞/着陆性能 距离和V速度
  • 燃料储备计算 根据FAR/IICAO规定
  • 卡尔曼滤波器状态估计 用于传感器融合
  • LQR控制器设计 用于最优控制

技术特性

  • 🚀 快速:用于微秒级查找的内存中机场数据库
  • 🔧 灵活的:可插拔后端系统(目前为OpenAP)
  • 📊 准确的:使用WGS84测地线计算
  • 🌐 标准:遵循国际民航组织飞机代码和国际航空运输协会机场代码
  • 🔒 可靠的:全面的错误处理和优雅的降级
  • 📚 有据可查的:完整的API文档及示例
  • 硬件优化:支持CuPy GPU加速的NumPy矢量化
  • 🔄 批处理:矢量化运算,实现高效批量计算
  • 🔍 工具发现:动态工具搜索,从44+个可用工具中查找相关工具

💾 安装

系统要求

  • python:3.11+(建议使用3.12+以获得最佳性能)
  • 记忆:最低512MB RAM(建议1GB以上)
  • 存储:200MB可用空间
  • 网络:用于初始设置的Internet连接

方法1:UV包管理器(推荐)

UV是最快的Python包管理器,提供了出色的依赖解析:

# Install UV
curl -LsSf https://astral.sh/uv/install.sh | sh  # Linux/macOS
# Or: powershell -c "irm https://astral.sh/uv/install.ps1 | iex"  # Windows

# Clone repository
git clone https://github.com/cheesejaguar/aerospace-mcp.git
cd aerospace-mcp

# Create virtual environment
uv venv
source .venv/bin/activate  # Linux/macOS
# .venv\Scripts\activate     # Windows

# Install dependencies
uv add fastapi uvicorn[standard] airportsdata geographiclib pydantic python-dotenv
uv add openap  # Optional: for performance estimates
uv add mcp     # Optional: for MCP server functionality

# Install optional aerospace analysis dependencies
uv add --optional-dependencies atmosphere  # Ambiance for enhanced ISA
uv add --optional-dependencies space      # Astropy for coordinate frames
uv add --optional-dependencies all        # All optional dependencies

# Install development dependencies (optional)
uv add --dev pytest httpx black isort mypy pre-commit

# Verify installation
python -c "import main; print('✅ Installation successful')"

方法2:Pip(传统)

# Clone repository
git clone https://github.com/cheesejaguar/aerospace-mcp.git
cd aerospace-mcp

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # Linux/macOS
# .venv\Scripts\activate     # Windows

# Upgrade pip
pip install --upgrade pip

# Install core dependencies
pip install fastapi uvicorn[standard] airportsdata geographiclib pydantic python-dotenv

# Install optional dependencies
pip install openap  # For performance estimates
pip install mcp     # For MCP server
pip install python-dotenv  # For loading .env in local/dev

# Install from pyproject.toml
pip install -e .

# Verify installation
python -c "import main; print('✅ Installation successful')"

方法三:Docker

# Clone repository
git clone https://github.com/cheesejaguar/aerospace-mcp.git
cd aerospace-mcp

# Build image
docker build -t aerospace-mcp .

# Run container
docker run -d -p 8080:8080 --name aerospace-mcp aerospace-mcp

# Health check
curl http://localhost:8080/health

# View logs
docker logs aerospace-mcp

# Stop container
docker stop aerospace-mcp

方法4:康达/曼巴

# Create conda environment
conda create -n aerospace-mcp python=3.11
conda activate aerospace-mcp

# Clone repository
git clone https://github.com/cheesejaguar/aerospace-mcp.git
cd aerospace-mcp

# Install dependencies
conda install fastapi uvicorn pydantic
pip install airportsdata geographiclib openap mcp

# Verify installation
python -c "import main; print('✅ Installation successful')"

安装故障排除

常见问题

OpenAP安装问题:

# Try these alternatives if OpenAP fails to install
pip install openap --no-cache-dir
pip install openap --force-reinstall
# Or install without OpenAP (performance estimates will be unavailable)

GeographicLib问题:

# Install system dependencies (Ubuntu/Debian)
sudo apt-get install libproj-dev proj-data proj-bin

# Install system dependencies (macOS)
brew install proj

# Install system dependencies (Windows)
# Download from: https://proj.org/download.html

导入错误:

# Verify your Python environment
python --version  # Should be 3.11+
pip list | grep -E "(fastapi|openap|airportsdata)"

# Test individual imports
python -c "import fastapi; print('FastAPI OK')"
python -c "import airportsdata; print('AirportsData OK')"
python -c "import openap; print('OpenAP OK')" || echo "OpenAP not available (optional)"

🎯 使用示例

HTTP API示例

基本飞行计划

# Plan a simple flight
curl -X POST "http://localhost:8080/plan" \
  -H "Content-Type: application/json" \
  -d '{
    "depart_city": "San Francisco",
    "arrive_city": "New York",
    "ac_type": "A320",
    "cruise_alt_ft": 37000,
    "backend": "openap"
  }'

机场搜索

# Find airports by city
curl "http://localhost:8080/airports/by_city?city=Tokyo"

# Filter by country
curl "http://localhost:8080/airports/by_city?city=London&country=GB"

# Multiple results
curl "http://localhost:8080/airports/by_city?city=Paris"

高级飞行计划

# Specify exact airports and aircraft mass
curl -X POST "http://localhost:8080/plan" \
  -H "Content-Type: application/json" \
  -d '{
    "depart_city": "Los Angeles",
    "arrive_city": "Tokyo",
    "prefer_depart_iata": "LAX",
    "prefer_arrive_iata": "NRT",
    "ac_type": "B777",
    "cruise_alt_ft": 39000,
    "mass_kg": 220000,
    "route_step_km": 100.0,
    "backend": "openap"
  }'

Python客户端示例

普通客户端

import requests
import json

class AerospaceClient:
    def __init__(self, base_url="http://localhost:8080"):
        self.base_url = base_url

    def plan_flight(self, departure, arrival, aircraft="A320", altitude=35000):
        """Plan a flight between two cities."""
        response = requests.post(f"{self.base_url}/plan", json={
            "depart_city": departure,
            "arrive_city": arrival,
            "ac_type": aircraft,
            "cruise_alt_ft": altitude,
            "backend": "openap"
        })
        return response.json()

    def find_airports(self, city, country=None):
        """Find airports in a city."""
        params = {"city": city}
        if country:
            params["country"] = country
        response = requests.get(f"{self.base_url}/airports/by_city", params=params)
        return response.json()

# Usage
client = AerospaceClient()

# Find airports
airports = client.find_airports("Sydney", "AU")
print(f"Sydney has {len(airports)} airports")

# Plan flight
plan = client.plan_flight("Sydney", "Melbourne", "B737")
print(f"Flight distance: {plan['distance_nm']:.0f} NM")
print(f"Flight time: {plan['estimates']['block']['time_min']:.0f} minutes")

批处理

import asyncio
import aiohttp
from typing import List, Dict

async def plan_multiple_flights(flights: List[Dict]) -> List[Dict]:
    """Plan multiple flights concurrently."""
    async with aiohttp.ClientSession() as session:
        tasks = []
        for flight in flights:
            task = plan_single_flight(session, flight)
            tasks.append(task)

        results = await asyncio.gather(*tasks, return_exceptions=True)
        return results

async def plan_single_flight(session, flight_data):
    """Plan a single flight."""
    async with session.post(
        "http://localhost:8080/plan",
        json=flight_data
    ) as response:
        return await response.json()

# Example usage
flights_to_plan = [
    {"depart_city": "New York", "arrive_city": "London", "ac_type": "A330"},
    {"depart_city": "London", "arrive_city": "Dubai", "ac_type": "B777"},
    {"depart_city": "Dubai", "arrive_city": "Singapore", "ac_type": "A350"}
]

# Run the batch planning
results = asyncio.run(plan_multiple_flights(flights_to_plan))
for i, result in enumerate(results):
    if not isinstance(result, Exception):
        print(f"Flight {i+1}: {result['distance_nm']:.0f} NM, {result['estimates']['block']['time_min']:.0f} min")

轨道力学示例

Python示例

import requests

class OrbitalMechanicsClient:
    def __init__(self, base_url="http://localhost:8080"):
        self.base_url = base_url

    def plan_hohmann_transfer(self, r1_km, r2_km):
        """Calculate Hohmann transfer between two circular orbits."""
        response = requests.post(f"{self.base_url}/hohmann_transfer", json={
            "r1_m": r1_km * 1000,  # Convert to meters
            "r2_m": r2_km * 1000
        })
        return response.json()

    def propagate_satellite_orbit(self, elements, duration_hours):
        """Propagate satellite orbit with J2 perturbations."""
        response = requests.post(f"{self.base_url}/propagate_orbit_j2", json={
            "initial_state": elements,
            "time_span_s": duration_hours * 3600,
            "time_step_s": 300  # 5-minute steps
        })
        return response.json()

# Example usage
client = OrbitalMechanicsClient()

# Plan a GTO to GEO transfer
gto_alt = 200    # km (perigee)
geo_alt = 35786  # km (GEO altitude)

transfer = client.plan_hohmann_transfer(
    6378 + gto_alt,  # Earth radius + altitude
    6378 + geo_alt
)

print(f"Transfer Delta-V: {transfer['delta_v_total_ms']/1000:.2f} km/s")
print(f"Transfer Time: {transfer['transfer_time_h']:.1f} hours")

# Propagate ISS orbit for one day
iss_elements = {
    "semi_major_axis_m": 6793000,  # ~415 km altitude
    "eccentricity": 0.0001,
    "inclination_deg": 51.6,
    "raan_deg": 0.0,
    "arg_periapsis_deg": 0.0,
    "true_anomaly_deg": 0.0,
    "epoch_utc": "2024-01-01T12:00:00"
}

orbit_states = client.propagate_satellite_orbit(iss_elements, 24)
print(f"Propagated {len(orbit_states)} orbital states over 24 hours")

轨迹优化示例

# Optimize a lunar transfer trajectory
def optimize_lunar_transfer():
    initial_trajectory = [
        {
            "time_s": 0,
            "position_m": [6700000, 0, 0],      # LEO
            "velocity_ms": [0, 7500, 0]
        },
        {
            "time_s": 86400 * 3,  # 3 days
            "position_m": [384400000, 0, 0],    # Moon distance
            "velocity_ms": [0, 1000, 0]
        }
    ]

    response = requests.post("http://localhost:8080/genetic_algorithm_optimization", json={
        "initial_trajectory": initial_trajectory,
        "objective": "minimize_delta_v",
        "constraints": {
            "max_thrust_n": 50000,
            "max_acceleration_ms2": 10
        }
    })

    result = response.json()
    print(f"Optimized Delta-V: {result['total_delta_v_ms']/1000:.2f} km/s")
    print(f"Flight Time: {result['flight_time_s']/86400:.1f} days")
    return result

optimized_trajectory = optimize_lunar_transfer()

# Generate porkchop plot for Mars mission planning
def plan_mars_mission():
    response = requests.post("http://localhost:8080/porkchop_plot_analysis", json={
        "departure_body": "Earth",
        "arrival_body": "Mars",
        "min_tof_days": 200,
        "max_tof_days": 300
    })

    analysis = response.json()

    if analysis["summary_statistics"]["feasible_transfers"] > 0:
        optimal = analysis["optimal_transfer"]
        print(f"Optimal Mars Transfer:")
        print(f"  Launch: {optimal['departure_date']}")
        print(f"  Arrival: {optimal['arrival_date']}")
        print(f"  C3: {optimal['c3_km2_s2']:.2f} km²/s²")
        print(f"  Flight Time: {optimal['time_of_flight_days']:.0f} days")
    else:
        print("No feasible transfers found in date range")

plan_mars_mission()

JavaScript/TypeScript示例

interface FlightPlan {
  depart_city: string;
  arrive_city: string;
  ac_type: string;
  cruise_alt_ft?: number;
  backend: "openap";
}

class AerospaceAPI {
  constructor(private baseUrl: string = "http://localhost:8080") {}

  async planFlight(request: FlightPlan) {
    const response = await fetch(`${this.baseUrl}/plan`, {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify(request),
    });

    if (!response.ok) {
      throw new Error(`API Error: ${response.statusText}`);
    }

    return await response.json();
  }

  async findAirports(city: string, country?: string) {
    const params = new URLSearchParams({ city });
    if (country) params.append("country", country);

    const response = await fetch(`${this.baseUrl}/airports/by_city?${params}`);
    return await response.json();
  }
}

// Usage
const api = new AerospaceAPI();

try {
  const plan = await api.planFlight({
    depart_city: "Boston",
    arrive_city: "Seattle",
    ac_type: "B737",
    cruise_alt_ft: 36000,
    backend: "openap"
  });

  console.log(`Flight planned: ${plan.distance_nm} NM`);
  console.log(`Estimated time: ${plan.estimates.block.time_min} minutes`);
} catch (error) {
  console.error("Flight planning failed:", error);
}

🏗️ 建筑

系统概述

graph TB
    Users[Users/Clients] --> API[FastAPI REST API]
    Users --> MCP[MCP Server]

    API --> Core[Core Services]
    MCP --> Core

    subgraph "Core Services"
        Airport[Airport Resolution]
        Route[Route Calculation]
        Perf[Performance Estimation]
    end

    subgraph "Data Sources"
        AirportDB[Airport Database
28,000+ airports]
        OpenAP[OpenAP Models
190+ aircraft]
        Geodesic[GeographicLib
WGS84 calculations]
    end

    Airport --> AirportDB
    Route --> Geodesic
    Perf --> OpenAP

关键组件

  1. FastAPI应用程序 (main.py)

- HTTP客户端的RESTful端点 - 自动生成的OpenAPI文档 - 使用Pydantic进行请求/响应验证

  1. MCP服务器 (aerospace_mcp/fastmcp_server.py)

- 通过FastMCP实现模型上下文协议 - 基于工具的AI助手界面 - 异步请求处理

  1. 核心服务

- 机场决议城市→ 智能选择机场地图 - 路线计算:具有折线生成功能的大圆路径 - 性能估计:基于OpenAP的燃料和时间计算

  1. 数据层

- 内存中的机场数据库:启动时已装载28000多个机场 - OpenAP集成:飞机性能模型 - GeographicLib:精确的测地线计算

设计原则

  • 性能优先:用于亚毫秒查找的内存数据结构
  • 故障弱化:在没有可选依赖关系的情况下工作
  • 类型安全:完整的类型提示和Pydantic验证
  • 可扩展:新后端的插件架构
  • 遵从标准:国际民航组织、国际航空运输协会和OpenAP标准
  • 硬件不可知:NumPy/CuPy抽象,实现CPU/GPU灵活性

🚀 快速MCP迁移

该项目已经 从传统的MCP SDK迁移到FastMCP,显著改善了开发人员体验和代码可维护性。

什么是FastMCP?

FastMCP 是一个用于构建模型上下文协议服务器的高级Python框架。它大大减少了样板代码,同时保持了完全的MCP兼容性。

移民福利

代码减少70%:工具定义从冗长的JSON模式变成了简单的Python装饰器 ✅ 更好的类型安全性:根据类型提示自动生成架构 ✅ 更清洁的建筑:跨逻辑域的模块化工具组织 ✅ 提高可维护性:更易于阅读和扩展的Python代码 ✅ 完全兼容:相同的MCP协议,适用于所有现有客户端

之前vs之后

之前(传统MCP SDK):

Tool(
    name="search_airports",
    description="Search for airports by IATA code or city name",
    inputSchema={
        "type": "object",
        "properties": {
            "query": {"type": "string", "description": "IATA code or city name"},
            "country": {"type": "string", "description": "Optional country filter"},
            "query_type": {"type": "string", "enum": ["iata", "city", "auto"]}
        },
        "required": ["query"]
    }
)

@server.call_tool()
async def handle_call_tool(name: str, arguments: dict):
    if name == "search_airports":
        return await _handle_search_airports(arguments)
    # ... 40+ more tool handlers

之后(FastMCP):

@mcp.tool
def search_airports(
    query: str,
    country: str | None = None,
    query_type: Literal["iata", "city", "auto"] = "auto"
) -> str:
    """Search for airports by IATA code or city name."""
    # Implementation here

架构改进

FastMCP重构引入了 模块化架构 使用按领域组织的工具:

  • tools/core.py -核心飞行计划(搜索、计划、距离、性能)
  • tools/atmosphere.py -大气建模和风分析
  • tools/frames.py -坐标系变换
  • tools/aerodynamics.py -机翼分析和翼型极性
  • tools/propellers.py -螺旋桨BEMT和无人机能量分析
  • tools/rockets.py -火箭轨迹和尺寸
  • tools/orbits.py -轨道力学与传播
  • tools/optimization.py -轨迹优化算法

集成模块 使用NumPy矢量化:

  • integrations/_array_backend.py -用于GPU支持的NumPy/CuPy抽象层
  • integrations/atmosphere.py -矢量化ISA大气计算
  • integrations/aero.py -矢量化空气动力学计算
  • integrations/rockets.py -矢量化轨迹集成
  • integrations/frames.py -矢量坐标变换

兼容性说明

  • 入口点:现在使用 aerospace_mcp.fastmcp_server:run
  • 依赖项:包括 fastmcp>=2.11.3 而不是生的 mcp
  • 服务器名称:仍然 aerospace-mcp 为了客户端兼容性
  • 所有工具:所有44个工具都保持完全相同的名称和参数

⚙️ 配置(.env)

HTTP服务器和MCP服务器都会自动从本地加载环境变量 .env (通过 python-dotenv).

  • AEROSPACE_MCP_MODE: httpmcp (Docker入口点开关)
  • AEROSPACE_MCP_HOST:绑定HTTP主机(默认 0.0.0.0)
  • AEROSPACE_MCP_PORT:HTTP端口(默认 8080)
  • AEROSPACE_MCP_LOG_LEVEL: debug|info|warning|error (默认值 info)
  • AEROSPACE_MCP_ENV: development|production (控件重新加载)
  • LLM_TOOLS_ENABLED: true|false 启用AI代理工具(默认 false)
  • OPENAI_API_KEY:如果启用了LLM工具,则需要

示例 .env:

AEROSPACE_MCP_MODE=http
AEROSPACE_MCP_HOST=0.0.0.0
AEROSPACE_MCP_PORT=8080
AEROSPACE_MCP_LOG_LEVEL=debug
LLM_TOOLS_ENABLED=false
# OPENAI_API_KEY=sk-...

⚡ 演出

基准测试

操作响应时间吞吐量内存使用情况
健康检查\<1ms10000+请求/秒~5MB
机场搜索1-5ms1000+要求/秒~50MB
飞行计划200-500ms5-10req/sec~100MB
距离计算10-50ms100+要求/秒~50MB

优化提示

  1. 路线解析:使用较大的 route_step_km 更快处理的值
  2. 缓存:为重复请求实现客户端缓存
  3. 批处理:对多个并发请求使用异步客户端
  4. 记忆:增加可用RAM以提高OpenAP性能

缩放注意事项

  • 水平扩展:无状态设计允许多个实例
  • 负载均衡:标准HTTP负载平衡器工作良好
  • 数据库:考虑大规模的机场数据外部数据库
  • 缓存:为跨实例的共享缓存添加Redis

GPU加速(CuPy)

使用NumPy的矢量化操作优化了航空航天计算,并在支持CUDA的硬件上添加了CuPy后端,用于GPU加速。

启用GPU加速

# In your code, before using aerospace functions:
from aerospace_mcp.integrations._array_backend import set_backend, get_backend_info

# Check available backends
print(get_backend_info())
# {'current_backend': 'numpy', 'numpy_available': True, 'cupy_available': True, ...}

# Switch to GPU (requires CuPy and CUDA)
set_backend('cupy')

# Switch back to CPU
set_backend('numpy')

安装CuPy

# For CUDA 11.x
pip install cupy-cuda11x

# For CUDA 12.x
pip install cupy-cuda12x

# Auto-detect CUDA version
pip install cupy

支持GPU的模块

以下集成模块通过阵列后端支持GPU加速:

模块操作加速(GPU与CPU)
atmosphere.pyISA计算,风廓线大批量为10-50x
aero.py机翼分析,翼型极α扫掠为5-20x
rockets.py轨迹集成、性能分析3-10x
frames.py坐标转换(批处理)20-100x用于大型数据集

备注:GPU加速为1000多个数据点的批处理操作提供了最大的好处。对于单次计算,由于GPU传输开销,CPU(NumPy)通常更快。

📖 API 文档

交互式文档

运行服务器时,API综合文档可在以下位置获得:

  • Swagger用户界面: http://localhost:8080/docs
  • ReDoc: http://localhost:8080/redoc
  • OpenAPI架构: http://localhost:8080/openapi.json

核心终点

GET/健康

健康检查和系统状态。

响应:

{
  "status": "ok",
  "openap": true,
  "airports_count": 28756
}

GET/机场/城市

按城市名称搜索机场。

参数:

  • city (必填):要搜索的城市名称
  • country (可选):ISO国家代码过滤器

示例: GET /airports/by_city?city=London&country=GB

POST/计划

生成完整的飞行计划。

请求正文:

{
  "depart_city": "San Francisco",
  "arrive_city": "New York",
  "ac_type": "A320",
  "cruise_alt_ft": 37000,
  "mass_kg": 65000,
  "route_step_km": 25.0,
  "backend": "openap"
}

响应:完整的飞行计划,包括路线折线和性能估计。

错误处理

所有端点都返回标准HTTP状态代码:

  • 200:成功
  • 400:请求错误(参数无效)
  • 404:未找到(未找到机场/城市)
  • 501:未实现(后端不可用)

错误响应包括详细消息:

{
  "detail": "departure: IATA 'XYZ' not found."
}

🤖 MCP集成

支持的MCP客户端

  • 克劳德桌面:本地集成
  • VS代码继续:插件支持
  • 自定义客户端:标准MCP协议

可用工具

工具说明参数
search_airports按IATA或城市查找机场query, country, query_type
plan_flight完整的飞行计划departure, arrival, aircraft, route_options
calculate_distance大圆距离origin, destination, step_km
get_aircraft_performance性能估计aircraft_type, distance_km, cruise_altitude
get_atmosphere_profileISA大气条件altitudes_m, model_type
wind_model_simple风廓线计算altitudes_m, surface_wind_mps, model
transform_frames坐标变换xyz, from_frame, to_frame, epoch_iso
geodetic_to_ecefLat/lon到ECEF的转换latitude_deg, longitude_deg, altitude_m
ecef_to_geodeticECEF到lat/lon转换x, y, z
wing_vlm_analysis机翼空气动力学分析(VLM)geometry, alpha_deg_list, mach
airfoil_polar_analysis翼型极性发电airfoil_name, alpha_deg_list, reynolds, mach
calculate_stability_derivatives稳定性导数计算geometry, alpha_deg, mach
propeller_bemt_analysis螺旋桨性能(BEMT)geometry, rpm_list, velocity_ms, altitude_m
uav_energy_estimate无人机续航能力和能量分析uav_config, battery_config, mission_profile
get_airfoil_database可用翼型系数
get_propeller_database可用螺旋桨数据
rocket_3dof_trajectory3自由度火箭弹道仿真geometry, dt_s, max_time_s, launch_angle_deg
estimate_rocket_sizing根据任务要求确定火箭尺寸target_altitude_m, payload_mass_kg, propellant_type
optimize_launch_angle发射角度优化geometry, objective, angle_bounds
optimize_thrust_profile推力剖面优化geometry, burn_time_s, total_impulse_target, n_segments, objective
trajectory_sensitivity_analysis参数敏感性分析base_geometry, parameter_variations, objective
get_system_status系统运行状况和功能
elements_to_state_vector将轨道元素转换为状态向量elements
state_vector_to_elements将状态向量转换为轨道元素state_vector
propagate_orbit_j2J2扰动下的传播轨道initial_state, time_span_s, time_step_s
calculate_ground_track计算卫星地面轨迹orbit_states, time_step_s
hohmann_transfer计算霍曼转移轨道r1_m, r2_m
orbital_rendezvous_planning计划轨道交会机动chaser_elements, target_elements
genetic_algorithm_optimization基于遗传算法的轨迹优化initial_trajectory, objective, constraints
particle_swarm_optimization基于粒子群算法的轨迹优化initial_trajectory, objective, constraints
monte_carlo_uncertainty_analysis蒙特卡罗轨迹不确定性分析trajectory, uncertainty_params, num_samples
porkchop_plot_analysis生成行星际转移的porkchop图departure_body, arrival_body, departure_dates, arrival_dates, min_tof_days, max_tof_days
search_aerospace_tools按名称、描述或功能搜索工具query, search_type, max_results, category
list_tool_categories列出所有可用的工具类别及其计数
lambert_problem_solver解决朗伯轨道转移问题r1_m, r2_m, tof_s, direction, central_body
density_altitude_calculator根据压力高度和温度计算密度高度pressure_altitude_ft, temperature_c
true_airspeed_converter在IAS/CAS/EAS/TAS/Mach之间转换speed_value, speed_type, altitude_ft, temperature_c
stall_speed_calculator计算不同配置的失速速度weight_kg, wing_area_m2, cl_max_clean, cl_max_landing
weight_and_balance计算飞机重量和重心位置basic_empty_weight_kg, fuel_kg, payload_items
takeoff_performance计算起飞距离和V速度weight_kg, pressure_altitude_ft, temperature_c, wind_kts
landing_performance计算着陆距离和进场速度weight_kg, pressure_altitude_ft, temperature_c, runway_condition
fuel_reserve_calculator根据规定计算所需的燃料储备regulation, trip_fuel_kg, cruise_fuel_flow_kg_hr
kalman_filter_state_estimation基于卡尔曼滤波器的状态估计initial_state, measurements, process_noise
lqr_controller_design设计LQR最优控制器A_matrix, B_matrix, Q_matrix, R_matrix

Claude桌面设置

  1. 打开克劳德桌面设置
  2. 添加服务器配置:
{
  "mcpServers": {
    "aerospace-mcp": {
      "command": "uv",
      "args": ["run", "aerospace-mcp"],
      "cwd": "/path/to/aerospace-mcp"
    }
  }
}
  1. 重新启动克劳德桌面
  2. 测试:“搜索东京机场”

工具发现

MCP服务器提供44多种航空航天工具,包括 工具搜索工具 跟随 Anthropic指南 对于动态工具发现:

# Search by natural language
search_aerospace_tools("atmospheric pressure altitude")
# Returns: get_atmosphere_profile, wind_model_simple, ...

# Search by regex pattern
search_aerospace_tools("(?i)orbit", search_type="regex")
# Returns: propagate_orbit_j2, elements_to_state_vector, hohmann_transfer, ...

# Filter by category
search_aerospace_tools("calculate", category="orbits")
# Returns only orbital mechanics tools matching "calculate"

# List all categories
list_tool_categories()
# Returns: core, atmosphere, frames, aerodynamics, propellers, rockets, orbits, gnc, performance, optimization, agents

可用类别:

  • 核心:飞行计划、机场、距离、飞机性能
  • 氛围:ISA剖面图、风建模
  • :坐标变换(ECEF、ECI、大地测量)
  • 空气动力学:机翼分析、翼型极性、稳定性导数
  • 螺旋桨:BEMT分析、无人机能量估算
  • 火箭:3自由度弹道、尺寸、发射优化
  • 轨道:轨道要素、传播、转移、交会、朗伯求解器
  • 优化:遗传算法、粒子群优化、蒙特卡洛、猪肉店图
  • 健安喜:卡尔曼滤波器状态估计,LQR控制器设计
  • 演出:密度高度、空速转换、失速速度、W&B、起飞/着陆
  • 代理:LLM电动工具选择和数据格式化

延迟工具加载

对于具有许多工具的应用程序,航空航天mcp支持 延迟工具加载 以保持上下文窗口的效率。在MCP中使用Anthropic API时,配置 mcp_toolset 推迟加载除发现工具之外的所有工具:

{
  "tools": [
    {
      "type": "tool_search_tool_regex_20251119",
      "name": "tool_search_tool_regex"
    },
    {
      "type": "mcp_toolset",
      "mcp_server_name": "aerospace-mcp",
      "default_config": {
        "defer_loading": true
      },
      "configs": {
        "search_aerospace_tools": { "defer_loading": false },
        "list_tool_categories": { "defer_loading": false }
      }
    }
  ]
}

此配置:

  1. 立即加载发现工具 (search_aerospace_tools, list_tool_categories)
  2. 推迟所有其他工具 直到克劳德找到他们
  3. 自动扩展 tool_reference 从搜索结果到完整定义的块

当克劳德需要一个特定的工具时,它会使用 search_aerospace_tools 返回 tool_reference 阻碍:

{
  "tool_references": [
    { "type": "tool_reference", "tool_name": "hohmann_transfer" },
    { "type": "tool_reference", "tool_name": "propagate_orbit_j2" }
  ]
}

API自动将这些引用扩展为完整的工具定义,在提供对所有44+工具的访问的同时保持上下文高效。

VS代码继续安装

添加到您的 config.json:

{
  "mcpServers": [
    {
      "name": "aerospace-mcp",
      "command": "uv",
      "args": ["run", "aerospace-mcp"],
      "workingDirectory": "/path/to/aerospace-mcp"
    }
  ]
}

🛠️ 发展

开发设置

# Clone and setup
git clone https://github.com/cheesejaguar/aerospace-mcp.git
cd aerospace-mcp

# Create development environment
uv venv
source .venv/bin/activate
uv add --dev pytest httpx black isort mypy pre-commit

# Install pre-commit hooks
pre-commit install

# Run development server
uvicorn main:app --reload --log-level debug

测试

# Run all tests
pytest

# Run with coverage
pytest --cov=. --cov-report=html

# Run specific test file
pytest tests/test_main.py -v

# Performance testing
pytest tests/test_performance.py -v

代码质量

# Format code
black . && isort .

# Type checking
mypy main.py aerospace_mcp/

# Linting
ruff check .

# Pre-commit (runs all checks)
pre-commit run --all-files

项目结构

aerospace-mcp/
├── main.py                 # FastAPI application
├── aerospace_mcp/          # MCP server implementation
│   ├── __init__.py
│   ├── server.py          # Legacy MCP server (deprecated)
│   ├── fastmcp_server.py  # FastMCP server entry point (primary)
│   ├── core.py            # Shared business logic
│   ├── tools/             # MCP tool definitions
│   │   ├── core.py        # Flight planning tools
│   │   ├── atmosphere.py  # Atmospheric modeling tools
│   │   ├── aerodynamics.py # Wing & airfoil analysis
│   │   ├── frames.py      # Coordinate transformations
│   │   ├── rockets.py     # Rocket trajectory tools
│   │   ├── orbits.py      # Orbital mechanics tools
│   │   ├── propellers.py  # Propeller analysis tools
│   │   ├── optimization.py # Trajectory optimization
│   │   ├── gnc.py         # GNC tools (Kalman filter, LQR)
│   │   ├── performance.py # Aircraft performance tools
│   │   ├── agents.py      # LLM-powered agent tools
│   │   └── tool_search.py # Tool discovery and search
│   └── integrations/      # Backend computation modules
│       ├── _array_backend.py # NumPy/CuPy abstraction (GPU support)
│       ├── atmosphere.py  # Vectorized ISA calculations
│       ├── aero.py        # Vectorized aerodynamics
│       ├── frames.py      # Vectorized coordinate transforms
│       ├── rockets.py     # Vectorized trajectory integration
│       ├── orbits.py      # Orbital mechanics computations
│       └── propellers.py  # Propeller BEMT analysis
├── app/                   # Alternative FastAPI structure
│   ├── __init__.py
│   └── main.py
├── tests/                 # Test suite (412 tests)
│   ├── conftest.py
│   ├── test_main.py
│   ├── test_airports.py
│   ├── test_plan.py
│   ├── test_mcp.py
│   ├── test_integrations_*.py  # Integration module tests
│   └── tools/             # Tool-specific tests
│       ├── test_tools_performance.py  # Performance tools tests
│       ├── test_tools_gnc.py          # GNC tools tests
│       └── test_tools_lambert.py      # Lambert solver tests
├── docs/                  # Documentation
│   ├── API.md
│   ├── ARCHITECTURE.md
│   ├── INTEGRATION.md
│   ├── QUICKSTART.md
│   ├── DEPLOYMENT.md
│   └── MCP_INTEGRATION.md
├── pyproject.toml         # Project configuration
├── requirements.txt       # Dependencies
├── Dockerfile            # Docker configuration
├── docker-compose.yml    # Multi-service setup
└── README.md             # This file

🤝 贡献

我们欢迎捐款!请参阅 贡献.md 详细指南。

快速贡献指南

  1. 分叉与克隆
   git clone https://github.com/yourusername/aerospace-mcp.git
   cd aerospace-mcp
  1. 设置开发环境
   uv venv && source .venv/bin/activate
   uv add --dev pytest httpx black isort mypy
  1. 进行更改

- 添加功能或修复错误 - 为新功能编写测试 - 根据需要更新文档

  1. 测试和格式
   pytest
   black . && isort .
   mypy main.py
  1. 提交拉取请求

- 清晰的标题和描述 - 参考任何相关问题 - 确保CI/CD检查通过

贡献领域

  • 新飞机支持:为OpenAP添加更多飞机类型
  • 天气集成:添加天气数据源
  • 路线优化:实施航路点优化
  • UI/前端:飞行计划Web界面
  • 数据库后端:PostgreSQL/MongoDB集成
  • 演出:优化和缓存改进
  • GPU优化:将CuPy支持扩展到其他模块
  • 向量化:提高NumPy矢量化覆盖率

📚 文档

完整的文件

📄 许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

第三方确认

🆘 支持与社区

获取帮助

  • GitHub 问题:Bug报告和功能请求
  • GitHub讨论:问题和社区支持
  • 文档:综合指南 /docs
  • 例子:代码示例和教程

社区

  • Discord 的中文翻译是“不和谐”或“纷争”。:WIP用于实时聊天

专业支持

对于企业支持、咨询或定制开发:

  • 电子邮件:hello@aeroastro.org
  • 网站:https://aeroastro.org

______________________________________________________________________

⭐ 如果你觉得这个存储库有用,请为其加星!

建于❤️ 航空和软件开发社区。

目录标签

目录标签

PythonClaude云端部署航空航天本地部署飞行规划轨道力学性能估计API服务

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

session

运行时(runtime,运行环境)

Python

部署方式(deploymentType,部署类型)

remote-capable

工具数量(toolCount,工具数)

44

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiosessionremote-capable

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP