mcp-cloudnex 1.0.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 (43) hide show
  1. mcp_cloudnex-1.0.0/MANIFEST.in +4 -0
  2. mcp_cloudnex-1.0.0/PKG-INFO +157 -0
  3. mcp_cloudnex-1.0.0/README.md +130 -0
  4. mcp_cloudnex-1.0.0/app/__init__.py +3 -0
  5. mcp_cloudnex-1.0.0/app/client/__init__.py +5 -0
  6. mcp_cloudnex-1.0.0/app/client/backend_client.py +479 -0
  7. mcp_cloudnex-1.0.0/app/client/jsonapi.py +174 -0
  8. mcp_cloudnex-1.0.0/app/client/query_helpers.py +75 -0
  9. mcp_cloudnex-1.0.0/app/core/__init__.py +1 -0
  10. mcp_cloudnex-1.0.0/app/core/config.py +31 -0
  11. mcp_cloudnex-1.0.0/app/core/exceptions.py +29 -0
  12. mcp_cloudnex-1.0.0/app/http_server.py +224 -0
  13. mcp_cloudnex-1.0.0/app/mcp_server.py +157 -0
  14. mcp_cloudnex-1.0.0/app/resources/__init__.py +6 -0
  15. mcp_cloudnex-1.0.0/app/resources/base.py +52 -0
  16. mcp_cloudnex-1.0.0/app/resources/finding_resources.py +40 -0
  17. mcp_cloudnex-1.0.0/app/resources/scan_resources.py +29 -0
  18. mcp_cloudnex-1.0.0/app/tools/__init__.py +35 -0
  19. mcp_cloudnex-1.0.0/app/tools/base.py +122 -0
  20. mcp_cloudnex-1.0.0/app/tools/check_tools.py +109 -0
  21. mcp_cloudnex-1.0.0/app/tools/compliance_tools.py +122 -0
  22. mcp_cloudnex-1.0.0/app/tools/finding_tools.py +139 -0
  23. mcp_cloudnex-1.0.0/app/tools/overview_tools.py +105 -0
  24. mcp_cloudnex-1.0.0/app/tools/provider_tools.py +74 -0
  25. mcp_cloudnex-1.0.0/app/tools/resource_tools.py +105 -0
  26. mcp_cloudnex-1.0.0/app/tools/role_tools.py +72 -0
  27. mcp_cloudnex-1.0.0/app/tools/scan_tools.py +79 -0
  28. mcp_cloudnex-1.0.0/app/tools/user_tools.py +66 -0
  29. mcp_cloudnex-1.0.0/mcp_cloudnex.egg-info/PKG-INFO +157 -0
  30. mcp_cloudnex-1.0.0/mcp_cloudnex.egg-info/SOURCES.txt +41 -0
  31. mcp_cloudnex-1.0.0/mcp_cloudnex.egg-info/dependency_links.txt +1 -0
  32. mcp_cloudnex-1.0.0/mcp_cloudnex.egg-info/entry_points.txt +2 -0
  33. mcp_cloudnex-1.0.0/mcp_cloudnex.egg-info/requires.txt +12 -0
  34. mcp_cloudnex-1.0.0/mcp_cloudnex.egg-info/top_level.txt +1 -0
  35. mcp_cloudnex-1.0.0/pyproject.toml +52 -0
  36. mcp_cloudnex-1.0.0/run_http_server.py +14 -0
  37. mcp_cloudnex-1.0.0/run_server.py +7 -0
  38. mcp_cloudnex-1.0.0/setup.cfg +4 -0
  39. mcp_cloudnex-1.0.0/tests/test_backend_client_unit.py +78 -0
  40. mcp_cloudnex-1.0.0/tests/test_config.py +63 -0
  41. mcp_cloudnex-1.0.0/tests/test_jsonapi.py +107 -0
  42. mcp_cloudnex-1.0.0/tests/test_query_helpers.py +45 -0
  43. mcp_cloudnex-1.0.0/tests/test_tools_unit.py +87 -0
@@ -0,0 +1,4 @@
1
+ include README.md
2
+ recursive-include app *.py
3
+ include run_server.py
4
+ include run_http_server.py
@@ -0,0 +1,157 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-cloudnex
3
+ Version: 1.0.0
4
+ Summary: MCP Server for CloudNex - Bridge between AI assistants and CloudNex cloud security data
5
+ Author: CloudNex Team
6
+ License: MIT
7
+ Keywords: mcp,cloudnex,cloud-security,compliance,ai,model-context-protocol
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Python: >=3.11
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: mcp>=1.0.0
17
+ Requires-Dist: fastapi>=0.109.0
18
+ Requires-Dist: uvicorn[standard]>=0.27.0
19
+ Requires-Dist: httpx>=0.25.0
20
+ Requires-Dist: pydantic>=2.0.0
21
+ Requires-Dist: pydantic-settings>=2.0.0
22
+ Requires-Dist: python-dotenv>=1.0.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
25
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
26
+ Requires-Dist: pytest-httpx>=0.25.0; extra == "dev"
27
+
28
+ # CloudNex MCP Server
29
+
30
+ Enterprise MCP server exposing CloudNex cloud security data to AI assistants via the [Model Context Protocol](https://modelcontextprotocol.io/).
31
+
32
+ ## Features
33
+
34
+ - **21 read-only tools** for scans, findings, providers, compliance, overviews, users, roles, and resources
35
+ - **Hub catalog tools** for compliance frameworks and security check metadata (no auth)
36
+ - **2 MCP resources** for quick scan and findings summaries
37
+ - **stdio** mode for Cursor / Claude Desktop
38
+ - **HTTP** mode with per-request API key override via headers
39
+ - JSON:API backend with `Authorization: Api-Key {prefix.key}` authentication
40
+
41
+ ## Quick Start
42
+
43
+ ```bash
44
+ cd cloudnex_mcp
45
+ cp .env.example .env
46
+ # Edit .env with your CLOUDNEX_API_URL and CLOUDNEX_API_KEY
47
+
48
+ pip install -e ".[dev]"
49
+ python run_server.py # stdio MCP
50
+ python run_http_server.py # HTTP on port 8001
51
+ ```
52
+
53
+ ## Docker
54
+
55
+ ```bash
56
+ docker compose up --build
57
+ curl http://localhost:8001/health
58
+ ```
59
+
60
+ ## Cursor Configuration
61
+
62
+ Add to `.cursor/mcp.json`:
63
+
64
+ ```json
65
+ {
66
+ "mcpServers": {
67
+ "cloudnex": {
68
+ "command": "mcp-cloudnex",
69
+ "env": {
70
+ "CLOUDNEX_API_URL": "https://your-instance.com/api/v1",
71
+ "CLOUDNEX_API_KEY": "cn_your-prefix.your-key"
72
+ }
73
+ }
74
+ }
75
+ }
76
+ ```
77
+
78
+ Or using the run script:
79
+
80
+ ```json
81
+ {
82
+ "mcpServers": {
83
+ "cloudnex": {
84
+ "command": "python",
85
+ "args": ["/path/to/cloudnex_mcp/run_server.py"],
86
+ "env": {
87
+ "CLOUDNEX_API_URL": "https://your-instance.com/api/v1",
88
+ "CLOUDNEX_API_KEY": "cn_your-prefix.your-key"
89
+ }
90
+ }
91
+ }
92
+ }
93
+ ```
94
+
95
+ ## Claude Desktop Configuration
96
+
97
+ Add to `claude_desktop_config.json`:
98
+
99
+ ```json
100
+ {
101
+ "mcpServers": {
102
+ "cloudnex": {
103
+ "command": "mcp-cloudnex",
104
+ "env": {
105
+ "CLOUDNEX_API_URL": "https://your-instance.com/api/v1",
106
+ "CLOUDNEX_API_KEY": "cn_your-prefix.your-key",
107
+ "CLOUDNEX_HUB_URL": "https://hub.cloudnex.com"
108
+ }
109
+ }
110
+ }
111
+ }
112
+ ```
113
+
114
+ ## HTTP API
115
+
116
+ | Endpoint | Method | Description |
117
+ |----------|--------|-------------|
118
+ | `/health` | GET | Health check |
119
+ | `/mcp/tools` | GET | List tools |
120
+ | `/mcp/tools/call` | POST | Execute a tool |
121
+ | `/mcp/resources` | GET | List resources |
122
+ | `/mcp/resources/read` | POST | Read a resource |
123
+
124
+ Pass API key per request:
125
+
126
+ ```
127
+ X-API-Key: cn_prefix.key
128
+ # or
129
+ Authorization: Api-Key cn_prefix.key
130
+ ```
131
+
132
+ ## Environment Variables
133
+
134
+ | Variable | Default | Description |
135
+ |----------|---------|-------------|
136
+ | `CLOUDNEX_API_URL` | `""` | CloudNex JSON:API base URL |
137
+ | `CLOUDNEX_API_KEY` | `""` | Tenant API key (`prefix.key`) |
138
+ | `CLOUDNEX_HUB_URL` | `https://hub.cloudnex.com` | Public check catalog |
139
+ | `CLOUDNEX_MCP_SERVER_PORT` | `8001` | HTTP server port |
140
+ | `CLOUDNEX_LOG_LEVEL` | `INFO` | Log level |
141
+ | `CLOUDNEX_CORS_ORIGINS` | `*` | Comma-separated CORS origins |
142
+
143
+ ## Testing
144
+
145
+ ```bash
146
+ pip install -e ".[dev]"
147
+ pytest tests/ -q
148
+
149
+ # Include integration tests (live backend):
150
+ pytest tests/ -m integration
151
+ ```
152
+
153
+ Full end-to-end guide (API key, Cursor, Claude Desktop, NEXA chat): [docs/TESTING.md](docs/TESTING.md)
154
+
155
+ ## RBAC
156
+
157
+ All backend tools respect CloudNex tenant RBAC. API keys are tenant-scoped; data visibility depends on role permissions and provider group assignments. Use `get_my_profile` to verify the authenticated context.
@@ -0,0 +1,130 @@
1
+ # CloudNex MCP Server
2
+
3
+ Enterprise MCP server exposing CloudNex cloud security data to AI assistants via the [Model Context Protocol](https://modelcontextprotocol.io/).
4
+
5
+ ## Features
6
+
7
+ - **21 read-only tools** for scans, findings, providers, compliance, overviews, users, roles, and resources
8
+ - **Hub catalog tools** for compliance frameworks and security check metadata (no auth)
9
+ - **2 MCP resources** for quick scan and findings summaries
10
+ - **stdio** mode for Cursor / Claude Desktop
11
+ - **HTTP** mode with per-request API key override via headers
12
+ - JSON:API backend with `Authorization: Api-Key {prefix.key}` authentication
13
+
14
+ ## Quick Start
15
+
16
+ ```bash
17
+ cd cloudnex_mcp
18
+ cp .env.example .env
19
+ # Edit .env with your CLOUDNEX_API_URL and CLOUDNEX_API_KEY
20
+
21
+ pip install -e ".[dev]"
22
+ python run_server.py # stdio MCP
23
+ python run_http_server.py # HTTP on port 8001
24
+ ```
25
+
26
+ ## Docker
27
+
28
+ ```bash
29
+ docker compose up --build
30
+ curl http://localhost:8001/health
31
+ ```
32
+
33
+ ## Cursor Configuration
34
+
35
+ Add to `.cursor/mcp.json`:
36
+
37
+ ```json
38
+ {
39
+ "mcpServers": {
40
+ "cloudnex": {
41
+ "command": "mcp-cloudnex",
42
+ "env": {
43
+ "CLOUDNEX_API_URL": "https://your-instance.com/api/v1",
44
+ "CLOUDNEX_API_KEY": "cn_your-prefix.your-key"
45
+ }
46
+ }
47
+ }
48
+ }
49
+ ```
50
+
51
+ Or using the run script:
52
+
53
+ ```json
54
+ {
55
+ "mcpServers": {
56
+ "cloudnex": {
57
+ "command": "python",
58
+ "args": ["/path/to/cloudnex_mcp/run_server.py"],
59
+ "env": {
60
+ "CLOUDNEX_API_URL": "https://your-instance.com/api/v1",
61
+ "CLOUDNEX_API_KEY": "cn_your-prefix.your-key"
62
+ }
63
+ }
64
+ }
65
+ }
66
+ ```
67
+
68
+ ## Claude Desktop Configuration
69
+
70
+ Add to `claude_desktop_config.json`:
71
+
72
+ ```json
73
+ {
74
+ "mcpServers": {
75
+ "cloudnex": {
76
+ "command": "mcp-cloudnex",
77
+ "env": {
78
+ "CLOUDNEX_API_URL": "https://your-instance.com/api/v1",
79
+ "CLOUDNEX_API_KEY": "cn_your-prefix.your-key",
80
+ "CLOUDNEX_HUB_URL": "https://hub.cloudnex.com"
81
+ }
82
+ }
83
+ }
84
+ }
85
+ ```
86
+
87
+ ## HTTP API
88
+
89
+ | Endpoint | Method | Description |
90
+ |----------|--------|-------------|
91
+ | `/health` | GET | Health check |
92
+ | `/mcp/tools` | GET | List tools |
93
+ | `/mcp/tools/call` | POST | Execute a tool |
94
+ | `/mcp/resources` | GET | List resources |
95
+ | `/mcp/resources/read` | POST | Read a resource |
96
+
97
+ Pass API key per request:
98
+
99
+ ```
100
+ X-API-Key: cn_prefix.key
101
+ # or
102
+ Authorization: Api-Key cn_prefix.key
103
+ ```
104
+
105
+ ## Environment Variables
106
+
107
+ | Variable | Default | Description |
108
+ |----------|---------|-------------|
109
+ | `CLOUDNEX_API_URL` | `""` | CloudNex JSON:API base URL |
110
+ | `CLOUDNEX_API_KEY` | `""` | Tenant API key (`prefix.key`) |
111
+ | `CLOUDNEX_HUB_URL` | `https://hub.cloudnex.com` | Public check catalog |
112
+ | `CLOUDNEX_MCP_SERVER_PORT` | `8001` | HTTP server port |
113
+ | `CLOUDNEX_LOG_LEVEL` | `INFO` | Log level |
114
+ | `CLOUDNEX_CORS_ORIGINS` | `*` | Comma-separated CORS origins |
115
+
116
+ ## Testing
117
+
118
+ ```bash
119
+ pip install -e ".[dev]"
120
+ pytest tests/ -q
121
+
122
+ # Include integration tests (live backend):
123
+ pytest tests/ -m integration
124
+ ```
125
+
126
+ Full end-to-end guide (API key, Cursor, Claude Desktop, NEXA chat): [docs/TESTING.md](docs/TESTING.md)
127
+
128
+ ## RBAC
129
+
130
+ All backend tools respect CloudNex tenant RBAC. API keys are tenant-scoped; data visibility depends on role permissions and provider group assignments. Use `get_my_profile` to verify the authenticated context.
@@ -0,0 +1,3 @@
1
+ """CloudNex MCP Server package."""
2
+
3
+ __version__ = "1.0.0"
@@ -0,0 +1,5 @@
1
+ """HTTP clients for CloudNex API and Hub."""
2
+
3
+ from app.client.backend_client import BackendClient, HubClient
4
+
5
+ __all__ = ["BackendClient", "HubClient"]