Skip to main content
Glama
SatoshiInoue

AEM Assets MCP Server

by SatoshiInoue

AEM Assets MCP Server

A Model Context Protocol (MCP) server for Adobe Experience Manager (AEM) Assets Author API built with Python and FastAPI. Can be deployed to Vercel (Phase 1) or Google Cloud Run (Phase 2) and used with ChatGPT.

๐Ÿš€ Features

This MCP server provides tools to interact with AEM Assets:

  • List folders - Browse folders in your AEM Assets repository

  • List published assets - Find all assets that have been published

  • Search assets - Search for assets by keywords (e.g., "Electric Vehicle")

  • List assets by folder - Get all assets within a specific folder

  • Bulk update metadata - Update metadata for all assets in a folder

  • List assets by creator - Find assets uploaded by a specific user

  • Get asset details - Retrieve detailed information about a specific asset

๐Ÿ“‹ Prerequisites

General Requirements

  1. Adobe Experience Manager Assets Author API Access

    • AEM base URL

    • OAuth Server-to-Server credentials:

      • Client ID (API Key)

      • Client Secret

      • Scopes

    • See GET_CREDENTIALS.md for how to obtain these

  2. Python 3.11+

Phase 1 Requirements (Vercel)

  • Vercel account

  • ChatGPT Plus/Pro (to use MCP servers)

Phase 2 Requirements (Google Cloud Run)

  • Google Cloud Platform account

  • gcloud CLI installed

  • Terraform installed (for infrastructure as code)

  • Docker installed

  • GitHub account (for CI/CD)

๐Ÿ› ๏ธ Tech Stack

  • Python 3.11 - Core language

  • FastAPI - Modern async web framework

  • HTTPX - Async HTTP client

  • Pydantic - Data validation

  • OAuth Server-to-Server - Automatic token refresh

  • Docker - Containerization

  • Terraform - Infrastructure as Code

  • GitHub Actions - CI/CD

๐Ÿ“ Project Structure

. โ”œโ”€โ”€ app/ โ”‚ โ”œโ”€โ”€ __init__.py # Package initialization โ”‚ โ”œโ”€โ”€ main.py # FastAPI application โ”‚ โ”œโ”€โ”€ aem_client.py # AEM Assets API client โ”‚ โ””โ”€โ”€ models.py # Pydantic models โ”œโ”€โ”€ terraform/ โ”‚ โ”œโ”€โ”€ main.tf # Main Terraform configuration โ”‚ โ”œโ”€โ”€ variables.tf # Terraform variables โ”‚ โ””โ”€โ”€ terraform.tfvars.example โ”œโ”€โ”€ .github/workflows/ โ”‚ โ”œโ”€โ”€ deploy-cloud-run.yml # Cloud Run deployment โ”‚ โ”œโ”€โ”€ terraform-apply.yml # Terraform workflow โ”‚ โ””โ”€โ”€ test.yml # Testing workflow โ”œโ”€โ”€ Dockerfile # Docker configuration โ”œโ”€โ”€ requirements.txt # Python dependencies โ”œโ”€โ”€ vercel.json # Vercel configuration โ”œโ”€โ”€ env.example # Environment template โ””โ”€โ”€ README.md

๐Ÿš€ Quick Start

Local Development

  1. Clone the repository:

cd "SC Practice 20260130 - Assets MCP"
  1. Create virtual environment:

python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
  1. Install dependencies:

pip install -r requirements.txt
  1. Configure environment:

# Option 1: Interactive setup (recommended) ./create-env.sh # Option 2: Manual setup cp env.example .env nano .env # Edit with your AEM credentials

See GET_CREDENTIALS.md for how to get your OAuth credentials.

  1. Run locally:

uvicorn app.main:app --reload

Visit http://localhost:8000 to see the server info.

Docker Development

# Build image docker build -t aem-mcp-server . # Run container docker run -p 8080:8080 \ -e AEM_BASE_URL="your_url" \ -e AEM_ACCESS_TOKEN="your_token" \ -e AEM_ORG_ID="your_org_id" \ -e AEM_CLIENT_ID="your_client_id" \ aem-mcp-server

๐Ÿ“ฆ Phase 1: Deploy to Vercel

See DEPLOYMENT_VERCEL.md for detailed instructions.

Quick steps:

# Install Vercel CLI npm i -g vercel # Deploy vercel # Add environment variables in Vercel dashboard # Deploy to production vercel --prod

Your API will be available at: https://your-project.vercel.app/api/mcp

๐Ÿ—๏ธ Phase 2: Deploy to Google Cloud Run

See DEPLOYMENT_CLOUDRUN.md for detailed instructions.

  1. Set up GCP and GitHub Secrets

  2. Push to main branch - Automatically deploys

  3. Service URL will be shown in Actions log

Option 2: Using Terraform

cd terraform # Copy and edit variables cp terraform.tfvars.example terraform.tfvars nano terraform.tfvars # Initialize Terraform terraform init # Preview changes terraform plan # Deploy infrastructure terraform apply

Option 3: Manual Docker Deployment

# Build and tag docker build -t gcr.io/YOUR_PROJECT/aem-mcp-server . # Push to Container Registry docker push gcr.io/YOUR_PROJECT/aem-mcp-server # Deploy to Cloud Run gcloud run deploy aem-assets-mcp-server \ --image gcr.io/YOUR_PROJECT/aem-mcp-server \ --platform managed \ --region us-central1 \ --allow-unauthenticated

๐Ÿ”ง Configuration

Environment Variables

Create a .env file with:

# AEM Instance AEM_BASE_URL=https://author-p161901-e1740392.adobeaemcloud.com AEM_API_ENDPOINT=/adobe/assets # OAuth Server-to-Server Credentials AEM_CLIENT_ID=a41e805f8c3042d3bba66ff1c05f1e94 AEM_CLIENT_SECRET=your_client_secret_here AEM_SCOPES=openid,AdobeID,read_organizations,additional_info.projectedProductContext,additional_info.roles # Adobe IMS (usually no need to change) ADOBE_IMS_TOKEN_ENDPOINT=https://ims-na1.adobelogin.com/ims/token/v3

Get AEM Credentials

Quick Setup:

./create-env.sh # Interactive credential setup

Manual Setup:

See GET_CREDENTIALS.md for detailed instructions.

Summary:

  1. Go to Adobe Developer Console

  2. Create/select project

  3. Add "AEM Assets Author API"

  4. Configure "OAuth Server-to-Server" authentication

  5. Copy Client ID and Client Secret

  6. Copy Scopes from the credential page

Key Benefits:

  • โœ… Automatic token refresh (every ~1 hour)

  • โœ… No manual token management

  • โœ… Production-ready authentication

  • โœ… Based on Adobe's OAuth S2S guide

๐Ÿค– Connect to ChatGPT

See CHATGPT_SETUP.md for complete integration guide.

Quick summary:

  1. Create Custom GPT in ChatGPT

  2. Add Action with OpenAPI schema

  3. Point to your deployed URL

  4. Test with natural language prompts

๐Ÿ’ฌ Usage Examples

Once connected to ChatGPT:

โœ… "List all the folders in the root directory" โœ… "Show me all published assets" โœ… "Find assets related to Electric Vehicle" โœ… "Update all assets in /content/dam/products with jancode: ABCDEFG" โœ… "List all assets uploaded by user@example.com"

๐Ÿ”Œ API Reference

Endpoints

  • GET / - Server information

  • GET /api/mcp - Server information

  • POST /api/mcp - Execute MCP tool

  • GET /health - Health check

Available Tools

1. list_folders

{ "tool": "list_folders", "arguments": { "path": "/content/dam" } }

2. list_published_assets

{ "tool": "list_published_assets", "arguments": { "limit": 50 } }

3. search_assets

{ "tool": "search_assets", "arguments": { "query": "Electric Vehicle", "limit": 100 } }

4. list_assets_by_folder

{ "tool": "list_assets_by_folder", "arguments": { "folderPath": "/content/dam/products" } }

5. bulk_update_metadata

{ "tool": "bulk_update_metadata", "arguments": { "folderPath": "/content/dam/products", "metadata": { "jancode": "ABCDEFG", "category": "Electronics" } } }

6. list_assets_by_creator

{ "tool": "list_assets_by_creator", "arguments": { "createdBy": "user@example.com", "limit": 50 } }

7. list_all_assets

{ "tool": "list_all_assets", "arguments": { "path": "/content/dam", "limit": 200 } }

8. get_asset_details

{ "tool": "get_asset_details", "arguments": { "assetId": "urn:aaid:aem:12345" } }

๐Ÿงช Testing

Manual Testing

# Test health endpoint curl http://localhost:8000/health # Test tool call curl -X POST http://localhost:8000/api/mcp \ -H "Content-Type: application/json" \ -d '{ "tool": "list_folders", "arguments": {"path": "/"} }'

Run Tests (when available)

pytest tests/ -v

๐Ÿ” Security

  • โœ… Environment variables for credentials

  • โœ… CORS configured for API access

  • โœ… Secret Manager for Cloud Run

  • โœ… Service Account with minimal permissions

  • โœ… HTTPS enforced

Important:

  • Never commit .env or terraform.tfvars

  • Rotate AEM tokens regularly

  • Use Workload Identity Federation for GitHub Actions

  • Restrict Cloud Run access as needed

๐Ÿ› Troubleshooting

Common Issues

Import errors in FastAPI:

pip install --upgrade -r requirements.txt

Docker build fails:

# Check Docker is running docker ps # Build with no cache docker build --no-cache -t aem-mcp-server .

Terraform errors:

# Re-initialize cd terraform rm -rf .terraform terraform init

Cloud Run deployment fails:

  • Check Secret Manager has correct values

  • Verify service account permissions

  • Check Artifact Registry has image

  • Review Cloud Run logs

๐Ÿ“š Additional Documentation

๐Ÿค Contributing

  1. Fork the repository

  2. Create feature branch

  3. Make changes

  4. Test thoroughly

  5. Submit pull request

๐Ÿ“„ License

MIT License - See LICENSE file for details

๐Ÿ”— Resources

๐Ÿ’ก Tips

  1. Start with Phase 1 (Vercel) for quick testing

  2. Use Terraform for reproducible infrastructure

  3. Monitor logs in Cloud Run console

  4. Set up alerts for production deployments

  5. Use Secret Manager for all sensitive data


Need Help? Check the documentation files or open an issue on GitHub.

-
security - not tested
F
license - not found
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SatoshiInoue/aem-assets-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server