control-plane-openapi-mcp 1.0.1__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.
- control_plane_openapi_mcp-1.0.1/.github/workflows/ci.yaml +37 -0
- control_plane_openapi_mcp-1.0.1/.gitignore +150 -0
- control_plane_openapi_mcp-1.0.1/CLAUDE.md +122 -0
- control_plane_openapi_mcp-1.0.1/PKG-INFO +234 -0
- control_plane_openapi_mcp-1.0.1/README.md +206 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/__init__.py +3 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/_version.py +34 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/config.py +62 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/core/__init__.py +1 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/core/cache.py +56 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/core/models.py +43 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/core/search.py +93 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/core/service.py +179 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/core/spec_loader.py +75 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/core/spec_processor.py +129 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/prompts/__init__.py +2 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/prompts/api_script_guide.md +219 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/prompts/api_script_prompt.py +25 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/server.py +26 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/tools.py +342 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/utils/__init__.py +1 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/utils/client.py +124 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp/utils/schema_extractor.py +192 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp.egg-info/PKG-INFO +234 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp.egg-info/SOURCES.txt +29 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp.egg-info/dependency_links.txt +1 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp.egg-info/entry_points.txt +2 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp.egg-info/requires.txt +6 -0
- control_plane_openapi_mcp-1.0.1/control_plane_openapi_mcp.egg-info/top_level.txt +1 -0
- control_plane_openapi_mcp-1.0.1/pyproject.toml +48 -0
- control_plane_openapi_mcp-1.0.1/setup.cfg +4 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
name: Publish to PyPI
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Set up Python
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: '3.11'
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: |
|
|
24
|
+
python -m pip install --upgrade pip
|
|
25
|
+
pip install build twine
|
|
26
|
+
|
|
27
|
+
- name: Build package
|
|
28
|
+
run: python -m build
|
|
29
|
+
|
|
30
|
+
- name: Verify package
|
|
31
|
+
run: twine check dist/*
|
|
32
|
+
|
|
33
|
+
- name: Publish to PyPI
|
|
34
|
+
env:
|
|
35
|
+
TWINE_USERNAME: __token__
|
|
36
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
37
|
+
run: python -m twine upload dist/*
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
target/
|
|
76
|
+
|
|
77
|
+
# Jupyter Notebook
|
|
78
|
+
.ipynb_checkpoints
|
|
79
|
+
|
|
80
|
+
# IPython
|
|
81
|
+
profile_default/
|
|
82
|
+
ipython_config.py
|
|
83
|
+
|
|
84
|
+
# pyenv
|
|
85
|
+
.python-version
|
|
86
|
+
|
|
87
|
+
# pipenv
|
|
88
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
89
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
90
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
91
|
+
# install all needed dependencies.
|
|
92
|
+
#Pipfile.lock
|
|
93
|
+
|
|
94
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
95
|
+
__pypackages__/
|
|
96
|
+
|
|
97
|
+
# Celery stuff
|
|
98
|
+
celerybeat-schedule
|
|
99
|
+
celerybeat.pid
|
|
100
|
+
|
|
101
|
+
# SageMath parsed files
|
|
102
|
+
*.sage.py
|
|
103
|
+
|
|
104
|
+
# Environments
|
|
105
|
+
.env
|
|
106
|
+
.venv
|
|
107
|
+
env/
|
|
108
|
+
venv/
|
|
109
|
+
ENV/
|
|
110
|
+
env.bak/
|
|
111
|
+
venv.bak/
|
|
112
|
+
|
|
113
|
+
# Spyder project settings
|
|
114
|
+
.spyderproject
|
|
115
|
+
.spyproject
|
|
116
|
+
|
|
117
|
+
# Rope project settings
|
|
118
|
+
.ropeproject
|
|
119
|
+
|
|
120
|
+
# mkdocs documentation
|
|
121
|
+
/site
|
|
122
|
+
|
|
123
|
+
# mypy
|
|
124
|
+
.mypy_cache/
|
|
125
|
+
.dmypy.json
|
|
126
|
+
dmypy.json
|
|
127
|
+
|
|
128
|
+
# Pyre type checker
|
|
129
|
+
.pyre/
|
|
130
|
+
|
|
131
|
+
# IDE
|
|
132
|
+
.vscode/
|
|
133
|
+
.idea/
|
|
134
|
+
*.swp
|
|
135
|
+
*.swo
|
|
136
|
+
|
|
137
|
+
# UV
|
|
138
|
+
uv.lock
|
|
139
|
+
|
|
140
|
+
# Claude Desktop logs (if any)
|
|
141
|
+
claude_desktop_logs/
|
|
142
|
+
|
|
143
|
+
# Development test outputs
|
|
144
|
+
test_output.json
|
|
145
|
+
*.tmp
|
|
146
|
+
|
|
147
|
+
.claude/
|
|
148
|
+
|
|
149
|
+
# Setuptools SCM version file
|
|
150
|
+
*/_version.py
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
### Development Setup
|
|
8
|
+
```bash
|
|
9
|
+
# Install dependencies and setup environment
|
|
10
|
+
uv sync
|
|
11
|
+
source .venv/bin/activate
|
|
12
|
+
|
|
13
|
+
# Run the MCP server
|
|
14
|
+
uv run control-plane-openapi-mcp
|
|
15
|
+
|
|
16
|
+
# Test all functionality with comprehensive example
|
|
17
|
+
uv run python example.py
|
|
18
|
+
|
|
19
|
+
# Run validation tests
|
|
20
|
+
uv run python test_final.py
|
|
21
|
+
|
|
22
|
+
# Quick function testing
|
|
23
|
+
uv run python -c "from control_plane_openapi_mcp.tools import search_api_operations; print(search_api_operations('stack'))"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Common Development Tasks
|
|
27
|
+
```bash
|
|
28
|
+
# Run individual tool tests
|
|
29
|
+
uv run python dev_test.py
|
|
30
|
+
|
|
31
|
+
# Test server initialization
|
|
32
|
+
uv run python -m control_plane_openapi_mcp.server
|
|
33
|
+
|
|
34
|
+
# Claude Desktop integration testing
|
|
35
|
+
npx @modelcontextprotocol/inspector uv run --directory . control-plane-openapi-mcp
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Architecture Overview
|
|
39
|
+
|
|
40
|
+
This is an MCP (Model Context Protocol) server that provides tools for exploring and interacting with the Facets Control Plane OpenAPI specification. The architecture follows a service-oriented design with clear separation of concerns.
|
|
41
|
+
|
|
42
|
+
### Core Service Architecture
|
|
43
|
+
The system is built around `OpenAPIService` (core/service.py:13) which orchestrates all operations:
|
|
44
|
+
- **Lazy Loading**: Specs are fetched and cached only when first accessed
|
|
45
|
+
- **Smart Caching**: TTL-based caching with configurable duration (default 1 hour)
|
|
46
|
+
- **Error Boundaries**: All operations have comprehensive error handling with graceful degradation
|
|
47
|
+
|
|
48
|
+
### Key Components
|
|
49
|
+
1. **Spec Loading Pipeline**:
|
|
50
|
+
- `SpecLoader` (core/spec_loader.py:14) fetches OpenAPI specs from URLs
|
|
51
|
+
- `SpecProcessor` (core/spec_processor.py:17) extracts and filters operations (excludes deprecated)
|
|
52
|
+
- JSON references are resolved using `jsonref` for proper schema handling
|
|
53
|
+
|
|
54
|
+
2. **Search Engine**:
|
|
55
|
+
- `SearchEngine` (core/search.py:14) uses fuzzy matching with `fuzzywuzzy`
|
|
56
|
+
- Configurable thresholds for operation (70) and schema (80) matching
|
|
57
|
+
- Searches across names, descriptions, and tags
|
|
58
|
+
|
|
59
|
+
3. **Authentication**:
|
|
60
|
+
- Supports environment variables or credentials file (~/.facets/credentials)
|
|
61
|
+
- HTTP Basic Auth for all API calls
|
|
62
|
+
- Configuration managed through `Config` (config.py:10)
|
|
63
|
+
|
|
64
|
+
### MCP Integration
|
|
65
|
+
The server exposes 7 tools through FastMCP:
|
|
66
|
+
- API exploration tools (search, load operations/schemas)
|
|
67
|
+
- API interaction tool (`call_control_plane_api` for GET requests only)
|
|
68
|
+
- Catalog refresh capability
|
|
69
|
+
|
|
70
|
+
## Important Implementation Details
|
|
71
|
+
|
|
72
|
+
### Authentication Setup
|
|
73
|
+
The system uses a two-tier authentication approach:
|
|
74
|
+
1. Environment variables: `FACETS_USERNAME` and `FACETS_TOKEN`
|
|
75
|
+
2. Credentials file with profile support (default profile: "default")
|
|
76
|
+
|
|
77
|
+
### API Coverage
|
|
78
|
+
The OpenAPI spec includes 566 total operations (549 active after filtering deprecated):
|
|
79
|
+
- Stack and project management
|
|
80
|
+
- Kubernetes cluster operations
|
|
81
|
+
- CI/CD artifact management
|
|
82
|
+
- User access control
|
|
83
|
+
- Resource and configuration management
|
|
84
|
+
- Monitoring and alerting
|
|
85
|
+
|
|
86
|
+
### Error Handling Patterns
|
|
87
|
+
All tools follow consistent error handling:
|
|
88
|
+
```python
|
|
89
|
+
try:
|
|
90
|
+
# Operation logic
|
|
91
|
+
except Exception as e:
|
|
92
|
+
logger.error(f"Error description: {e}")
|
|
93
|
+
return {"error": str(e)}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Caching Strategy
|
|
97
|
+
- In-memory caching with configurable TTL
|
|
98
|
+
- Separate caches for raw and processed specs
|
|
99
|
+
- Manual refresh capability through `refresh_api_catalog` tool
|
|
100
|
+
|
|
101
|
+
## Development Guidelines
|
|
102
|
+
|
|
103
|
+
### Adding New Tools
|
|
104
|
+
1. Define tool in `tools.py` using `@mcp_server.tool()` decorator
|
|
105
|
+
2. Implement logic using `OpenAPIService` methods
|
|
106
|
+
3. Follow existing error handling patterns
|
|
107
|
+
4. Add comprehensive logging
|
|
108
|
+
|
|
109
|
+
### Testing New Features
|
|
110
|
+
1. Add test cases to `example.py` for comprehensive testing
|
|
111
|
+
2. Use `dev_test.py` for quick iterations
|
|
112
|
+
3. Validate with Claude Desktop using MCP inspector
|
|
113
|
+
|
|
114
|
+
### Working with OpenAPI Specs
|
|
115
|
+
- The spec includes extensive use of $ref pointers - use `jsonref` for resolution
|
|
116
|
+
- Deprecated operations are automatically filtered during processing
|
|
117
|
+
- Schema definitions include nested references that must be resolved
|
|
118
|
+
|
|
119
|
+
### Performance Considerations
|
|
120
|
+
- Large spec (>10MB) - use caching to avoid repeated fetches
|
|
121
|
+
- Fuzzy search can be expensive - consider threshold tuning
|
|
122
|
+
- API calls should respect rate limits of the Control Plane instance
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: control-plane-openapi-mcp
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: MCP server for Facets Control Plane OpenAPI specification
|
|
5
|
+
Author-email: Anuj Hydrabadi <anuj.hydrabadi@facets.cloud>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Facets-cloud/control-plane-openapi-mcp
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/Facets-cloud/control-plane-openapi-mcp/issues
|
|
9
|
+
Project-URL: Documentation, https://github.com/Facets-cloud/control-plane-openapi-mcp#readme
|
|
10
|
+
Keywords: Facets,MCP,OpenAPI,Python
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Classifier: Intended Audience :: Developers
|
|
19
|
+
Classifier: Development Status :: 4 - Beta
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: mcp[cli]
|
|
23
|
+
Requires-Dist: requests>=2.31.0
|
|
24
|
+
Requires-Dist: jsonref>=1.1.0
|
|
25
|
+
Requires-Dist: pydantic>=2.0
|
|
26
|
+
Requires-Dist: fuzzywuzzy>=0.18.0
|
|
27
|
+
Requires-Dist: python-levenshtein>=0.21.0
|
|
28
|
+
|
|
29
|
+
# Control Plane OpenAPI MCP Server
|
|
30
|
+
|
|
31
|
+
This MCP (Model Context Protocol) Server provides seamless integration with the Facets Control Plane API through its OpenAPI specification. It enables AI assistants to understand, explore, and interact with the complete Facets Control Plane API, making infrastructure management and API integration more accessible through natural language interactions.
|
|
32
|
+
|
|
33
|
+
## Key Features
|
|
34
|
+
|
|
35
|
+
* **Real-time OpenAPI Integration**
|
|
36
|
+
Automatically fetches and processes the latest OpenAPI specification from Facets Control Plane, ensuring you always have access to current API documentation.
|
|
37
|
+
|
|
38
|
+
* **Built-in Script Generation Guidance**
|
|
39
|
+
Includes an MCP prompt that provides step-by-step guidance for creating production-ready scripts that interact with Control Plane APIs, with best practices for authentication, testing, and error handling.
|
|
40
|
+
|
|
41
|
+
* **Intelligent Operation Filtering**
|
|
42
|
+
Automatically excludes deprecated operations (17 filtered out of 566 total) to provide clean, relevant results and improved search performance.
|
|
43
|
+
|
|
44
|
+
* **Advanced Fuzzy Search**
|
|
45
|
+
Search through 549 active operations and 500+ schemas using natural language queries with intelligent matching across summaries, descriptions, tags, and operation IDs.
|
|
46
|
+
|
|
47
|
+
* **Comprehensive API Coverage**
|
|
48
|
+
Access complete operation details including parameters, request bodies, response schemas, and authentication requirements for all Facets Control Plane endpoints.
|
|
49
|
+
|
|
50
|
+
* **Smart Caching System**
|
|
51
|
+
Intelligent TTL-based caching minimizes API calls while ensuring fresh data, with configurable cache duration for optimal performance.
|
|
52
|
+
|
|
53
|
+
* **Detailed Schema Exploration**
|
|
54
|
+
Explore complex data structures with property listings, type information, and relationship mappings for all API schemas.
|
|
55
|
+
|
|
56
|
+
## Available MCP Tools
|
|
57
|
+
|
|
58
|
+
| Tool Name | Description |
|
|
59
|
+
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
60
|
+
| `FIRST_STEP_get_api_script_guide` | **🚀 Start here!** Loads comprehensive API script generation guide - call this tool first before using others. |
|
|
61
|
+
| `refresh_api_catalog` | Refreshes the API catalog by fetching the latest OpenAPI specification from the control plane. |
|
|
62
|
+
| `search_api_operations` | Search for operations using fuzzy matching across operation IDs, summaries, descriptions, and tags. |
|
|
63
|
+
| `search_api_schemas` | Search for schemas by name and description to find relevant data structures. |
|
|
64
|
+
| `load_api_operation_by_operationId` | Load detailed operation information by its unique operation ID including parameters and responses. |
|
|
65
|
+
| `load_api_operation_by_path_and_method` | Load operation details by specifying the exact API path and HTTP method. |
|
|
66
|
+
| `load_api_schema_by_schemaName` | Load comprehensive schema details including properties, types, and validation requirements. |
|
|
67
|
+
| `call_control_plane_api` | Make authenticated GET requests to the Control Plane API using the provided path. |
|
|
68
|
+
|
|
69
|
+
## Available MCP Prompts
|
|
70
|
+
|
|
71
|
+
| Prompt Name | Description |
|
|
72
|
+
| ----------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
73
|
+
| `Control Plane API Script Generation` | Provides step-by-step guidance for creating production-ready scripts that interact with Control Plane APIs. |
|
|
74
|
+
|
|
75
|
+
## Prerequisites
|
|
76
|
+
|
|
77
|
+
The MCP Server requires [uv](https://github.com/astral-sh/uv) for dependency management and execution.
|
|
78
|
+
|
|
79
|
+
#### Install `uv` with Homebrew:
|
|
80
|
+
```bash
|
|
81
|
+
brew install uv
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
For other installation methods, see the [official uv installation guide](https://docs.astral.sh/uv/getting-started/installation/).
|
|
85
|
+
|
|
86
|
+
## Integration with Claude
|
|
87
|
+
|
|
88
|
+
Add the following to your `claude_desktop_config.json`:
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"mcpServers": {
|
|
93
|
+
"control-plane-openapi": {
|
|
94
|
+
"command": "uv",
|
|
95
|
+
"args": ["run", "--directory", "/path/to/your/cloned/control-plane-openapi-mcp", "control-plane-openapi-mcp"],
|
|
96
|
+
"env": {
|
|
97
|
+
"CONTROL_PLANE_URL": "https://<customername>.console.facets.cloud",
|
|
98
|
+
"FACETS_USERNAME": "<YOUR_USERNAME>",
|
|
99
|
+
"FACETS_TOKEN": "<YOUR_TOKEN>",
|
|
100
|
+
"FACETS_PROFILE": "default",
|
|
101
|
+
"CACHE_TTL": "3600"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
⚠️ Replace `<YOUR_USERNAME>` and `<YOUR_TOKEN>` with your actual Facets credentials.
|
|
109
|
+
|
|
110
|
+
### Environment Variables
|
|
111
|
+
|
|
112
|
+
- `CONTROL_PLANE_URL`: Base URL of the Facets Control Plane (default: demo instance)
|
|
113
|
+
- `FACETS_USERNAME`: Your Facets username for API authentication
|
|
114
|
+
- `FACETS_TOKEN`: Your Facets access token for API authentication
|
|
115
|
+
- `FACETS_PROFILE`: Facets profile to use from credentials file (default: "default")
|
|
116
|
+
- `CACHE_TTL`: Cache time-to-live in seconds (default: 3600)
|
|
117
|
+
|
|
118
|
+
### Authentication
|
|
119
|
+
|
|
120
|
+
The server supports two authentication methods:
|
|
121
|
+
|
|
122
|
+
1. **Environment Variables**: Set `FACETS_USERNAME` and `FACETS_TOKEN`
|
|
123
|
+
2. **Credentials File**: Configure `~/.facets/credentials` with profile-based credentials
|
|
124
|
+
|
|
125
|
+
For credential setup, refer to the [Facets Authentication Guide](https://readme.facets.cloud/reference/authentication-setup).
|
|
126
|
+
|
|
127
|
+
## Usage Highlights
|
|
128
|
+
|
|
129
|
+
- Uses `search_api_operations` and `search_api_schemas` to find relevant endpoints using natural language
|
|
130
|
+
- Uses specific load operations to get detailed parameter and response information
|
|
131
|
+
- Uses `call_control_plane_api` to make actual API calls and get real data from your Facets environment
|
|
132
|
+
- Leverages the fuzzy search to find operations even with partial or approximate terms
|
|
133
|
+
|
|
134
|
+
## API Coverage
|
|
135
|
+
|
|
136
|
+
The server provides access to the complete Facets Control Plane API including:
|
|
137
|
+
|
|
138
|
+
- **Stack Management**: Create, update, delete, and manage infrastructure stacks
|
|
139
|
+
- **Cluster Operations**: Deploy, monitor, and manage Kubernetes clusters
|
|
140
|
+
- **Artifact Management**: Handle CI/CD artifacts and routing rules
|
|
141
|
+
- **User & Access Control**: Manage users, groups, roles, and permissions
|
|
142
|
+
- **Resource Management**: Handle cloud resources and configurations
|
|
143
|
+
- **Monitoring & Alerts**: Access deployment logs, metrics, and monitoring data
|
|
144
|
+
- **Authentication**: OAuth integrations, tokens, and account management
|
|
145
|
+
|
|
146
|
+
## Example Prompts
|
|
147
|
+
|
|
148
|
+
When using with Claude, try these example prompts:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
"Show me all project-related operations in the Facets API"
|
|
152
|
+
"What are the required parameters for creating a new project?"
|
|
153
|
+
"Find operations related to environment deployments"
|
|
154
|
+
"Show me the project schema structure with all its properties"
|
|
155
|
+
"Generate a TypeScript interface for the project model"
|
|
156
|
+
"Get the current list of projects from my environment"
|
|
157
|
+
"Show me details of a specific project named 'my-production-project'"
|
|
158
|
+
"What environments are running in my Facets environment?"
|
|
159
|
+
"Create an example API call to get project information"
|
|
160
|
+
"Find all endpoints that handle artifact routing"
|
|
161
|
+
"What authentication methods are available in the API?"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Local Development
|
|
165
|
+
|
|
166
|
+
### Setting Up Development Environment
|
|
167
|
+
|
|
168
|
+
1. **Clone the repository**:
|
|
169
|
+
```bash
|
|
170
|
+
git clone <repository-url>
|
|
171
|
+
cd control-plane-openapi-mcp
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
2. **Create virtual environment and install dependencies**:
|
|
175
|
+
```bash
|
|
176
|
+
uv sync
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
3. **Activate the virtual environment**:
|
|
180
|
+
```bash
|
|
181
|
+
source .venv/bin/activate # On macOS/Linux
|
|
182
|
+
# or
|
|
183
|
+
.venv\Scripts\activate # On Windows
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Testing the MCP Server
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# Start the MCP server (will wait for stdin input)
|
|
190
|
+
uv run control-plane-openapi-mcp
|
|
191
|
+
|
|
192
|
+
# Test with custom OpenAPI URL
|
|
193
|
+
FACETS_OPENAPI_URL="https://your-instance.com/v3/api-docs" uv run control-plane-openapi-mcp
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Development Workflow
|
|
197
|
+
|
|
198
|
+
1. **Make changes** to the source code
|
|
199
|
+
2. **Test locally** using the example scripts
|
|
200
|
+
3. **Verify MCP integration** with Claude Desktop
|
|
201
|
+
4. **Run validation** to ensure no regressions
|
|
202
|
+
5. **Commit changes** with descriptive messages
|
|
203
|
+
|
|
204
|
+
### Project Structure
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
control_plane_openapi_mcp/
|
|
208
|
+
├── __init__.py # Package initialization
|
|
209
|
+
├── config.py # Configuration and MCP setup
|
|
210
|
+
├── server.py # Main MCP server entry point
|
|
211
|
+
├── tools.py # MCP tool implementations
|
|
212
|
+
└── core/ # Core functionality
|
|
213
|
+
├── models.py # Pydantic data models
|
|
214
|
+
├── spec_loader.py # OpenAPI spec fetching and processing
|
|
215
|
+
├── spec_processor.py # Operation and schema extraction
|
|
216
|
+
├── search.py # Fuzzy search engine
|
|
217
|
+
├── cache.py # TTL-based caching
|
|
218
|
+
└── service.py # Main orchestrating service
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Architecture
|
|
224
|
+
|
|
225
|
+
- **`SpecLoader`**: Fetches and processes OpenAPI specifications with JSON reference resolution
|
|
226
|
+
- **`SpecProcessor`**: Extracts operations and schemas while filtering deprecated endpoints
|
|
227
|
+
- **`SearchEngine`**: Provides fuzzy search capabilities with configurable matching thresholds
|
|
228
|
+
- **`OpenAPIService`**: Main service coordinating all components with intelligent caching
|
|
229
|
+
- **`SimpleCache`**: TTL-based caching for performance optimization
|
|
230
|
+
- **MCP Tools**: Specialized tools exposing functionality to AI assistants
|
|
231
|
+
|
|
232
|
+
## License
|
|
233
|
+
|
|
234
|
+
This project is licensed under the MIT License. You are free to use, modify, and distribute it under its terms.
|