A lightweight, AI-native content management system for building and managing websites. Built with Go and MongoDB Atlas.
Lightweight: A clean, focused codebase (~5K lines of Go) that's easy to understand, modify, and extend. No bloated frameworks or complex abstractions.
AI-Native: Built from the ground up for the AI era:
- MCP Integration: Full Model Context Protocol server with 38 tools for website management. Control your entire site through Claude Code or other agentic workflows.
- Fork-Friendly: Designed to be forked and customized by Claude Code. Ask Claude to add new content types, modify templates, or build custom features—the codebase is structured for AI-assisted development.
- Natural Language Website Management: Skip the admin UI entirely. Create pages, manage assets, customize themes, and publish content through conversation.
- AI-Powered Website Management: MCP server for agentic control of your site
- Template System: Define reusable content structures with custom fields
- Static Page Generation: Fast page loads from pre-rendered HTML
- Content Collections: Group and display content by category
- Custom Pages: Full HTML control for special pages
- Theme Customization: Modern, sleek design with customizable colors, fonts, and styles
- Rich Text Editor: TinyMCE integration for visual content editing
- Admin Panel: Secure content management at
/cm - Content Versioning: Full version history with diff comparison and revert capability
- Soft Delete: Recover deleted content with undelete functionality
- Go 1.21 or later
- MongoDB Atlas account (free tier works great)
- Clone the repository
- Copy
config.dev.json.exampletoconfig.dev.json - Edit
config.dev.jsonwith your MongoDB connection string - Run
go run cmd/server/main.go - Visit http://localhost:8082/cm and login with
admin123 - Change your password immediately via Security settings
- Go to MongoDB Atlas
- Sign up for a free account (no credit card required)
- Click "Build a Database"
- Select "M0 FREE" (Shared) tier
- Choose your preferred cloud provider and region (closest to you)
- Click "Create Deployment"
-
Create a database user:
- Username:
lightcms(or your choice) - Password: Generate a secure password (save this!)
- Click "Create User"
- Username:
-
Add your IP address:
- Click "Add My Current IP Address"
- Or add
0.0.0.0/0to allow access from anywhere (less secure, but convenient for development) - Click "Finish and Close"
- Click "Connect" on your cluster
- Select "Drivers"
- Copy the connection string, it looks like:
mongodb+srv://lightcms:<password>@cluster0.xxxxx.mongodb.net/?retryWrites=true&w=majority - Replace
<password>with your actual password
For development, copy the example and fill in your values:
cp config.dev.json.example config.dev.jsonEdit config.dev.json:
{
"port": "8082",
"mongo_uri": "mongodb+srv://lightcms:YOUR_PASSWORD@cluster0.xxxxx.mongodb.net/lightcms",
"env": "development",
"session_secret": "any-random-string-for-dev"
}For production, use config.prod.json:
cp config.prod.json.example config.prod.jsonEdit with production values (use openssl rand -hex 32 for session_secret).
# Clone or navigate to the project
cd lightcms
# Install dependencies
go mod tidy
# Run the server
go run cmd/server/main.goOr use the run script:
./run.shLightCMS uses JSON config files. Create either:
config.dev.json- for developmentconfig.prod.json- for production (takes precedence if both exist)
| Field | Description |
|---|---|
port |
Server port (e.g., "8082" for dev, "80" for prod) |
mongo_uri |
MongoDB Atlas connection string |
env |
Environment: "development" or "production" |
session_secret |
Random string for session encryption |
Note: Config files contain secrets and are excluded from git via .gitignore.
- Public site: http://localhost:8082
- Admin panel: http://localhost:8082/cm
The default password is admin123. On first login, you'll be prompted to change it.
The admin password is stored securely in MongoDB using bcrypt hashing.
- Log in to the admin panel at
/cm - Go to Content → New Content
- Select a template (Blog Post, Press Release, or Explanatory Page)
- Fill in the fields
- Check "Published" and save
- Go to Templates → New Template
- Define your fields (text, textarea, richtext, date, image, select)
- Create an HTML layout using
{{.field_name}}placeholders - Save the template
Available placeholders:
{{.title}}- Content title{{.slug}}- URL slug{{.published_at}}- Publication date{{.your_field_name}}- Any custom field you define
Collections display grouped content (like a blog listing page).
- Go to Collections → New Collection
- Set the category filter to match your content's category
- Define item and page templates
- The collection will be available at
/collection-slug
- Go to Theme in the admin panel
- Adjust colors, fonts, and border radius
- Add custom CSS if needed
- Save to apply changes site-wide
lightcms/
├── cmd/
│ └── server/
│ └── main.go # Application entry point
├── config/
│ └── config.go # Configuration loading
├── internal/
│ ├── auth/
│ │ └── auth.go # Authentication logic
│ ├── database/
│ │ └── mongo.go # MongoDB connection & operations
│ ├── handlers/
│ │ ├── handlers.go # HTTP handlers
│ │ └── admin_templates.go # Admin UI templates
│ └── models/
│ └── models.go # Data models & default templates
├── static/
│ ├── css/
│ │ ├── main.css # Public site styles
│ │ └── theme-vars.css # Theme CSS variables
│ └── uploads/ # Uploaded files
├── content/
│ ├── pages/ # Custom page files
│ └── generated/ # Generated static HTML
├── config.dev.json.example # Development config template
├── config.prod.json.example # Production config template
└── README.md
Fields: title, excerpt, featured_image, content, author, tags
Fields: headline, subheadline, dateline, release_date, body, boilerplate, contact_info
Fields: title, subtitle, hero_image, intro, main_content, sidebar, cta_text, cta_link
LightCMS includes an MCP (Model Context Protocol) server that allows you to manage your website content using Claude Code. Instead of navigating the admin UI, you can simply ask Claude to create pages, update content, manage assets, and more.
Run the setup script from the lightcms directory:
./setup-mcp.shThis will:
- Build the MCP server binary
- Create the wrapper script
- Register the MCP server with Claude Code
Then restart Claude Code and run /mcp to verify the connection.
If you prefer to set things up manually:
-
Build the MCP server:
go build -o bin/lightcms-mcp ./cmd/mcp
-
Register the MCP server with Claude Code:
claude mcp add --transport stdio lightcms-mcp -- /path/to/lightcms/lightcms-mcp-wrapper.sh
-
Restart Claude Code (or start a new session)
-
Verify the connection by running
/mcpin Claude Code
Instead of using config files, you can configure via environment variables:
claude mcp add --transport stdio lightcms-mcp \
-e MONGO_URI="mongodb+srv://..." \
-e SESSION_SECRET="your-secret" \
-- /path/to/lightcms/bin/lightcms-mcpThe MCP server supports these environment variables:
LIGHTCMS_CONFIG_DIR- Directory containing config.dev.json or config.prod.jsonMONGO_URI- MongoDB connection string (bypasses config files)SESSION_SECRET- Session encryption key (required with MONGO_URI)BASE_URL- Public site URL (optional)
Once connected, you can manage your site with natural language:
- "Create a new blog post about machine learning"
- "List all my draft content"
- "Update the homepage title to 'Welcome to My Site'"
- "Delete the /old-page content"
- "Show me all templates"
- "Upload an image for my latest blog post"
- "Change the site's primary color to blue"
The MCP server provides 38 tools for complete content management:
- Content: Create, read, update, delete, publish, unpublish, versioning
- Templates: Manage content templates and their fields
- Assets: Upload and manage images, documents, and other files
- Settings: Theme customization, redirects, folders, collections
For detailed API documentation, see MCP.md.
# Run with hot reload (using air)
go install github.com/cosmtrek/air@latest
air
# Build for production
go build -o lightcms cmd/server/main.go
# Run production build
./lightcmsFor production:
- Use a strong
session_secret(generate withopenssl rand -hex 32) - Change the default admin password immediately after first login
- Use HTTPS (put behind a reverse proxy like nginx or caddy)
- Restrict MongoDB Atlas IP whitelist to your server IPs
- Regularly backup your MongoDB database
MIT