agility/agility-mcp-server
If you are the rightful owner of agility-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A Model Context Protocol (MCP) server for Agility CMS management API, built with Next.js and OAuth authentication.
Agility CMS MCP Server
A Model Context Protocol (MCP) server for Agility CMS management API, built with Next.js and OAuth authentication.
Features
- OAuth authentication with Agility CMS
- List content models and page modules
- Create new content models
- Get model details by reference name
- Both HTTP API and standalone MCP server
Setup
1. Install Dependencies
npm install
2. Configure Environment Variables
Create a .env.local file with:
BASE_URL=http://localhost:3000
3. Get Agility CMS OAuth Credentials
- Log into your Agility CMS organization
- Go to Settings > Integrations
- Create a new OAuth application
- Set redirect URL to:
http://localhost:3000/api/auth/callback/agility - Copy the Client ID and Client Secret to your
.env.local
Usage
Web Interface (with OAuth)
- Start the development server:
npm run dev
- Open http://localhost:3000
- Sign in with your Agility CMS account
- Use the web interface or make API calls to
/api/mcp
Standalone MCP Server
Run the MCP server directly:
npm run mcp
This starts a stdio-based MCP server that can be integrated with MCP clients.
Available Tools
list_models
List all content models in your Agility CMS instance.
Parameters:
includeDefaults(boolean, optional): Include default models (default: true)includeModules(boolean, optional): Include page modules (default: false)
list_components
List all page modules in your Agility CMS instance.
Parameters:
includeDefaults(boolean, optional): Include default modules (default: false)
create_model
Create a new content model.
Parameters:
displayName(string, required): Display name for the modelreferenceName(string, required): Reference name (unique identifier)description(string, optional): Description of the modelfields(array, required): Array of field definitions
Field Definition:
{
"name": "field_name",
"label": "Field Label",
"type": "Text",
"description": "Field description",
"settings": {}
}
get_model
Get details of a specific content model.
Parameters:
referenceName(string, required): Reference name of the model
API Endpoints
POST /api/mcp
HTTP endpoint for MCP tool calls. Requires authentication.
Request Body:
{
"method": "list_models",
"params": {
"includeDefaults": true
}
}
Response:
{
"success": true,
"data": [...]
}
Authentication Flow
- User visits the web interface
- Redirected to Agility CMS OAuth
- User authorizes the application
- OAuth callback receives authorization code
- Code exchanged for access token
- Token stored in session for API calls
Project Structure
├── app/
│ ├── api/
│ │ ├── auth/[...nextauth]/route.ts # NextAuth configuration
│ │ └── mcp/route.ts # HTTP MCP endpoints
│ ├── auth/
│ │ ├── signin/page.tsx # Sign-in page
│ │ └── error/page.tsx # Error page
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Home page
│ └── providers.tsx # Session provider
├── server/
│ └── mcp-server.ts # Standalone MCP server
└── .env.local # Environment variables
Development
Running Tests
npm test
Building for Production
npm run build
npm start
Debugging
Enable debug mode by setting:
DEBUG=mcp:*
Supported Field Types
- Text
- TextArea
- Number
- Boolean
- Date
- DateTime
- Image
- File
- URL
- HTML
- RichText
- Reference
- MultipleReferences
Error Handling
The MCP server includes comprehensive error handling:
- Authentication errors
- API request failures
- Invalid parameters
- Network timeouts
Security
- OAuth 2.0 flow for secure authentication
- Session-based token storage
- Environment variable protection
- Request validation
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
License
MIT License - see LICENSE file for details