Authenticating Agent Skills
mittwald agent skills need to communicate with your mStudio account to provision resources and manage infrastructure. You can choose one or more authentication methods based on your workflow.
Authentication Options
Option 1: MCP Server (Recommended)
Configure the mittwald MCP server in your AI assistant. The skills will call mcp__mittwald__mittwald_* tools directly.
Advantages:
- Native integration with AI assistants
- OAuth 2.1 with PKCE security
- Scoped permissions
- Token refresh handled automatically
- Works in desktop and CLI environments
Setup: Follow the MCP getting connected guide for your specific AI assistant.
Configuration example (Continue):
mcpServers:
mittwald:
name: mittwald
transport:
type: sse
url: https://mcp.mittwald.de/mcp
Option 2: mittwald CLI
Authenticate the CLI on your local machine. Skills will execute mw commands directly.
Advantages:
- Simple setup
- Works in terminal-based workflows
- Familiar to CLI users
- Good for local development
Setup:
# Install CLI if not already installed
brew install mittwald/cli/mw # macOS
# or follow https://docs.mittwald.de/v2/cli/
# Authenticate
mw login token # paste your api_write token from mStudio
# Verify authentication
mw user get
Get your API token from mStudio profile settings (requires api_write role).
Which Option Should You Choose?
Choose based on your primary use case:
| Use Case | Recommended Option | Why |
|---|---|---|
| Desktop AI assistants (Claude Desktop, VS Code Copilot) | MCP Server | Native integration, best UX |
| Terminal workflows | mittwald CLI | Familiar tool, good for local dev |
Multiple Authentication Methods
You can set up both authentication methods. Skills will try them in this order:
- MCP Server (if AI assistant has MCP tools)
- mittwald CLI (if
mwcommand is available)
This allows flexible usage across different environments.
Token Permissions
Ensure your API token has the correct permissions:
Required role: api_write
This grants:
- Create and manage projects
- Deploy applications and containers
- Configure databases and services
- Manage domains and SSL certificates
- Create and manage backups
Creating a token:
- Go to mStudio profile settings
- Click "Create API Token"
- Select role:
api_write - Add description (e.g., "Agent Skills Authentication")
- Copy the token (it's only shown once!)
Security Best Practices
Protect Your Tokens
- Never commit tokens to version control
- Use environment variables or secure vaults
- Rotate tokens periodically
- Revoke unused tokens immediately
Scope Access Appropriately
- Use MCP with OAuth for desktop work (automatic token refresh)
- Use CLI authentication for local development
- Use environment variables only when necessary
- Consider creating separate tokens for different purposes
Monitor Token Usage
- Review token usage in mStudio
- Revoke suspicious or unused tokens
- Set up alerts for unusual activity
Troubleshooting
"Authentication failed" Error
Check:
- Token is valid and not expired
- Token has
api_writerole - Environment variable is set correctly (if using HTTP API)
- CLI is authenticated (run
mw user getto test) - MCP server is connected (check AI assistant settings)
Skills Don't Find Authentication
Verify:
- At least one authentication method is configured
- For CLI:
which mwreturns a path - For MCP: Check AI assistant's MCP server connection status
Token Permission Errors
Solution:
Your token likely lacks api_write role. Create a new token with the correct permissions from mStudio profile settings.
Next Steps
- Install agent skills - Set up the skills
- Use mittwald-migrate - Migrate workloads
- Use mittwald-zerodeploy - Deploy applications
- Learn about MCP - Explore infrastructure management