gatekeeper-mcp-server 3.0.0b3__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 (42) hide show
  1. gatekeeper_mcp_server-3.0.0b3/PKG-INFO +528 -0
  2. gatekeeper_mcp_server-3.0.0b3/README.md +493 -0
  3. gatekeeper_mcp_server-3.0.0b3/gatekeeper_mcp_server.egg-info/PKG-INFO +528 -0
  4. gatekeeper_mcp_server-3.0.0b3/gatekeeper_mcp_server.egg-info/SOURCES.txt +40 -0
  5. gatekeeper_mcp_server-3.0.0b3/gatekeeper_mcp_server.egg-info/dependency_links.txt +1 -0
  6. gatekeeper_mcp_server-3.0.0b3/gatekeeper_mcp_server.egg-info/entry_points.txt +2 -0
  7. gatekeeper_mcp_server-3.0.0b3/gatekeeper_mcp_server.egg-info/requires.txt +18 -0
  8. gatekeeper_mcp_server-3.0.0b3/gatekeeper_mcp_server.egg-info/top_level.txt +1 -0
  9. gatekeeper_mcp_server-3.0.0b3/pyproject.toml +65 -0
  10. gatekeeper_mcp_server-3.0.0b3/server/__init__.py +4 -0
  11. gatekeeper_mcp_server-3.0.0b3/server/config.py +668 -0
  12. gatekeeper_mcp_server-3.0.0b3/server/eureka/__init__.py +9 -0
  13. gatekeeper_mcp_server-3.0.0b3/server/eureka/eureka_client.py +120 -0
  14. gatekeeper_mcp_server-3.0.0b3/server/run_server.py +136 -0
  15. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/__init__.py +6 -0
  16. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/dashboard_server.py +620 -0
  17. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/http_support.py +95 -0
  18. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/prompts/__init__.py +6 -0
  19. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/prompts/quality_prompts.py +416 -0
  20. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/tools/__init__.py +5 -0
  21. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/tools/quality_tools.py +446 -0
  22. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/utils/__init__.py +3 -0
  23. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/utils/application_service.py +266 -0
  24. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/utils/cache.py +117 -0
  25. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/utils/compliance_service.py +1573 -0
  26. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/utils/dashboard_service.py +106 -0
  27. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/utils/id_helpers.py +62 -0
  28. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/utils/service_factory.py +57 -0
  29. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/utils/snapshot_resolver.py +461 -0
  30. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/utils/terminology.py +65 -0
  31. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/utils/violation_findings.py +234 -0
  32. gatekeeper_mcp_server-3.0.0b3/server/services/dashboard_api/utils/violation_service.py +931 -0
  33. gatekeeper_mcp_server-3.0.0b3/server/shared/__init__.py +13 -0
  34. gatekeeper_mcp_server-3.0.0b3/server/shared/config.py +5 -0
  35. gatekeeper_mcp_server-3.0.0b3/server/shared/constants.py +1 -0
  36. gatekeeper_mcp_server-3.0.0b3/server/shared/dependencies.py +90 -0
  37. gatekeeper_mcp_server-3.0.0b3/server/shared/exceptions.py +61 -0
  38. gatekeeper_mcp_server-3.0.0b3/server/shared/logging_config.py +230 -0
  39. gatekeeper_mcp_server-3.0.0b3/server/shared/middleware.py +155 -0
  40. gatekeeper_mcp_server-3.0.0b3/server/shared/validators.py +205 -0
  41. gatekeeper_mcp_server-3.0.0b3/server/startup.py +45 -0
  42. gatekeeper_mcp_server-3.0.0b3/setup.cfg +4 -0
@@ -0,0 +1,528 @@
1
+ Metadata-Version: 2.4
2
+ Name: gatekeeper-mcp-server
3
+ Version: 3.0.0b3
4
+ Summary: FastMCP-based server exposing CAST Dashboard REST API via Model Context Protocol
5
+ Author-email: CAST Software <contact@castsoftware.com>
6
+ License: Proprietary
7
+ Project-URL: Homepage, https://www.castsoftware.com
8
+ Project-URL: Repository, https://gitlab.com/castsoftware/dashboards/mcp-server
9
+ Keywords: mcp,cast,dashboard,ai,fastmcp,compliance
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Operating System :: OS Independent
16
+ Requires-Python: >=3.12
17
+ Description-Content-Type: text/markdown
18
+ Requires-Dist: fastmcp<3.0,>=2.10.0
19
+ Requires-Dist: starlette<1.0,>=0.45.2
20
+ Requires-Dist: uvicorn<1.0,>=0.34.0
21
+ Requires-Dist: rich<14.0,>=13.5.0
22
+ Requires-Dist: anyio<5.0,>=4.0.0
23
+ Requires-Dist: pydantic<3.0,>=2.11.7
24
+ Requires-Dist: pydantic-settings<3.0,>=2.7.1
25
+ Requires-Dist: pydantic-core<3.0,>=2.14
26
+ Requires-Dist: httpx<1.0,>=0.28.1
27
+ Requires-Dist: requests<3.0,>=2.32.3
28
+ Requires-Dist: py-eureka-client<1.0,>=0.11.17
29
+ Requires-Dist: sniffio<2.0,>=1.3.0
30
+ Requires-Dist: typing-extensions<5.0,>=4.8.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=8.3.4; extra == "dev"
33
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == "dev"
34
+ Requires-Dist: pytest-mock>=3.14.0; extra == "dev"
35
+
36
+ # Gatekeeper MCP Server
37
+
38
+ A FastMCP-based server that exposes CAST Gatekeeper REST API functionality through the Model Context Protocol (MCP), enabling AI agents like Claude and GitHub Copilot to interact with Gatekeeper domains, applications, snapshots, and compliance data via natural language.
39
+
40
+ [![Python Version](https://img.shields.io/badge/python-3.12%2B-blue)](https://www.python.org/downloads/)
41
+ [![FastMCP](https://img.shields.io/badge/FastMCP-2.9.2%2B-green)](https://pypi.org/project/fastmcp/)
42
+
43
+ ## 🚀 Features
44
+
45
+ - **MCP Protocol Support**: Full implementation of Model Context Protocol for AI agent integration
46
+ - **Compliance Monitoring**: Real-time access to application compliance status, quality indicators, and violation tracking
47
+ - **ISO-5055 Standard Support**: Filter and analyze compliance data by industry standards
48
+ - **Multi-Snapshot Comparison**: Compare quality metrics across multiple application snapshots
49
+ - **Technology & Module Breakdown**: Detailed violation analysis by technology stack and modules
50
+ - **Smart Caching**: TTL-based caching for improved performance and reduced API calls
51
+ - **Service Discovery**: Optional Eureka integration for microservices architecture
52
+ - **Streamable HTTP Transport**: MCP over HTTP (streamable-HTTP on port 8283)
53
+ - **Security First**: SSL/TLS support, input validation, and secure credential handling
54
+
55
+ ## 📋 Requirements
56
+
57
+ - Python 3.12 or higher
58
+ - CAST Dashboard REST API access
59
+ - API key or OAuth token for Dashboard authentication
60
+
61
+ ## 🔧 Installation
62
+
63
+ ### Option 1: Python Installation
64
+
65
+ 1. Clone the repository:
66
+ ```bash
67
+ git clone https://gitlab.com/castsoftware/dashboards/mcp-server.git
68
+ cd mcp-server
69
+ ```
70
+
71
+ 2. Install dependencies:
72
+ ```bash
73
+ pip install -r requirements.txt
74
+ ```
75
+
76
+ 3. Configure the server (see [Configuration](#-configuration))
77
+
78
+ 4. Run the server:
79
+ ```bash
80
+ python server/run_server.py
81
+ ```
82
+
83
+ ### Option 2: Docker Deployment
84
+
85
+ 1. Navigate to the Docker directory:
86
+ ```bash
87
+ cd deploy/server
88
+ ```
89
+
90
+ 2. Configure `config/app.config` with your Dashboard credentials
91
+
92
+ 3. Run the container:
93
+ ```bash
94
+ ./run.sh
95
+ ```
96
+
97
+ For HTTPS mode, place certificates in `deploy/server/certificates/` and see the [Docker Deployment](#-docker-deployment) section.
98
+
99
+ ## ⚙️ Configuration
100
+
101
+ ### Required Settings
102
+
103
+ Create or edit `server/config/app.config`:
104
+
105
+ ```ini
106
+ # Dashboard API Connection (Required)
107
+ HOST_CONTROL_PANEL=your-controlpanel-host
108
+ PORT_CONTROL_PANEL=8098
109
+
110
+ # Authentication (Required)
111
+ DASHBOARD_API_KEY=your-api-key
112
+ ```
113
+
114
+ ### Optional Settings
115
+
116
+ ```ini
117
+ # MCP Server
118
+ MCP_SERVER_PORT=8283
119
+
120
+ # Control Panel SSL (set true if control panel uses HTTPS)
121
+ CONTROL_PANEL_SSL_ENABLED=false
122
+
123
+ # MCP Server SSL — marks the Eureka service registry entry as HTTPS
124
+ MCP_SERVER_SSL_ENABLED=false
125
+
126
+ # Logging and Debug
127
+ DEBUG_MODE=false
128
+
129
+ # Service Discovery
130
+ SERVICE_NAME=GatekeeperMCPServer
131
+ SERVICE_HOST=your-machine-ip-or-hostname
132
+ ```
133
+
134
+ ### Configuration Priority
135
+
136
+ The server resolves configuration in the following order:
137
+ 1. Command-line arguments (`--config /path/to/app.config`)
138
+ 2. Environment variables (UPPER_CASE format)
139
+ 3. Config file values (snake_case or UPPER_CASE)
140
+ 4. Default values
141
+
142
+ ### Authentication Methods
143
+
144
+ **API Key Authentication** (Recommended):
145
+ ```ini
146
+ DASHBOARD_API_KEY=your-api-key
147
+ ```
148
+
149
+ **OAuth Token Authentication**:
150
+ ```ini
151
+ DASHBOARD_OAUTH_TOKEN=your-oauth-token
152
+ ```
153
+
154
+ **Request Headers** (Highest Priority):
155
+ ```bash
156
+ x-api-key: your-api-key
157
+ # OR
158
+ Authorization: Bearer your-oauth-token
159
+ ```
160
+
161
+ ## 🎯 Usage
162
+
163
+ ### Starting the Server
164
+
165
+ **Default mode (streamable-HTTP on port 8283):**
166
+ ```bash
167
+ python server/run_server.py
168
+ ```
169
+
170
+ **With custom config:**
171
+ ```bash
172
+ python server/run_server.py --config /path/to/app.config
173
+ ```
174
+
175
+ ### Health Check
176
+
177
+ Verify the server is running:
178
+ ```bash
179
+ curl http://localhost:8283/mcp/healthcheck
180
+ curl http://localhost:8283/mcpserver/healthcheck
181
+ ```
182
+
183
+ Expected response:
184
+ ```json
185
+ {
186
+ "status": "healthy",
187
+ "service": "GatekeeperMCPServer",
188
+ "details": {
189
+ "dashboard_client": "available",
190
+ "dashboard_api": "configured"
191
+ }
192
+ }
193
+ ```
194
+
195
+ ### Client Integration
196
+
197
+ #### VS Code with GitHub Copilot
198
+
199
+ Create `.vscode/mcp.json`:
200
+ ```json
201
+ {
202
+ "inputs": [
203
+ {
204
+ "id": "dashboard-key",
205
+ "type": "promptString",
206
+ "description": "CAST Dashboard API Key"
207
+ }
208
+ ],
209
+ "servers": {
210
+ "gatekeeper": {
211
+ "type": "http",
212
+ "url": "http://localhost:8090/mcp/gatekeeper",
213
+ "headers": {
214
+ "x-api-key": "${input:dashboard-key}"
215
+ }
216
+ }
217
+ }
218
+ }
219
+ ```
220
+
221
+ #### Claude Desktop
222
+
223
+ Add to Claude Desktop settings (`%APPDATA%\Claude\claude_desktop_config.json` on Windows or `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
224
+
225
+ ```json
226
+ {
227
+ "mcpServers": {
228
+ "gatekeeper": {
229
+ "type": "http",
230
+ "url": "http://localhost:8090/mcp/gatekeeper",
231
+ "headers": {
232
+ "x-api-key": "your-api-key"
233
+ }
234
+ }
235
+ }
236
+ }
237
+ ```
238
+
239
+ #### Cursor
240
+
241
+ Add to Cursor settings (`.cursor/mcp.json` in your project or workspace):
242
+
243
+ ```json
244
+ {
245
+ "mcpServers": {
246
+ "gatekeeper": {
247
+ "type": "http",
248
+ "url": "http://localhost:8090/mcp/gatekeeper",
249
+ "headers": {
250
+ "x-api-key": "your-api-key"
251
+ }
252
+ }
253
+ }
254
+ }
255
+ ```
256
+
257
+ > The MCP server must be running before connecting clients.
258
+
259
+ ### Available Tools
260
+
261
+ The MCP server exposes one primary tool:
262
+
263
+ #### `get_compliance_status`
264
+
265
+ Get compliance status for an application with violation details, quality indicators, and standard filtering.
266
+
267
+ **Parameters:**
268
+ - `application_name` (required): Application name
269
+ - `quality_indicators` (optional): Comma-separated quality-indicator IDs (e.g., "60017,4672")
270
+ - `snapshot` (optional): Snapshot number
271
+ - Not provided: Uses snapshot-id=-1 to get latest snapshot
272
+ - `"6"`: Gets snapshot 6
273
+ - `standard` (optional): Filter by standard (e.g., "ISO-5055", "CISQ", "OWASP")
274
+ - `technologies` (optional): Technology filter (comma-separated or "$all")
275
+ - `modules` (optional): Module filter (comma-separated or "$all")
276
+
277
+ **Example Usage:**
278
+
279
+ ```
280
+ Get compliance status for MyApp with ISO-5055 standard
281
+ ```
282
+
283
+ AI agent translates to:
284
+ ```json
285
+ {
286
+ "tool": "get_compliance_status",
287
+ "arguments": {
288
+ "application_name": "MyApp",
289
+ "standard": "ISO-5055"
290
+ }
291
+ }
292
+ ```
293
+
294
+ ## 🏗️ Architecture
295
+
296
+ ### Layered Architecture
297
+
298
+ ```
299
+ ┌─────────────────────────────────────────┐
300
+ │ MCP Client (Claude/Copilot) │
301
+ └─────────────────┬───────────────────────┘
302
+ │ Streamable HTTP (port 8283/mcp)
303
+ ┌─────────────────▼───────────────────────┐
304
+ │ Tool Layer │
305
+ │ (quality_tools.py) │
306
+ │ - get_compliance_status │
307
+ └─────────────────┬───────────────────────┘
308
+
309
+ ┌─────────────────▼───────────────────────┐
310
+ │ Business Logic Layer │
311
+ │ (dashboard_service.py) │
312
+ │ - Validation & Caching │
313
+ │ - Response Normalization │
314
+ └─────────────────┬───────────────────────┘
315
+
316
+ ┌─────────────────▼───────────────────────┐
317
+ │ Data Access Layer │
318
+ │ (dashboard_server.py) │
319
+ │ - HTTP Client & Connection Pooling │
320
+ │ - Authentication Resolution │
321
+ └─────────────────┬───────────────────────┘
322
+
323
+ ┌─────────────────▼───────────────────────┐
324
+ │ Dashboard REST API │
325
+ └─────────────────────────────────────────┘
326
+ ```
327
+
328
+ ### Key Components
329
+
330
+ - **FastMCP Instance**: `server/__init__.py` - Core MCP protocol handler
331
+ - **Main Entry**: `server/run_server.py` - Server startup and configuration
332
+ - **Tool Layer**: `server/services/dashboard_api/tools/quality_tools.py` - MCP tool definitions
333
+ - **Business Logic**: `server/services/dashboard_api/utils/dashboard_service.py` - Validation and caching
334
+ - **Data Access**: `server/services/dashboard_api/dashboard_server.py` - HTTP client operations
335
+ - **Configuration**: `server/config.py` - Multi-source configuration management
336
+
337
+ ## 🔒 Security
338
+
339
+ ### Best Practices
340
+
341
+ 1. **Always use HTTPS in production** (Docker): place certificates in `deploy/server/certificates/` and run via `./run.sh`. nginx handles TLS termination — see [Docker Deployment](#-docker-deployment).
342
+
343
+ 2. **Corporate / self-signed CA certificates**: Set `SSL_CERT_FILE` (or `REQUESTS_CA_BUNDLE`) to your PEM chain before starting:
344
+ ```powershell
345
+ $Env:SSL_CERT_FILE = "C:\path\to\mmc-chain.pem"
346
+ python server/run_server.py
347
+ ```
348
+ On Windows, the server also reads this from system environment variables in the registry automatically.
349
+
350
+ 3. **Secure credential storage**:
351
+ - Use environment variables or secure config files
352
+ - Never commit credentials to version control
353
+ - Rotate API keys regularly
354
+
355
+ 3. **Rate limiting**: Configured in `deploy/server/nginx/nginx.conf` via `limit_req_zone` (rate) and `limit_req` (burst). No app.config settings required.
356
+
357
+ 4. **Input validation**: All inputs are automatically validated to prevent:
358
+ - Path traversal attacks
359
+ - SQL injection
360
+ - Length overflow
361
+ - Header injection
362
+
363
+ 5. **SSL certificate verification**: Enabled by default, only disable in development with explicit flags
364
+
365
+ ## 📊 Monitoring & Logging
366
+
367
+ ### Log Files
368
+
369
+ Logs are stored with rotation (30 files × 10MB, gzipped):
370
+ ```
371
+ /app/logs/mcp_dashboard.log
372
+ /app/logs/mcp_dashboard.log.1.gz
373
+ ...
374
+ ```
375
+
376
+ ### Debug Mode
377
+
378
+ Enable detailed logging:
379
+ ```ini
380
+ DEBUG_MODE=true
381
+ ```
382
+
383
+ Or via environment:
384
+ ```bash
385
+ DEBUG_MODE=true python server/run_server.py
386
+ ```
387
+
388
+ ### Metrics
389
+
390
+ Monitor via health check endpoint:
391
+ ```bash
392
+ curl http://localhost:8283/mcp/healthcheck
393
+ curl http://localhost:8283/mcpserver/healthcheck
394
+ ```
395
+
396
+ ## 🐛 Troubleshooting
397
+
398
+ ### Common Issues
399
+
400
+ **1. "Dashboard API is not available"**
401
+ - Check `HOST_CONTROL_PANEL` and `PORT_CONTROL_PANEL` settings
402
+ - Verify network connectivity to Dashboard API
403
+ - Ensure Dashboard REST API is running
404
+
405
+ **2. "No applications will be authorized"**
406
+ - Check API key is valid and active
407
+ - Confirm user has application permissions in Dashboard
408
+
409
+ **3. "Rate limit exceeded" (HTTP 429)**
410
+ - Wait for the rate limit window to reset (Nginx returns `Retry-After` header)
411
+ - Adjust `limit_req_zone` rate or `limit_req` burst in `deploy/server/nginx/nginx.conf`
412
+ - Check for runaway client processes
413
+
414
+ **4. SSL/TLS Errors**
415
+ - For self-signed / corporate CA certs: set `SSL_CERT_FILE` env var to your PEM chain file before starting
416
+ - For Docker HTTPS: verify certificates are in `deploy/server/certificates/` and you ran `./run.sh` from `deploy/server/`
417
+ - Ensure certificates are valid and not expired
418
+
419
+ ### Testing Connectivity
420
+
421
+ **Test Dashboard API directly:**
422
+ ```bash
423
+ curl -H "x-api-key: <key>" \
424
+ http://localhost:8090/rest
425
+ ```
426
+
427
+ **Test MCP server:**
428
+ ```bash
429
+ python test_server.py
430
+ ```
431
+
432
+ ### Viewing Logs
433
+
434
+ **Docker deployment:**
435
+ ```bash
436
+ docker logs <container-id>
437
+ ```
438
+
439
+ **Local deployment:**
440
+ ```bash
441
+ tail -f /app/logs/mcp_dashboard.log
442
+ ```
443
+
444
+ ## 🔄 Development
445
+
446
+ ### Running Tests
447
+
448
+ ```bash
449
+ # Basic connectivity test
450
+ python test_server.py
451
+
452
+ # Manual API testing
453
+ curl http://localhost:8283/mcp/healthcheck
454
+ curl http://localhost:8283/mcpserver/healthcheck
455
+ ```
456
+
457
+ ### Project Structure
458
+
459
+ ```
460
+ mcp-server/
461
+ ├── server/
462
+ │ ├── __init__.py # FastMCP instance
463
+ │ ├── run_server.py # Main entry point
464
+ │ ├── config.py # Configuration management
465
+ │ ├── config/
466
+ │ │ └── app.config # Configuration file
467
+ │ ├── services/
468
+ │ │ └── dashboard_api/
469
+ │ │ ├── tools/
470
+ │ │ │ └── quality_tools.py # MCP tools
471
+ │ │ ├── utils/
472
+ │ │ │ └── dashboard_service.py # Business logic
473
+ │ │ └── dashboard_server.py # Data access
474
+ │ ├── shared/
475
+ │ │ ├── dependencies.py # Dependency injection
476
+ │ │ ├── exceptions.py # Error handling
477
+ │ │ ├── validators.py # Input validation
478
+ │ │ ├── logging_config.py # Logging setup
479
+ │ │ └── middleware.py # Security middleware
480
+ │ └── eureka/
481
+ │ └── eureka_client.py # Service discovery
482
+ ├── deploy/
483
+ │ └── server/
484
+ │ ├── Dockerfile
485
+ │ ├── run.sh
486
+ │ └── config/
487
+ ├── requirements.txt
488
+ ├── CLAUDE.md # Developer guide
489
+ └── README.md # This file
490
+ ```
491
+
492
+ ### Adding New Tools
493
+
494
+ See [CLAUDE.md](CLAUDE.md) for detailed developer documentation on extending the server.
495
+
496
+ ## 🐳 Docker Deployment
497
+
498
+ ### Building the Image
499
+
500
+ ```bash
501
+ cd deploy/server
502
+ docker build -t gatekeeper-mcp-server .
503
+ ```
504
+
505
+ ### Running with Docker Compose
506
+
507
+ Create `docker-compose.yml`:
508
+ ```yaml
509
+ version: '3.8'
510
+ services:
511
+ mcp-server:
512
+ image: gatekeeper-mcp-server
513
+ ports:
514
+ - "8283:8283"
515
+ environment:
516
+ - HOST_CONTROL_PANEL=your-controlpanel-host
517
+ - PORT_CONTROL_PANEL=8098
518
+ - DASHBOARD_API_KEY=your-api-key
519
+ volumes:
520
+ - ./logs:/app/logs
521
+ restart: unless-stopped
522
+ ```
523
+
524
+ Run:
525
+ ```bash
526
+ docker-compose up -d
527
+ ```
528
+