The IGG (Idea Generator Generator) project generates creative ideas using Markov chains trained on CSV data. It provides both a static web interface and an MCP (Model Context Protocol) server for integration with AI tools like Claude Code.
- π Automatic CSV β Markov Model Processing: Upload CSV files and get trained models
- π Static Web Interface: Browse and generate ideas from models
- π MCP Server Integration: Use with Claude Code and other AI tools
- βοΈ AWS CDK Infrastructure: Fully managed serverless deployment
- π Model Caching: Efficient local and remote model storage
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Web Frontend β β MCP Server β β AWS CDK Stack β
β β β β β β
β - Static Site β β - API Gateway β β - S3 Buckets β
β - Model Browse β β - Basic Auth β β - API Gateway β
β - Idea Gen β β - Lambda Funcs β β - Lambda Funcs β
β β β - Custom Domain β β - SSL Certs β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
βββ src/ # Python source code
β βββ mcp_server.py # MCP server entry point
β βββ mcp_markov_models.py # MCP Markov logic
β βββ model_processor.py # Lambda CSV processor
β βββ generate_markov_models.py # Standalone utility
βββ cdk/ # AWS CDK infrastructure
β βββ app.py # CDK application
β βββ custom_constructs/ # Reusable CDK components
β β βββ mcp_server_construct.py # MCP server infrastructure
β β βββ static_site_construct.py # Static site infrastructure
β β βββ model_processor_construct.py # Lambda processor infrastructure
β βββ stacks/ # CDK stack definitions
β βββ mcp_stack.py # MCP server infrastructure
β βββ static_site_stack.py # Static site infrastructure
βββ test/ # Unit tests
βββ web/ # Frontend web interface
β βββ index.html # Static site frontend
β βββ samples/ # Sample data files
β βββ script/ # Frontend JavaScript
βββ models/cache/ # Local model cache
βββ lambda-layer/ # Lambda dependencies layer
βββ layerator.py # Lambda layer builder script
- Python 3.12+ with Pipenv
- Node.js and AWS CDK CLI (for infrastructure)
- AWS CLI configured (for deployment)
# Clone and install dependencies
git clone <repository-url>
cd igg
pipenv install
# Run MCP server locally
pipenv run python src/mcp_server.py
After deploying the CDK stack, configure your MCP client using the deployed API Gateway endpoint:
{
"mcpServers": {
"igg-markov": {
"url": "https://mcp.yourdomain.com/",
"headers": {
"Authorization": "Basic <base64-encoded-credentials>"
}
}
}
}
Getting the MCP endpoint URL and credentials:
# Deploy and get outputs
cd cdk && pipenv run cdk deploy IggMcpStack
# The deployment will output:
# - McpApiGatewayUrl: Direct API Gateway URL (works immediately)
# - McpCustomDomainUrl: Custom domain URL (requires DNS setup)
# - McpAuthSecretArn: Secret ARN for credentials
# Get credentials from AWS Secrets Manager
aws secretsmanager get-secret-value \
--secret-id <McpAuthSecretArn-from-output> \
--query SecretString --output text
URL Options:
- Quick setup: Use
McpApiGatewayUrl
directly (no DNS required) - Custom domain: Use
McpCustomDomainUrl
after setting up DNS CNAME record
# Build Lambda layer with heavy dependencies (pandas, nltk)
pipenv run python layerator.py
# Configure domains in config.json
cd cdk
cp config.json.example config.json
# Edit config.json with your domains and certificates
# Deploy infrastructure
pipenv run cdk deploy --all
# Set up DNS records as shown in deployment outputs
{
"mcp": {
"domain": "mcp.yourdomain.com",
"certificateDomain": "mcp.yourdomain.com"
},
"static_site": {
"domain": "static.yourdomain.com",
"certificate_arn": "arn:aws:acm:...",
"bucket_name": "your-bucket-name"
}
}
IGG_BASE_URL
: Override default model endpoint for MCP serverBUCKET_NAME
: S3 bucket name (set by CDK)INDEX_FILE
: Index file name (default:index.json
)
{
"tool": "list_models"
}
{
"tool": "generate_ideas",
"arguments": {
"model_name": "samples/sample.json",
"count": 5
}
}
{
"tool": "generate_with_template",
"arguments": {
"model_name": "samples/sample.json",
"template": "A $1 solution for $2 professionals",
"count": 3
}
}
- Upload CSV: Place CSV file in S3 bucket (any path structure)
- Auto-Processing: Lambda automatically converts CSV β Markov JSON
- Index Update:
index.json
updated with model metadata - Access Models: Available via API Gateway and MCP server
Run the complete test suite:
pipenv run pytest test/ -v
Test specific modules:
pipenv run pytest test/test_model_processor.py -v
pipenv run pytest test/test_generate_markov_models.py -v
- Upload CSV data to S3 bucket
- Models automatically generated and indexed
- Available immediately via MCP and web interface
The model processor uses a Lambda layer for heavy dependencies (pandas, nltk, numpy). The layer is built for Python 3.12:
# Rebuild layer when dependencies change
pipenv run python layerator.py
# Deploy updated layer
pipenv run cdk deploy IggStaticSiteStack
- Add new methods to
mcp_markov_models.py
- Register tools in
mcp_server.py
- Add corresponding tests
- Modify constructs in
cdk/custom_constructs/
- Update stack definitions in
cdk/stacks/
- Test with
pipenv run cdk diff
- Deploy with
pipenv run cdk deploy
- Lambda function logs:
/aws/lambda/ModelProcessor
- API Gateway logs: Available in CloudWatch
# Test model processor locally
pipenv run python -c "
import model_processor
result = model_processor.process_csv('col1,col2\nval1,val2', 'test.csv')
print(result)
"
- All AWS resources use minimal IAM permissions
- API Gateway secured with custom authorizers (MCP stack)
- HTTPS/TLS 1.2+ enforced on all endpoints
- S3 bucket access restricted to API Gateway
- Authentication secrets managed via AWS Secrets Manager
# Development
pipenv run cdk deploy --context environment=dev
# Production
pipenv run cdk deploy --context environment=prod
# Validate infrastructure
pipenv run cdk synth
pipenv run cdk diff
# Deploy specific stacks
pipenv run cdk deploy IggMcpStack
pipenv run cdk deploy IggStaticSiteStack
Remove all AWS resources:
pipenv run cdk destroy --all
This project is licensed under the Apache License 2.0. See the LICENSE
file for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Run tests:
pipenv run pytest
- Commit changes:
git commit -m 'Add amazing feature'
- Push to branch:
git push origin feature/amazing-feature
- Open a Pull Request
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: See individual component READMEs in subdirectories