aviationstack-mcp-server 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. aviationstack_mcp_server-0.1.0/LICENSE +21 -0
  2. aviationstack_mcp_server-0.1.0/PKG-INFO +57 -0
  3. aviationstack_mcp_server-0.1.0/README.md +30 -0
  4. aviationstack_mcp_server-0.1.0/pyproject.toml +88 -0
  5. aviationstack_mcp_server-0.1.0/pyproject.toml.orig +89 -0
  6. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/__init__.py +0 -0
  7. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/__main__.py +15 -0
  8. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/client/__init__.py +9 -0
  9. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/client/aviationstack.py +138 -0
  10. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/client/factory.py +30 -0
  11. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/client/http.py +292 -0
  12. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/config/__init__.py +3 -0
  13. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/config/settings.py +162 -0
  14. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/errors/__init__.py +25 -0
  15. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/errors/exceptions.py +56 -0
  16. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/logging_config.py +52 -0
  17. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/mcp/__init__.py +3 -0
  18. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/mcp/dependencies.py +64 -0
  19. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/mcp/errors.py +118 -0
  20. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/mcp/prompts/__init__.py +0 -0
  21. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/mcp/prompts/aviation.py +98 -0
  22. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/mcp/resources/__init__.py +0 -0
  23. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/mcp/resources/documentation.py +165 -0
  24. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/mcp/resources/metadata.py +46 -0
  25. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/mcp/server.py +164 -0
  26. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/mcp/tools/__init__.py +0 -0
  27. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/mcp/tools/aircraft.py +64 -0
  28. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/mcp/tools/airlines.py +43 -0
  29. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/mcp/tools/airports.py +43 -0
  30. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/mcp/tools/flights.py +125 -0
  31. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/mcp/tools/reference.py +129 -0
  32. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/models/__init__.py +81 -0
  33. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/models/aircraft.py +43 -0
  34. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/models/airline.py +29 -0
  35. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/models/airport.py +33 -0
  36. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/models/common.py +20 -0
  37. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/models/flight.py +125 -0
  38. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/models/location.py +50 -0
  39. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/models/queries.py +284 -0
  40. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/models/route.py +24 -0
  41. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/models/tax.py +20 -0
  42. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/observability.py +27 -0
  43. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/security.py +62 -0
  44. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/services/__init__.py +13 -0
  45. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/services/aircraft_service.py +156 -0
  46. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/services/airline_service.py +89 -0
  47. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/services/airport_service.py +116 -0
  48. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/services/flight_service.py +366 -0
  49. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/services/reference_service.py +315 -0
  50. aviationstack_mcp_server-0.1.0/src/aviationstack_mcp_server/utils/__init__.py +0 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ravi Agarwal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,57 @@
1
+ Metadata-Version: 2.4
2
+ Name: aviationstack-mcp-server
3
+ Version: 0.1.0
4
+ Summary: An open-source Model Context Protocol server for the Aviationstack aviation API.
5
+ Keywords: mcp,model-context-protocol,aviationstack,aviation,flights,ai,llm
6
+ Author: Ravi Agarwal
7
+ Author-email: Ravi Agarwal <raviagrawal1121@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Requires-Dist: httpx>=0.28.1
17
+ Requires-Dist: mcp[cli]>=2.2.0
18
+ Requires-Dist: pydantic>=2.13.5
19
+ Requires-Dist: pydantic-settings>=2.15.0
20
+ Requires-Dist: tenacity>=9.1.4
21
+ Requires-Python: >=3.13
22
+ Project-URL: Homepage, https://github.com/raviagrawal121/aviationstack-mcp-server
23
+ Project-URL: Repository, https://github.com/raviagrawal121/aviationstack-mcp-server
24
+ Project-URL: Issues, https://github.com/raviagrawal121/aviationstack-mcp-server/issues
25
+ Project-URL: Changelog, https://github.com/raviagrawal121/aviationstack-mcp-server/blob/main/CHANGELOG.md
26
+ Description-Content-Type: text/markdown
27
+
28
+ # Aviationstack MCP Server
29
+
30
+ MCP server providing aviation data through the Aviationstack API.
31
+
32
+ ## Development
33
+
34
+ ```bash
35
+ uv sync
36
+ source .venv/bin/activate
37
+ ```
38
+
39
+ Normal tests are offline and do not require an Aviationstack API key:
40
+
41
+ ```bash
42
+ uv run pytest -m "not live_api"
43
+ ```
44
+
45
+ Run the live MCP-to-Aviationstack test explicitly with `AVIATIONSTACK_API_KEY`
46
+ set in the environment or `.env`:
47
+
48
+ ```bash
49
+ uv run pytest -m live_api
50
+ ```
51
+
52
+ Probe endpoint access for the configured account, using one bounded request per
53
+ capability:
54
+
55
+ ```bash
56
+ AVIATIONSTACK_LIVE=1 uv run pytest -m capability_discovery -s
57
+ ```
@@ -0,0 +1,30 @@
1
+ # Aviationstack MCP Server
2
+
3
+ MCP server providing aviation data through the Aviationstack API.
4
+
5
+ ## Development
6
+
7
+ ```bash
8
+ uv sync
9
+ source .venv/bin/activate
10
+ ```
11
+
12
+ Normal tests are offline and do not require an Aviationstack API key:
13
+
14
+ ```bash
15
+ uv run pytest -m "not live_api"
16
+ ```
17
+
18
+ Run the live MCP-to-Aviationstack test explicitly with `AVIATIONSTACK_API_KEY`
19
+ set in the environment or `.env`:
20
+
21
+ ```bash
22
+ uv run pytest -m live_api
23
+ ```
24
+
25
+ Probe endpoint access for the configured account, using one bounded request per
26
+ capability:
27
+
28
+ ```bash
29
+ AVIATIONSTACK_LIVE=1 uv run pytest -m capability_discovery -s
30
+ ```
@@ -0,0 +1,88 @@
1
+ [project]
2
+ name = "aviationstack-mcp-server"
3
+ version = "0.1.0"
4
+ description = "An open-source Model Context Protocol server for the Aviationstack aviation API."
5
+ readme = "README.md"
6
+ requires-python = ">=3.13"
7
+ license = "MIT"
8
+ license-files = ["LICENSE"]
9
+ keywords = [
10
+ "mcp",
11
+ "model-context-protocol",
12
+ "aviationstack",
13
+ "aviation",
14
+ "flights",
15
+ "ai",
16
+ "llm",
17
+ ]
18
+ classifiers = [
19
+ "Development Status :: 3 - Alpha",
20
+ "Intended Audience :: Developers",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3 :: Only",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Topic :: Software Development :: Libraries :: Python Modules",
25
+ ]
26
+ dependencies = [
27
+ "httpx>=0.28.1",
28
+ "mcp[cli]>=2.2.0",
29
+ "pydantic>=2.13.5",
30
+ "pydantic-settings>=2.15.0",
31
+ "tenacity>=9.1.4",
32
+ ]
33
+
34
+ [[project.authors]]
35
+ name = "Ravi Agarwal"
36
+ email = "raviagrawal1121@gmail.com"
37
+
38
+ [project.scripts]
39
+ aviationstack-mcp-server = "aviationstack_mcp_server.__main__:main"
40
+
41
+ [project.urls]
42
+ Homepage = "https://github.com/raviagrawal121/aviationstack-mcp-server"
43
+ Repository = "https://github.com/raviagrawal121/aviationstack-mcp-server"
44
+ Issues = "https://github.com/raviagrawal121/aviationstack-mcp-server/issues"
45
+ Changelog = "https://github.com/raviagrawal121/aviationstack-mcp-server/blob/main/CHANGELOG.md"
46
+
47
+ [build-system]
48
+ requires = ["uv_build>=0.12.10,<0.13.0"]
49
+ build-backend = "uv_build"
50
+
51
+ [dependency-groups]
52
+ dev = [
53
+ "mypy>=2.3.1",
54
+ "pytest>=9.1.1",
55
+ "pytest-asyncio>=1.4.0",
56
+ "pytest-cov>=6.1.1",
57
+ "ruff>=0.16.6",
58
+ ]
59
+
60
+ [tool.ruff]
61
+ line-length = 100
62
+ target-version = "py313"
63
+
64
+ [tool.ruff.lint]
65
+ select = [
66
+ "E",
67
+ "F",
68
+ "I",
69
+ "UP",
70
+ "B",
71
+ ]
72
+
73
+ [tool.pytest.ini_options]
74
+ asyncio_mode = "auto"
75
+ testpaths = ["tests"]
76
+ markers = [
77
+ "live_api: tests that call the live Aviationstack API",
78
+ "capability_discovery: opt-in live tests that probe API access by endpoint",
79
+ ]
80
+
81
+ [tool.mypy]
82
+ python_version = "3.13"
83
+ plugins = ["pydantic.mypy"]
84
+
85
+ [tool.pydantic-mypy]
86
+ init_forbid_extra = true
87
+ init_typed = true
88
+ warn_required_dynamic_aliases = true
@@ -0,0 +1,89 @@
1
+ [project]
2
+ name = "aviationstack-mcp-server"
3
+ version = "0.1.0"
4
+ description = "An open-source Model Context Protocol server for the Aviationstack aviation API."
5
+ readme = "README.md"
6
+ requires-python = ">=3.13"
7
+
8
+ authors = [
9
+ { name = "Ravi Agarwal", email = "raviagrawal1121@gmail.com" },
10
+ ]
11
+
12
+ license = "MIT"
13
+ license-files = ["LICENSE"]
14
+
15
+ keywords = [
16
+ "mcp",
17
+ "model-context-protocol",
18
+ "aviationstack",
19
+ "aviation",
20
+ "flights",
21
+ "ai",
22
+ "llm",
23
+ ]
24
+
25
+ classifiers = [
26
+ "Development Status :: 3 - Alpha",
27
+ "Intended Audience :: Developers",
28
+ "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3 :: Only",
30
+ "Programming Language :: Python :: 3.13",
31
+ "Topic :: Software Development :: Libraries :: Python Modules",
32
+ ]
33
+
34
+ dependencies = [
35
+ "httpx>=0.28.1",
36
+ "mcp[cli]>=2.2.0",
37
+ "pydantic>=2.13.5",
38
+ "pydantic-settings>=2.15.0",
39
+ "tenacity>=9.1.4",
40
+ ]
41
+
42
+ [project.scripts]
43
+ aviationstack-mcp-server = "aviationstack_mcp_server.__main__:main"
44
+
45
+ [project.urls]
46
+ Homepage = "https://github.com/raviagrawal121/aviationstack-mcp-server"
47
+ Repository = "https://github.com/raviagrawal121/aviationstack-mcp-server"
48
+ Issues = "https://github.com/raviagrawal121/aviationstack-mcp-server/issues"
49
+ Changelog = "https://github.com/raviagrawal121/aviationstack-mcp-server/blob/main/CHANGELOG.md"
50
+
51
+ [build-system]
52
+ requires = ["uv_build>=0.12.10,<0.13.0"]
53
+ build-backend = "uv_build"
54
+
55
+ [dependency-groups]
56
+ dev = [
57
+ "mypy>=2.3.1",
58
+ "pytest>=9.1.1",
59
+ "pytest-asyncio>=1.4.0",
60
+ "pytest-cov>=6.1.1",
61
+ "ruff>=0.16.6",
62
+ ]
63
+
64
+ [tool.ruff]
65
+ line-length = 100
66
+ target-version = "py313"
67
+
68
+
69
+ [tool.ruff.lint]
70
+ select = ["E", "F", "I", "UP", "B"]
71
+
72
+ [tool.pytest.ini_options]
73
+ asyncio_mode = "auto"
74
+ testpaths = ["tests"]
75
+ markers = [
76
+ "live_api: tests that call the live Aviationstack API",
77
+ "capability_discovery: opt-in live tests that probe API access by endpoint",
78
+ ]
79
+
80
+
81
+ [tool.mypy]
82
+ python_version = "3.13"
83
+ plugins = ["pydantic.mypy"]
84
+
85
+ [tool.pydantic-mypy]
86
+ init_forbid_extra = true
87
+ init_typed = true
88
+ warn_required_dynamic_aliases = true
89
+
@@ -0,0 +1,15 @@
1
+ from aviationstack_mcp_server.config import get_settings
2
+ from aviationstack_mcp_server.logging_config import configure_logging
3
+ from aviationstack_mcp_server.mcp.server import create_server
4
+
5
+
6
+ def main() -> None:
7
+ settings = get_settings()
8
+ configure_logging(settings.log_level)
9
+
10
+ server = create_server()
11
+ server.run()
12
+
13
+
14
+ if __name__ == "__main__":
15
+ main()
@@ -0,0 +1,9 @@
1
+ from .aviationstack import AviationstackClient
2
+ from .factory import create_aviationstack_client
3
+ from .http import HTTPClient
4
+
5
+ __all__ = [
6
+ "AviationstackClient",
7
+ "HTTPClient",
8
+ "create_aviationstack_client",
9
+ ]
@@ -0,0 +1,138 @@
1
+ from __future__ import annotations
2
+
3
+ import logging
4
+ from collections.abc import Mapping
5
+ from typing import Any
6
+
7
+ from aviationstack_mcp_server.client.http import HTTPClient
8
+ from aviationstack_mcp_server.config import Settings
9
+ from aviationstack_mcp_server.errors import (
10
+ AviationstackAPIError,
11
+ )
12
+ from aviationstack_mcp_server.security import validate_endpoint
13
+
14
+ logger = logging.getLogger(__name__)
15
+
16
+
17
+ class AviationstackClient:
18
+ """Asynchronous client for the Aviationstack REST API."""
19
+
20
+ def __init__(
21
+ self,
22
+ settings: Settings,
23
+ http_client: HTTPClient,
24
+ ) -> None:
25
+ self._settings = settings
26
+ self._http_client = http_client
27
+
28
+ async def get(
29
+ self,
30
+ endpoint: str,
31
+ *,
32
+ params: Mapping[str, Any] | None = None,
33
+ ) -> dict[str, Any]:
34
+ """Perform a GET request against an Aviationstack endpoint."""
35
+
36
+ url = self._build_url(endpoint)
37
+
38
+ request_params = {
39
+ "access_key": self._settings.aviationstack_api_key.get_secret_value(),
40
+ }
41
+
42
+ if params:
43
+ request_params.update(
44
+ {key: value for key, value in params.items() if value is not None}
45
+ )
46
+
47
+ logger.debug(
48
+ "Sending Aviationstack request: method=%s endpoint=%s params=%s",
49
+ "GET",
50
+ endpoint,
51
+ sorted(key for key in request_params if key != "access_key"),
52
+ )
53
+
54
+ response = await self._http_client.request(
55
+ "GET",
56
+ url,
57
+ params=request_params,
58
+ )
59
+
60
+ logger.debug(
61
+ "Received Aviationstack response: method=%s endpoint=%s status=%s",
62
+ "GET",
63
+ endpoint,
64
+ response.status_code,
65
+ )
66
+
67
+ payload = self._parse_response(response)
68
+
69
+ self._raise_for_api_error(payload)
70
+
71
+ return payload
72
+
73
+ async def close(self) -> None:
74
+ logger.debug("Closing Aviationstack HTTP client")
75
+ await self._http_client.close()
76
+
77
+ def _build_url(self, endpoint: str) -> str:
78
+ """Build an endpoint URL safely."""
79
+
80
+ validate_endpoint(endpoint)
81
+ normalized_base_url = self._settings.aviationstack_base_url.rstrip("/")
82
+ normalized_endpoint = endpoint.strip("/")
83
+
84
+ return f"{normalized_base_url}/{normalized_endpoint}"
85
+
86
+ @staticmethod
87
+ def _parse_response(response: Any) -> dict[str, Any]:
88
+ """Parse an Aviationstack JSON response."""
89
+
90
+ try:
91
+ payload = response.json()
92
+ except ValueError as exc:
93
+ logger.warning("Aviationstack returned invalid JSON")
94
+ raise AviationstackAPIError("Aviationstack returned an invalid JSON response.") from exc
95
+
96
+ if not isinstance(payload, dict):
97
+ logger.warning(
98
+ "Aviationstack returned an unexpected response type: %s",
99
+ type(payload).__name__,
100
+ )
101
+ raise AviationstackAPIError("Aviationstack returned an unexpected response format.")
102
+
103
+ return payload
104
+
105
+ @staticmethod
106
+ def _raise_for_api_error(
107
+ payload: dict[str, Any],
108
+ ) -> None:
109
+ """Translate Aviationstack application-level errors."""
110
+
111
+ error = payload.get("error")
112
+
113
+ if not isinstance(error, dict):
114
+ return
115
+
116
+ error_type = error.get("type")
117
+ error_code = error.get("code")
118
+ message = error.get("message")
119
+
120
+ if not isinstance(error_type, str):
121
+ error_type = "api_error"
122
+
123
+ if not isinstance(error_code, str):
124
+ error_code = None
125
+
126
+ if not isinstance(message, str):
127
+ message = "Aviationstack returned an API error."
128
+
129
+ logger.warning(
130
+ "Aviationstack API error: type=%s code=%s",
131
+ error_type,
132
+ error_code,
133
+ )
134
+
135
+ raise AviationstackAPIError(
136
+ f"{error_type}: {message}",
137
+ error_code=error_code,
138
+ )
@@ -0,0 +1,30 @@
1
+ import logging
2
+
3
+ from aviationstack_mcp_server.client.aviationstack import AviationstackClient
4
+ from aviationstack_mcp_server.client.http import HTTPClient
5
+ from aviationstack_mcp_server.config import Settings
6
+
7
+ logger = logging.getLogger(__name__)
8
+
9
+
10
+ def create_aviationstack_client(
11
+ settings: Settings,
12
+ ) -> AviationstackClient:
13
+ """Create a configured Aviationstack API client."""
14
+
15
+ logger.debug(
16
+ "Creating Aviationstack client: base_url=%s connect_timeout=%s "
17
+ "read_timeout=%s max_retries=%s retry_backoff=%s",
18
+ settings.aviationstack_base_url,
19
+ settings.aviationstack_connect_timeout,
20
+ settings.aviationstack_read_timeout,
21
+ settings.aviationstack_retry_max_attempts,
22
+ settings.aviationstack_retry_backoff_factor,
23
+ )
24
+
25
+ http_client = HTTPClient(settings)
26
+
27
+ return AviationstackClient(
28
+ settings=settings,
29
+ http_client=http_client,
30
+ )