agentleFS
enunoenuno/unifi-mcp-server/.cursor/rules/environment-setup.mdc

unifi-mcp-server / rules

Cursor rule294 starsChanged 18 days agoApache-2.0View on GitHub

Environment variables and configuration setup

  • Reads credentials

We split this environment-setup.mdc into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    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
  1. Very specific:

    Always use .env.example as a template:

    line 48
  2. Very specific:

    NEVER: commit .env files to version control

    line 71
  3. Distinctive:

    ALWAYS: use environment variables for sensitive data

    line 72

≈ “Common” is an estimate: at least 1 in 5 of the 6,350 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
environment-setup.mdc
---
description: Environment variables and configuration setup
globs: [".env*", "src/config/**/*.py"]
alwaysApply: false
---

# Environment Setup

## Required Environment Variables

```bash
# Required
UNIFI_API_KEY=your-api-key-here
UNIFI_API_TYPE=cloud  # or "local"
UNIFI_HOST=api.ui.com  # or local gateway IP
UNIFI_SITE=default

# Optional
REDIS_HOST=localhost  # Enable caching
REDIS_PORT=6379
WEBHOOK_SECRET=your-secret  # Enable webhook HMAC verification
```

## Configuration Loading Order

The server merges settings from **environment variables**, an optional `.env` file, and `src/config/config.py` (listed in order of precedence).

## API Configuration

### Cloud API (Default)

```bash
UNIFI_API_TYPE=cloud
UNIFI_CLOUD_API_URL=https://api.ui.com
```

### Local Gateway Proxy

```bash
UNIFI_API_TYPE=local
UNIFI_LOCAL_HOST=192.168.2.1
UNIFI_LOCAL_PORT=443
UNIFI_LOCAL_VERIFY_SSL=true
```

## Development Environment

Always use `.env.example` as a template:

```bash
# Copy example file
cp .env.example .env

# Never commit .env to version control
# It's in .gitignore by default
```

## Configuration in Code

Load settings in Python using Pydantic:

```python
from src.config.config import Settings

settings = Settings()  # Automatically loads from environment
```

## Security Reminders

- **NEVER** hardcode API keys in source code
- **NEVER** commit `.env` files to version control
- **ALWAYS** use environment variables for sensitive data
- **ALWAYS** mask sensitive data in logs
- **ALWAYS** validate configuration on startup

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.