mcp-use adds Authorization: Bearer <token> to every request automatically.Quick Start
When to Use
API Keys
Services that issue static API keys for authentication
Service Tokens
Machine-to-machine authentication between services
Personal Access Tokens
GitHub PATs, GitLab tokens, and similar credentials
Internal Services
Pre-shared secrets for private infrastructure
Secure Configuration
- Environment Variables
- python-dotenv
- Multiple Servers
Bearer vs OAuth
| Bearer Token | OAuth 2.1 | |
|---|---|---|
| Setup | Simple | More complex |
| Token refresh | Manual | Automatic |
| User consent | Not required | Required |
| Token lifetime | Long-lived | Short-lived + refresh |
| Best for | API keys, services | User authentication |
Security Checklist
1
Use environment variables
Never commit tokens to version control. Use
.env files locally and secrets management in production.2
Rotate tokens regularly
Implement a rotation policy to limit exposure from compromised tokens.
3
Use minimal permissions
If the service supports scoped tokens, request only what you need.
4
Monitor usage
Enable logging to detect unauthorized access attempts.