Skip to content

Commit 9f64ac9

Browse files
author
Michael Christensen
committed
Add MCP resources from Cassandra/Keyspaces documentation
1 parent f694698 commit 9f64ac9

File tree

1 file changed

+251
-0
lines changed
  • src/amazon-keyspaces-mcp-server/awslabs/amazon_keyspaces_mcp_server

1 file changed

+251
-0
lines changed

src/amazon-keyspaces-mcp-server/awslabs/amazon_keyspaces_mcp_server/server.py

Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,260 @@
7373
2. Use describeTable to understand table schemas before querying
7474
3. Only SELECT queries are permitted for data safety
7575
4. Use analyzeQueryPerformance to optimize queries before execution
76+
77+
## Resources
78+
79+
- **keyspaces://developer-guide**: Complete developer guide with best practices
80+
- **keyspaces://cql-reference**: CQL language reference for Keyspaces
81+
- **keyspaces://api-reference**: AWS Keyspaces API documentation
82+
- **keyspaces://streams-api**: Keyspaces Streams API reference
83+
- **keyspaces://code-examples**: Sample code repository
7684
""",
7785
)
7886

87+
88+
@mcp.resource('keyspaces://developer-guide')
89+
def get_developer_guide() -> str:
90+
"""Amazon Keyspaces Developer Guide with best practices and tutorials."""
91+
return """# Amazon Keyspaces Developer Guide
92+
93+
Complete guide for developing applications with Amazon Keyspaces.
94+
95+
**Documentation**: https://docs.aws.amazon.com/pdfs/keyspaces/latest/devguide/AmazonKeyspaces.pdf
96+
97+
## Key Topics
98+
99+
### Getting Started
100+
- Setting up credentials and connections
101+
- Creating keyspaces and tables
102+
- Loading data
103+
104+
### Data Modeling
105+
- Partition key design
106+
- Clustering column strategies
107+
- Denormalization patterns
108+
109+
### Performance
110+
- Read/write capacity modes
111+
- Auto-scaling configuration
112+
- Query optimization
113+
114+
### Security
115+
- IAM authentication
116+
- Encryption at rest and in transit
117+
- VPC endpoints
118+
119+
### Monitoring
120+
- CloudWatch metrics
121+
- CloudTrail logging
122+
- Point-in-time recovery
123+
124+
Refer to the full PDF for detailed examples and best practices.
125+
"""
126+
127+
128+
@mcp.resource('keyspaces://cql-reference')
129+
def get_cql_reference() -> str:
130+
"""CQL language reference for Amazon Keyspaces."""
131+
return """# Amazon Keyspaces CQL Reference
132+
133+
Cassandra Query Language (CQL) syntax and operations supported by Keyspaces.
134+
135+
**Documentation**: https://docs.aws.amazon.com/pdfs/keyspaces/latest/devguide/AmazonKeyspaces.pdf
136+
137+
## Supported CQL Operations
138+
139+
### Data Definition (DDL)
140+
- CREATE/ALTER/DROP KEYSPACE
141+
- CREATE/ALTER/DROP TABLE
142+
- CREATE/DROP INDEX
143+
144+
### Data Manipulation (DML)
145+
- SELECT (with WHERE, ORDER BY, LIMIT)
146+
- INSERT, UPDATE, DELETE
147+
- BATCH operations
148+
149+
### Data Types
150+
- Primitive: text, int, bigint, boolean, decimal, timestamp, uuid
151+
- Collections: list, set, map
152+
- Special: frozen, tuple
153+
154+
### Limitations
155+
- No materialized views
156+
- No user-defined functions
157+
- No aggregate functions (COUNT, SUM)
158+
- No TRUNCATE TABLE
159+
160+
See full PDF for complete syntax and examples.
161+
"""
162+
163+
164+
@mcp.resource('keyspaces://api-reference')
165+
def get_api_reference() -> str:
166+
"""AWS Keyspaces API Reference for management operations."""
167+
return """# Amazon Keyspaces API Reference
168+
169+
Complete API documentation for Amazon Keyspaces management operations.
170+
171+
**Documentation**: https://docs.aws.amazon.com/pdfs/keyspaces/latest/APIReference/keyspaces-api.pdf
172+
173+
## Key API Operations
174+
175+
### Keyspace Management
176+
- CreateKeyspace, DeleteKeyspace, GetKeyspace, ListKeyspaces
177+
178+
### Table Management
179+
- CreateTable, DeleteTable, GetTable, UpdateTable, ListTables, RestoreTable
180+
181+
### Configuration
182+
- GetTableAutoScalingSettings
183+
- TagResource, UntagResource, ListTagsForResource
184+
185+
### Capacity Modes
186+
- PAY_PER_REQUEST: Serverless, pay per request
187+
- PROVISIONED: Fixed capacity with auto-scaling support
188+
189+
### Encryption
190+
- AWS_OWNED_KMS_KEY (default)
191+
- CUSTOMER_MANAGED_KMS_KEY
192+
193+
### Point-in-Time Recovery
194+
- Continuous backups for up to 35 days
195+
- Restore to any point within recovery window
196+
197+
For detailed schemas, parameters, and examples, refer to the full PDF documentation.
198+
"""
199+
200+
201+
@mcp.resource('keyspaces://streams-api')
202+
def get_streams_api() -> str:
203+
"""Amazon Keyspaces Streams API Reference for change data capture."""
204+
return """# Amazon Keyspaces Streams API Reference
205+
206+
API for capturing and processing change data from Keyspaces tables.
207+
208+
**Documentation**: https://docs.aws.amazon.com/pdfs/keyspaces/latest/StreamsAPIReference/keyspaces-streams-api.pdf
209+
210+
## Overview
211+
212+
Keyspaces Streams captures item-level changes (inserts, updates, deletes) in near real-time.
213+
214+
## Key Operations
215+
216+
### Stream Management
217+
- GetRecords: Read change records from a stream
218+
- DescribeStream: Get stream metadata
219+
- ListStreams: List available streams
220+
221+
### Use Cases
222+
- Real-time analytics
223+
- Data replication
224+
- Audit logging
225+
- Event-driven architectures
226+
227+
### Integration
228+
- AWS Lambda triggers
229+
- Kinesis Data Streams
230+
- Custom consumers
231+
232+
Refer to the full PDF for detailed API specifications and examples.
233+
"""
234+
235+
236+
@mcp.resource('keyspaces://code-examples')
237+
def get_code_examples() -> str:
238+
"""Amazon Keyspaces code examples and sample applications."""
239+
return """# Amazon Keyspaces Code Examples
240+
241+
Sample code and reference implementations for common use cases.
242+
243+
**Repository**: https://github.com/aws-samples/amazon-keyspaces-examples
244+
245+
## Available Examples
246+
247+
### Connection Patterns
248+
- Python, Java, Node.js drivers
249+
- IAM authentication
250+
- SSL/TLS configuration
251+
252+
### Data Operations
253+
- CRUD operations
254+
- Batch processing
255+
- Pagination
256+
257+
### Advanced Features
258+
- Point-in-time recovery
259+
- Auto-scaling setup
260+
- Multi-region replication
261+
262+
### Integration Examples
263+
- Lambda functions
264+
- ECS/EKS deployments
265+
- Spring Boot applications
266+
267+
Clone the repository for complete, runnable examples with detailed README files.
268+
"""
269+
270+
271+
@mcp.resource('cassandra://cql-reference')
272+
def get_cassandra_cql_reference() -> str:
273+
"""Apache Cassandra CQL reference documentation."""
274+
return """# Apache Cassandra CQL Reference
275+
276+
Complete CQL language reference for Apache Cassandra.
277+
278+
**Documentation**: https://cassandra.apache.org/doc/trunk/cassandra/developing/cql/index.html
279+
280+
## Key Sections
281+
282+
### CQL Basics
283+
- Definitions: https://cassandra.apache.org/doc/trunk/cassandra/developing/cql/definitions.html
284+
- Data Types: https://cassandra.apache.org/doc/trunk/cassandra/developing/cql/types.html
285+
286+
### Operations
287+
- DDL (Data Definition): https://cassandra.apache.org/doc/trunk/cassandra/developing/cql/ddl.html
288+
- DML (Data Manipulation): https://cassandra.apache.org/doc/trunk/cassandra/developing/cql/dml.html
289+
- Operators: https://cassandra.apache.org/doc/trunk/cassandra/developing/cql/operators.html
290+
291+
### Advanced Features
292+
- Indexing: https://cassandra.apache.org/doc/trunk/cassandra/developing/cql/indexing/indexing-concepts.html
293+
- Materialized Views: https://cassandra.apache.org/doc/trunk/cassandra/developing/cql/mvs.html
294+
- Functions: https://cassandra.apache.org/doc/trunk/cassandra/developing/cql/functions.html
295+
- JSON Support: https://cassandra.apache.org/doc/trunk/cassandra/developing/cql/json.html
296+
297+
### Reference
298+
- CQL Commands: https://cassandra.apache.org/doc/trunk/cassandra/reference/cql-commands/commands-toc.html
299+
- Single File Reference: https://cassandra.apache.org/doc/trunk/cassandra/developing/cql/cql_singlefile.html
300+
"""
301+
302+
303+
@mcp.resource('cassandra://data-modeling')
304+
def get_cassandra_data_modeling() -> str:
305+
"""Apache Cassandra data modeling guide."""
306+
return """# Apache Cassandra Data Modeling
307+
308+
Comprehensive guide to data modeling in Cassandra.
309+
310+
**Documentation**: https://cassandra.apache.org/doc/trunk/cassandra/developing/data-modeling/index.html
311+
312+
## Key Topics
313+
314+
### Conceptual Modeling
315+
- Introduction: https://cassandra.apache.org/doc/trunk/cassandra/developing/data-modeling/intro.html
316+
- Concepts: https://cassandra.apache.org/doc/trunk/cassandra/developing/data-modeling/data-modeling_conceptual.html
317+
318+
### Design Process
319+
- RDBMS Design: https://cassandra.apache.org/doc/trunk/cassandra/developing/data-modeling/data-modeling_rdbms.html
320+
- Query Patterns: https://cassandra.apache.org/doc/trunk/cassandra/developing/data-modeling/data-modeling_queries.html
321+
- Logical Modeling: https://cassandra.apache.org/doc/trunk/cassandra/developing/data-modeling/data-modeling_logical.html
322+
- Physical Modeling: https://cassandra.apache.org/doc/trunk/cassandra/developing/data-modeling/data-modeling_physical.html
323+
324+
### Best Practices
325+
- Evaluation: https://cassandra.apache.org/doc/trunk/cassandra/developing/data-modeling/data-modeling_refining.html
326+
- Schema Definition: https://cassandra.apache.org/doc/trunk/cassandra/developing/data-modeling/data-modeling_schema.html
327+
"""
328+
329+
79330
# Global handle to hold the proxy to the specific database client
80331
_PROXY = None
81332

0 commit comments

Comments
 (0)