awslabs.cdk-mcp-server 0.1.1__py3-none-any.whl → 0.1.3__py3-none-any.whl
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.
- awslabs/cdk_mcp_server/core/resources.py +104 -15
- awslabs/cdk_mcp_server/core/server.py +4 -3
- awslabs/cdk_mcp_server/core/tools.py +6 -1
- awslabs/cdk_mcp_server/data/genai_cdk_loader.py +508 -349
- {awslabs_cdk_mcp_server-0.1.1.dist-info → awslabs_cdk_mcp_server-0.1.3.dist-info}/METADATA +24 -1
- awslabs_cdk_mcp_server-0.1.3.dist-info/RECORD +33 -0
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/agent/actiongroups.md +0 -137
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/agent/alias.md +0 -39
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/agent/collaboration.md +0 -91
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/agent/creation.md +0 -149
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/agent/custom_orchestration.md +0 -74
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/agent/overview.md +0 -78
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/agent/prompt_override.md +0 -70
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/bedrockguardrails.md +0 -188
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/chunking.md +0 -137
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/datasources.md +0 -225
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/kendra.md +0 -81
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/overview.md +0 -116
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/parsing.md +0 -36
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/transformation.md +0 -30
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/vector/aurora.md +0 -185
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/vector/creation.md +0 -80
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/vector/opensearch.md +0 -56
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/knowledgebases/vector/pinecone.md +0 -66
- awslabs/cdk_mcp_server/static/genai_cdk/bedrock/profiles.md +0 -153
- awslabs/cdk_mcp_server/static/genai_cdk/opensearch-vectorindex/overview.md +0 -135
- awslabs/cdk_mcp_server/static/genai_cdk/opensearchserverless/overview.md +0 -17
- awslabs_cdk_mcp_server-0.1.1.dist-info/RECORD +0 -54
- {awslabs_cdk_mcp_server-0.1.1.dist-info → awslabs_cdk_mcp_server-0.1.3.dist-info}/WHEEL +0 -0
- {awslabs_cdk_mcp_server-0.1.1.dist-info → awslabs_cdk_mcp_server-0.1.3.dist-info}/entry_points.txt +0 -0
- {awslabs_cdk_mcp_server-0.1.1.dist-info → awslabs_cdk_mcp_server-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {awslabs_cdk_mcp_server-0.1.1.dist-info → awslabs_cdk_mcp_server-0.1.3.dist-info}/licenses/NOTICE +0 -0
|
@@ -14,10 +14,8 @@
|
|
|
14
14
|
import logging
|
|
15
15
|
from awslabs.cdk_mcp_server.data.cdk_nag_parser import get_errors, get_rule_pack, get_warnings
|
|
16
16
|
from awslabs.cdk_mcp_server.data.genai_cdk_loader import (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
get_genai_cdk_overview,
|
|
20
|
-
list_available_sections,
|
|
17
|
+
get_section,
|
|
18
|
+
list_sections,
|
|
21
19
|
)
|
|
22
20
|
from awslabs.cdk_mcp_server.data.lambda_powertools_loader import get_lambda_powertools_section
|
|
23
21
|
from awslabs.cdk_mcp_server.data.solutions_constructs_parser import get_pattern_raw
|
|
@@ -182,19 +180,29 @@ async def get_genai_cdk_construct_section_resource(
|
|
|
182
180
|
"""Get a specific section of documentation for a GenAI CDK construct.
|
|
183
181
|
|
|
184
182
|
Example URIs:
|
|
185
|
-
- genai-cdk-constructs://bedrock/
|
|
186
|
-
- genai-cdk-constructs://bedrock/
|
|
183
|
+
- genai-cdk-constructs://bedrock/agents/actiongroups
|
|
184
|
+
- genai-cdk-constructs://bedrock/agents/alias
|
|
187
185
|
- genai-cdk-constructs://bedrock/knowledgebases/chunking
|
|
188
186
|
|
|
189
187
|
Args:
|
|
190
188
|
construct_type: Type of the construct (e.g., 'bedrock')
|
|
191
|
-
construct_name: Name of the construct (e.g., '
|
|
189
|
+
construct_name: Name of the construct (e.g., 'agents', 'knowledgebases')
|
|
192
190
|
section: Section of the documentation (e.g., 'actiongroups', 'chunking')
|
|
193
191
|
|
|
194
192
|
Returns:
|
|
195
193
|
String containing the requested section of documentation
|
|
196
194
|
"""
|
|
197
|
-
|
|
195
|
+
# Fetch section from GitHub
|
|
196
|
+
result = await get_section(construct_type, construct_name, section)
|
|
197
|
+
|
|
198
|
+
# Check for error
|
|
199
|
+
if result.get('status') == 'error' or result.get('status') == 'not_found':
|
|
200
|
+
if 'error' in result:
|
|
201
|
+
return f'Error fetching section from GitHub: {result["error"]}'
|
|
202
|
+
else:
|
|
203
|
+
return f"Error: Section '{section}' not found in {construct_type}/{construct_name}"
|
|
204
|
+
|
|
205
|
+
return result['content']
|
|
198
206
|
|
|
199
207
|
|
|
200
208
|
async def get_genai_cdk_construct_nested_section_resource(
|
|
@@ -215,26 +223,55 @@ async def get_genai_cdk_construct_nested_section_resource(
|
|
|
215
223
|
Returns:
|
|
216
224
|
String containing the requested nested section of documentation
|
|
217
225
|
"""
|
|
226
|
+
# First try to use parent as the section name and child as a subsection
|
|
218
227
|
section = f'{parent}/{child}'
|
|
219
|
-
|
|
228
|
+
result = await get_section(construct_type, construct_name, section)
|
|
229
|
+
|
|
230
|
+
# Check if the first attempt succeeded
|
|
231
|
+
if result.get('status') == 'success':
|
|
232
|
+
return result['content']
|
|
233
|
+
|
|
234
|
+
# If that fails, try as a combined section name
|
|
235
|
+
section = f'{parent} {child}'
|
|
236
|
+
result = await get_section(construct_type, construct_name, section)
|
|
237
|
+
|
|
238
|
+
# Check for errors in both attempts
|
|
239
|
+
if result.get('status') == 'error' or result.get('status') == 'not_found':
|
|
240
|
+
if 'error' in result:
|
|
241
|
+
return f'Error fetching nested section from GitHub: {result["error"]}'
|
|
242
|
+
else:
|
|
243
|
+
return (
|
|
244
|
+
f"Error: Section '{parent}/{child}' not found in {construct_type}/{construct_name}"
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
return result['content']
|
|
220
248
|
|
|
221
249
|
|
|
222
250
|
async def get_available_sections_resource(construct_type: str, construct_name: str) -> str:
|
|
223
251
|
"""Get available sections for a specific construct.
|
|
224
252
|
|
|
225
253
|
Example URI:
|
|
226
|
-
- genai-cdk-constructs://bedrock/
|
|
254
|
+
- genai-cdk-constructs://bedrock/agents/sections
|
|
227
255
|
- genai-cdk-constructs://bedrock/knowledgebases/sections
|
|
228
256
|
|
|
229
257
|
Args:
|
|
230
258
|
construct_type: Type of the construct (e.g., 'bedrock')
|
|
231
|
-
construct_name: Name of the construct (e.g., '
|
|
259
|
+
construct_name: Name of the construct (e.g., 'agents', 'knowledgebases')
|
|
232
260
|
|
|
233
261
|
Returns:
|
|
234
262
|
String containing available sections in markdown format
|
|
235
263
|
"""
|
|
236
|
-
|
|
264
|
+
# Handle singular/plural conversion for agent
|
|
265
|
+
if construct_name.lower() == 'agent':
|
|
266
|
+
construct_name = 'agents'
|
|
237
267
|
|
|
268
|
+
# List sections from GitHub
|
|
269
|
+
result = await list_sections(construct_type, construct_name)
|
|
270
|
+
|
|
271
|
+
if 'error' in result:
|
|
272
|
+
return f'Error fetching sections from GitHub: {result["error"]}'
|
|
273
|
+
|
|
274
|
+
sections = result['sections']
|
|
238
275
|
if not sections:
|
|
239
276
|
return f'No sections found for {construct_name} in {construct_type}.'
|
|
240
277
|
|
|
@@ -252,8 +289,9 @@ async def get_genai_cdk_construct_resource(construct_type: str, construct_name:
|
|
|
252
289
|
"""Get essential information about a GenAI CDK construct.
|
|
253
290
|
|
|
254
291
|
Example URIs:
|
|
255
|
-
- genai-cdk-constructs://bedrock/
|
|
292
|
+
- genai-cdk-constructs://bedrock/Agents
|
|
256
293
|
- genai-cdk-constructs://bedrock/KnowledgeBase
|
|
294
|
+
- genai-cdk-constructs://bedrock/Amazon Bedrock Knowledge BasesVectorKnowledgeBase (from search results)
|
|
257
295
|
|
|
258
296
|
Args:
|
|
259
297
|
construct_type: Type of the construct (e.g., 'bedrock')
|
|
@@ -262,7 +300,50 @@ async def get_genai_cdk_construct_resource(construct_type: str, construct_name:
|
|
|
262
300
|
Returns:
|
|
263
301
|
String containing formatted properties and code examples in markdown
|
|
264
302
|
"""
|
|
265
|
-
|
|
303
|
+
from awslabs.cdk_mcp_server.data.genai_cdk_loader import fetch_readme as get_readme
|
|
304
|
+
|
|
305
|
+
# Handle search result format (e.g., "Amazon Bedrock Knowledge BasesVectorKnowledgeBase")
|
|
306
|
+
if construct_name.startswith('Amazon Bedrock Knowledge Bases'):
|
|
307
|
+
# Extract the section name that comes after "Amazon Bedrock Knowledge Bases"
|
|
308
|
+
# This is for the special case of knowledge-bases subdirectory in bedrock
|
|
309
|
+
section_name = construct_name.replace('Amazon Bedrock Knowledge Bases', '').strip()
|
|
310
|
+
if section_name:
|
|
311
|
+
# Get the section from the knowledge-bases README
|
|
312
|
+
result = await get_section('bedrock', 'knowledge-bases', section_name)
|
|
313
|
+
if 'error' not in result:
|
|
314
|
+
return result['content']
|
|
315
|
+
|
|
316
|
+
# If no section specified or section not found, get the whole README
|
|
317
|
+
result = await get_readme('bedrock', 'knowledge-bases')
|
|
318
|
+
if 'error' not in result:
|
|
319
|
+
return result['content']
|
|
320
|
+
|
|
321
|
+
# Normalize construct name
|
|
322
|
+
construct_name_lower = construct_name.lower()
|
|
323
|
+
|
|
324
|
+
# If the construct is Agent, use agents for GitHub
|
|
325
|
+
if construct_name_lower == 'agent':
|
|
326
|
+
construct_name_lower = 'agents'
|
|
327
|
+
|
|
328
|
+
# If it looks like a "knowledge base" reference, try the subdirectory
|
|
329
|
+
if 'knowledge' in construct_name_lower and 'base' in construct_name_lower:
|
|
330
|
+
result = await get_readme('bedrock', 'knowledge-bases')
|
|
331
|
+
if 'error' not in result:
|
|
332
|
+
return result['content']
|
|
333
|
+
|
|
334
|
+
# Fetch the entire README from GitHub
|
|
335
|
+
result = await get_readme(construct_type)
|
|
336
|
+
|
|
337
|
+
if 'error' not in result:
|
|
338
|
+
return result['content']
|
|
339
|
+
|
|
340
|
+
# If that fails, try to fetch a specific construct README
|
|
341
|
+
result = await get_readme(construct_type, construct_name_lower)
|
|
342
|
+
|
|
343
|
+
if 'error' in result:
|
|
344
|
+
return f'Error fetching construct from GitHub: {result["error"]}'
|
|
345
|
+
|
|
346
|
+
return result['content']
|
|
266
347
|
|
|
267
348
|
|
|
268
349
|
async def get_genai_cdk_overview_resource(construct_type: str) -> str:
|
|
@@ -279,4 +360,12 @@ async def get_genai_cdk_overview_resource(construct_type: str) -> str:
|
|
|
279
360
|
Returns:
|
|
280
361
|
String containing overview documentation in markdown
|
|
281
362
|
"""
|
|
282
|
-
|
|
363
|
+
from awslabs.cdk_mcp_server.data.genai_cdk_loader import fetch_readme as get_readme
|
|
364
|
+
|
|
365
|
+
# Fetch README from GitHub
|
|
366
|
+
result = await get_readme(construct_type)
|
|
367
|
+
|
|
368
|
+
if 'error' in result:
|
|
369
|
+
return f'Error fetching overview from GitHub: {result["error"]}'
|
|
370
|
+
|
|
371
|
+
return result['content']
|
|
@@ -41,15 +41,16 @@ mcp.resource('lambda-powertools://')(resources.get_lambda_powertools_index)
|
|
|
41
41
|
mcp.resource('aws-solutions-constructs://{pattern_name}')(
|
|
42
42
|
resources.get_solutions_construct_pattern_resource
|
|
43
43
|
)
|
|
44
|
+
# Fixed the ordering - more specific routes first
|
|
45
|
+
mcp.resource('genai-cdk-constructs://{construct_type}/{construct_name}/sections')(
|
|
46
|
+
resources.get_available_sections_resource
|
|
47
|
+
)
|
|
44
48
|
mcp.resource('genai-cdk-constructs://{construct_type}/{construct_name}/{section}')(
|
|
45
49
|
resources.get_genai_cdk_construct_section_resource
|
|
46
50
|
)
|
|
47
51
|
mcp.resource('genai-cdk-constructs://{construct_type}/{construct_name}/{parent}/{child}')(
|
|
48
52
|
resources.get_genai_cdk_construct_nested_section_resource
|
|
49
53
|
)
|
|
50
|
-
mcp.resource('genai-cdk-constructs://{construct_type}/{construct_name}/sections')(
|
|
51
|
-
resources.get_available_sections_resource
|
|
52
|
-
)
|
|
53
54
|
mcp.resource('genai-cdk-constructs://{construct_type}/{construct_name}')(
|
|
54
55
|
resources.get_genai_cdk_construct_resource
|
|
55
56
|
)
|
|
@@ -396,11 +396,16 @@ async def search_genai_cdk_constructs(
|
|
|
396
396
|
|
|
397
397
|
The search is flexible and will match any of your search terms (OR logic).
|
|
398
398
|
It handles common variations like singular/plural forms and terms with/without spaces.
|
|
399
|
+
Content is fetched dynamically from GitHub to ensure the most up-to-date documentation.
|
|
399
400
|
|
|
400
401
|
Examples:
|
|
401
402
|
- "bedrock agent" - Returns all agent-related constructs
|
|
402
403
|
- "knowledgebase vector" - Returns knowledge base constructs related to vector stores
|
|
403
404
|
- "agent actiongroups" - Returns action groups for agents
|
|
405
|
+
- "opensearch vector" - Returns OpenSearch vector constructs
|
|
406
|
+
|
|
407
|
+
The search supports subdirectory content (like knowledge bases and their sections)
|
|
408
|
+
and will find matches across all available content.
|
|
404
409
|
|
|
405
410
|
Args:
|
|
406
411
|
ctx: MCP context
|
|
@@ -412,7 +417,7 @@ async def search_genai_cdk_constructs(
|
|
|
412
417
|
"""
|
|
413
418
|
try:
|
|
414
419
|
# Get list of constructs
|
|
415
|
-
constructs = list_available_constructs(construct_type)
|
|
420
|
+
constructs = await list_available_constructs(construct_type)
|
|
416
421
|
|
|
417
422
|
# If no query, return all constructs
|
|
418
423
|
if not query:
|