osm-edit-mcp / rules
Cursor rule4 starsChanged 3 months agoMITView on GitHub
- Reads credentials
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository7 other files it gives its agents.
- .cursor/rules/mcp-development.mdcCursor rule
- .cursor/rules/mcp-implementation-patterns.mdcCursor rule
- .cursor/rules/osm-development-safety.mdcCursor rule
- .cursor/rules/osm-edit-safety.mdcCursor rule
- .cursor/rules/osm-mcp-project-structure.mdcCursor rule
- .cursor/rules/testing-and-quality.mdcCursor rule
- osm-edit-mcp-setupSkill
The file
Show its rules and text
We split this configuration-management.mdc into the rules it gives an agent
16 rules. About 0 are common, 15 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 121
Never log OAuth tokens or secrets
- Distinctive: line 123
Use field aliases for backward compatibility
- Distinctive: line 180
Never log OAuth tokens or credentials
- Distinctive: line 183
Use appropriate log levels for different types of information
- Distinctive: line 198
When adding new configuration options:
- Very specific: line 199
Add to OSMConfig class in config.py
- Distinctive: line 200
Update .env.example with documentation
- Distinctive: line 201
Update README.md configuration section
- Distinctive: line 202
Add focused tests under tests
- Distinctive: line 208
Never commit .env with real credentials
- Distinctive: line 209
Use strong, unique OAuth credentials
- Distinctive: line 214
Always use development API for testing
- Distinctive: line 215
Use DEBUG log level for troubleshooting
- Distinctive: line 217
Test configuration changes thoroughly
- Distinctive: line 220
Use production API only after thorough testing
- Distinctive: line 226
Document all new configuration options
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
---
alwaysApply: true
---
# Configuration Management System
## Environment Configuration Files
### Primary Configuration Files
- **[.env](mdc:mcp:.env)** - Active environment configuration (never commit with real credentials)
- **[.env.example](mdc:mcp:.env.example)** - Configuration template with all options documented
### Configuration Class
The `OSMConfig` class in [config.py](mdc:mcp:src/osm_edit_mcp/config.py) uses Pydantic BaseSettings for type-safe configuration management.
## Core Configuration Sections
### API Configuration (Dev/Prod Switching)
```bash
# Safe development testing (default)
OSM_USE_DEV_API=true
OSM_DEV_API_BASE=https://api06.dev.openstreetmap.org/api/0.6
# Production use (requires extreme caution)
OSM_USE_DEV_API=false
OSM_API_BASE=https://api.openstreetmap.org/api/0.6
# Legacy support (will be deprecated)
OSM_API_BASE_URL=https://api06.dev.openstreetmap.org/api/0.6
```
### OAuth 2.0 Credentials
```bash
OSM_DEV_CLIENT_ID=your_development_oauth_client_id
OSM_DEV_CLIENT_SECRET=your_development_oauth_client_secret
OSM_DEV_REDIRECT_URI=https://localhost:8080/callback
OSM_PROD_CLIENT_ID=your_production_oauth_client_id
OSM_PROD_CLIENT_SECRET=your_production_oauth_client_secret
OSM_PROD_REDIRECT_URI=https://localhost:8080/callback
```
### Logging Configuration
```bash
LOG_LEVEL=INFO # DEBUG, INFO, WARNING, ERROR
DEBUG=false # Enable debug mode
DEVELOPMENT_MODE=false # Enable development features
```
### Safety and Rate Limiting
```bash
REQUIRE_USER_CONFIRMATION=true # Require confirmation for destructive ops
RATE_LIMIT_PER_MINUTE=60 # API calls per minute
MAX_CHANGESET_SIZE=50 # Maximum operations per changeset
```
### Cache Configuration
```bash
ENABLE_CACHE=true # Enable response caching
CACHE_TTL_SECONDS=300 # Cache expiration time
```
### Security Settings
```bash
USE_KEYRING=true # Use system keyring for credentials
```
## Configuration Usage Patterns
### Accessing Configuration in Code
```python
from osm_edit_mcp.server import config
# Use current API base URL (automatically selects dev/prod)
url = f"{config.current_api_base_url}/endpoint"
# Check if running in development mode
if config.is_development:
logger.info("Running in development mode")
# Access safety settings
if config.require_user_confirmation:
# Ask for user confirmation
pass
# Access rate limiting
rate_limit = config.rate_limit_per_minute
max_size = config.max_changeset_size
```
### Configuration Properties
The `OSMConfig` class provides computed properties:
#### `current_api_base_url`
Automatically selects the appropriate API URL:
- Returns `osm_dev_api_base` when `osm_use_dev_api=true`
- Returns `osm_api_base` when `osm_use_dev_api=false`
- Falls back to legacy `osm_api_base_url` for backward compatibility
#### `is_development`
Returns `True` if any development mode is enabled:
- `osm_use_dev_api=true`
- `development_mode=true`
- `debug=true`
## Configuration Validation
### Startup Validation
The server automatically validates configuration on startup and logs:
- Server version and name
- API mode (Development/Production)
- Current API base URL
- Log level
### Environment Variable Handling
Uses Pydantic BaseSettings features:
- **Type validation**: Ensures correct types for all settings
- **Field aliases**: Support for legacy variable names
- **Default values**: Sensible defaults for all options
- **Case insensitive**: Handles various case formats
### Configuration Security
- Never log OAuth tokens or secrets
- Load dotenv only through `OSM_EDIT_MCP_ENV_FILE`; require a regular non-symlink file with mode `0600`
- Use field aliases for backward compatibility
- Support system keyring for credential storage
## Development vs Production Configuration
### Development Setup (Safe)
```bash
# Copy template and customize
install -m 600 .env.example .env
# Edit .env for development
OSM_USE_DEV_API=true
LOG_LEVEL=DEBUG
DEVELOPMENT_MODE=true
REQUIRE_USER_CONFIRMATION=true
```
### Production Setup (Careful)
```bash
# Production configuration
OSM_USE_DEV_API=false
LOG_LEVEL=INFO
DEVELOPMENT_MODE=false
REQUIRE_USER_CONFIRMATION=true
RATE_LIMIT_PER_MINUTE=60
MAX_CHANGESET_SIZE=50
```
### Configuration Testing
Test configuration changes:
```bash
# Verify current configuration
uv run --locked python -c "from osm_edit_mcp.server import config; print(config.current_api_base_url)"
# Test dev mode
OSM_USE_DEV_API=true uv run --locked python -c "from osm_edit_mcp.server import config; print(config.current_api_base_url)"
# Test prod mode (careful!)
OSM_USE_DEV_API=false uv run --locked python -c "from osm_edit_mcp.server import config; print(config.current_api_base_url)"
```
## Logging Configuration
### Log Level Hierarchy
1. **DEBUG**: Detailed debugging information, API calls, parameter values
2. **INFO**: General operational information, important events
3. **WARNING**: Important events that need attention
4. **ERROR**: Error conditions that need immediate attention
### Logging Setup
The `setup_logging()` function in [server.py](mdc:mcp:src/osm_edit_mcp/server.py):
- Configures root logger with specified level
- Sets up console output with timestamps
- Logs startup configuration information
- Returns configured logger instance
### Log Security
- Never log OAuth tokens or credentials
- Sanitize sensitive data before logging
- Log API endpoints but not full URLs with credentials
- Use appropriate log levels for different types of information
## Configuration Migration and Compatibility
### Backward Compatibility
The configuration system maintains backward compatibility:
- Legacy `OSM_API_BASE_URL` still works
- Old variable names supported via aliases
- Gradual migration path for existing setups
### Deprecated Settings
- `OSM_API_BASE_URL`: Use `OSM_DEV_API_BASE` or `OSM_API_BASE` instead
- Direct API URL configuration: Use `OSM_USE_DEV_API` switching
### Future Configuration Additions
When adding new configuration options:
1. Add to `OSMConfig` class in [config.py](mdc:mcp:src/osm_edit_mcp/config.py)
2. Update [.env.example](mdc:mcp:.env.example) with documentation
3. Update [README.md](mdc:mcp:README.md) configuration section
4. Add focused tests under [tests](mdc:mcp:tests)
5. Maintain backward compatibility where possible
## Configuration Best Practices
### Security
- Never commit [.env](mdc:mcp:.env) with real credentials
- Use strong, unique OAuth credentials
- Enable keyring storage when available
- Regularly rotate credentials
### Development
- Always use development API for testing
- Use DEBUG log level for troubleshooting
- Enable all safety features during development
- Test configuration changes thoroughly
### Production
- Use production API only after thorough testing
- Set appropriate log levels (INFO or WARNING)
- Enable all safety and rate limiting features
- Monitor configuration for security issues
### Documentation
- Document all new configuration options
- Provide clear examples in [.env.example](mdc:mcp:.env.example)
- Update [README.md](mdc:mcp:README.md) configuration section
- Include configuration in test documentation
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

