osm-edit-mcp / rules
Cursor rule4 starsChanged 3 months agoMITView on GitHub
NEVER perform these operations without explicit user confirmation: The server.py OSMConfig class automatically selects the correct API based on OSM_USE_DEV_API setting.
- 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/configuration-management.mdcCursor rule
- .cursor/rules/mcp-development.mdcCursor rule
- .cursor/rules/mcp-implementation-patterns.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 osm-development-safety.mdc into the rules it gives an agent
22 rules. About 0 are common, 16 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈16
Distinctive · estimate
This author's own choices. Worth a look.
6
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
- Very specific: line 20
Always use development API for testing: OSM_USE_DEV_API=true in .env
- Distinctive: line 22
Never commit real OAuth credentials to version control
- Very specific: line 45
Run test_comprehensive.py before any changes
- Distinctive: line 47
Write operations will fail without OAuth (this is expected and safe)
- Very specific: line 50
Follow TESTING_CHECKLIST.md systematically
- Distinctive: line 51
Start with read operations (safe)
- Distinctive: line 52
Test configuration switching (dev/prod)
- Distinctive: line 54
Never test write operations on production without user consent
- Very specific: line 59
All tools in server.py that only retrieve data:
- Distinctive: line 71
All tools should return structured responses:
- Distinctive: line 89
Always validate coordinates before API calls
- Distinctive: line 103
Never log OAuth tokens or credentials
- Very specific: line 105
Use system keyring when USE_KEYRING=true
- Distinctive: line 114
Never commit credentials to version control
- Distinctive: line 117
Read operations work without authentication
- Distinctive: line 118
Write operations will return 401 Unauthorized (expected)
- Very specific: line 119
Use test_comprehensive.py to validate this behavior
- Distinctive: line 126
Always validate before API calls
- Distinctive: line 129
Check required tags for element types
- Distinctive: line 131
Follow OSM tagging conventions
- Distinctive: line 134
Always include meaningful changeset comments
- Distinctive: line 135
Add source and created_by tags
≈ “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
---
description:
globs:
alwaysApply: true
---
# OSM Development Safety and Best Practices
## ⚠️ CRITICAL: Always Ask Before Irreversible Operations
**NEVER perform these operations without explicit user confirmation:**
### OpenStreetMap Write Operations
- Creating or closing changesets via OSM API
- Uploading nodes, ways, or relations to OSM
- Modifying existing OSM map data
- Deleting OSM elements
- Any calls to production `api.openstreetmap.org` endpoints
### Configuration Safety
- Always use development API for testing: `OSM_USE_DEV_API=true` in [.env](mdc:.env)
- Production API requires extreme caution: `OSM_USE_DEV_API=false`
- Never commit real OAuth credentials to version control
## Development API Configuration
### Safe Development Setup
```bash
# In .env file - ALWAYS use for development
OSM_USE_DEV_API=true
OSM_DEV_API_BASE=https://api06.dev.openstreetmap.org/api/0.6
```
### Production API (Use with Extreme Caution)
```bash
# Only for production deployments
OSM_USE_DEV_API=false
OSM_API_BASE=https://api.openstreetmap.org/api/0.6
```
The [server.py](mdc:src/osm_edit_mcp/server.py) `OSMConfig` class automatically selects the correct API based on `OSM_USE_DEV_API` setting.
## Testing Guidelines
### Automated Testing
- Run [test_comprehensive.py](mdc:test_comprehensive.py) before any changes
- Expected results documented in [TEST_RESULTS_SUMMARY.md](mdc:TEST_RESULTS_SUMMARY.md)
- Write operations will fail without OAuth (this is expected and safe)
### Manual Testing Process
1. Follow [TESTING_CHECKLIST.md](mdc:TESTING_CHECKLIST.md) systematically
2. Start with read operations (safe)
3. Test configuration switching (dev/prod)
4. Validate error handling
5. Never test write operations on production without user consent
## MCP Tool Implementation Patterns
### Read Operations (Safe)
All tools in [server.py](mdc:src/osm_edit_mcp/server.py) that only retrieve data:
- `get_osm_node`, `get_osm_way`, `get_osm_relation`
- `find_nearby_amenities`, `validate_coordinates`
- `get_place_info`, `search_osm_elements`
### Write Operations (Require OAuth + Confirmation)
Tools that modify OSM data:
- `create_osm_node`, `update_osm_node`, `delete_osm_node`
- `create_osm_way`, `update_osm_way`, `delete_osm_way`
- `create_changeset`, `close_changeset`
### Error Handling Pattern
All tools should return structured responses:
```python
{
"success": True/False,
"data": {...}, # On success
"error": "...", # On failure
"message": "..." # Human-readable message
}
```
## Rate Limiting and API Etiquette
### OSM API Limits
- Maximum 10,000 API calls per hour per IP
- Configured in [.env](mdc:.env): `RATE_LIMIT_PER_MINUTE=60`
- Respect changeset size limits: `MAX_CHANGESET_SIZE=50`
### Best Practices
- Always validate coordinates before API calls
- Cache read responses when appropriate
- Handle 429 rate limit responses gracefully
- Log all API operations (excluding auth tokens)
## Logging and Debugging
### Log Levels (configured in [.env](mdc:.env))
- `LOG_LEVEL=DEBUG` - Full debugging for development
- `LOG_LEVEL=INFO` - Standard operation
- `LOG_LEVEL=WARNING` - Important events only
- `LOG_LEVEL=ERROR` - Errors only
### Security Considerations
- Never log OAuth tokens or credentials
- Store credentials in [.env](mdc:.env) only (not committed)
- Use system keyring when `USE_KEYRING=true`
- Validate all input data before processing
## Authentication Flow
### OAuth 2.0 Setup
1. Register application at https://www.openstreetmap.org/oauth2/applications
2. Configure scopes: `read_prefs`, `write_prefs`, `write_api`, `write_changeset_comments`
3. Store credentials in [.env](mdc:.env)
4. Never commit credentials to version control
### Development Without OAuth
- Read operations work without authentication
- Write operations will return 401 Unauthorized (expected)
- Use [test_comprehensive.py](mdc:test_comprehensive.py) to validate this behavior
## Data Validation Requirements
### Coordinate Validation
- Latitude: -90 to 90 degrees
- Longitude: -180 to 180 degrees
- Always validate before API calls
### Tag Validation
- Check required tags for element types
- Validate tag key/value formats
- Follow OSM tagging conventions
### Changeset Management
- Always include meaningful changeset comments
- Add source and created_by tags
- Close changesets when editing is complete
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.

