# Cursor + AI Agent Marketplace: AI-First IDE Integration

**Difficulty**: Beginner-Intermediate | **Prerequisites**: Cursor IDE installed

**TL;DR**: Map marketplace rules to `.cursor/rules/*.mdc` files with glob patterns. Use Composer for multi-step agent workflows. Create Notepads as reusable skill templates. Auto-generate everything with `marketplace generate-cursor-rules`.

* * *

## What is Cursor?

Cursor is a fork of VS Code built specifically for AI-assisted development. It offers tighter AI integration than traditional IDEs, with features designed for conversational coding.

**Key differentiators for marketplace integration:**

*   **Rules**: project-level instructions in `.cursor/rules/` (replaces `.cursorrules`)
    
*   **Composer**: agent mode for multi-file, multi-step tasks
    
*   **Chat**: conversational AI with full codebase context
    
*   **MCP Servers**: Model Context Protocol support
    
*   **@-mentions**: reference files, docs, or web content in prompts
    
*   **Notepads**: reusable prompt templates
    

## Scenario 1: Marketplace Rules as Cursor Rules

**Situation**: You want all Cursor AI suggestions to follow your org's standards.

### Map marketplace rules to `.cursor/rules/`

Create individual rule files that reference marketplace content:

`.cursor/rules/security.mdc`**:**

```markdown
---
description: Organization security rules from AI Agent Marketplace
globs: ["**/*.ts", "**/*.py", "**/*.cs", "**/*.java"]
alwaysApply: true
---

# Security Rules

Follow these security rules for ALL code suggestions:

1. Never suggest hardcoded secrets, API keys, or credentials
2. Use parameterized queries for all database operations
3. Validate all external input at system boundaries
4. Use HTTPS for all external connections
5. Never log credentials, even in debug mode
6. Use secure defaults (encrypted connections, restrictive CORS)

When reviewing code, flag as CRITICAL:
- SQL injection vectors
- Command injection vectors
- XSS opportunities
- Hardcoded credentials
- Disabled security features
```

`.cursor/rules/coding-standards.mdc`**:**

```markdown
---
description: Organization coding standards from AI Agent Marketplace
globs: ["**/*"]
alwaysApply: true
---

# Coding Standards

- Python: snake_case, type hints required
- TypeScript: camelCase, strict mode, no `any` types
- Functions under 50 lines
- No commented-out code
- Error cases handled explicitly
- Tests for all new functionality
- Public APIs need doc comments
```

`.cursor/rules/project-context.mdc`**:**

```markdown
---
description: Project-specific context and patterns
globs: ["**/*"]
alwaysApply: true
---

# Project Context

- Python 3.11, FastAPI framework
- PostgreSQL with SQLAlchemy ORM
- Tests: pytest with fixtures in tests/conftest.py
- Deployment: GitHub Actions to Azure Container Apps
- Auth: Azure AD JWT tokens
```

### Auto-generate Cursor rules from marketplace

Add to your `marketplace.sh`:

```bash
cmd_generate_cursor_rules() {
  mkdir -p .cursor/rules

  for rule_file in .ai-marketplace/rules/*.md; do
    local name=$(basename "$rule_file" .md)
    local output=".cursor/rules/${name}.mdc"

    cat > "$output" <<EOF
---
description: Org rule: ${name} (from AI Agent Marketplace)
globs: ["**/*"]
alwaysApply: true
---

$(cat "$rule_file")
EOF
    echo "Generated $output"
  done
}
```

## Scenario 2: Composer for Multi-Step Agent Workflows

**Situation**: You want to use the marketplace's PR review agent in Cursor's Composer mode.

### Using Composer with marketplace skills

Open Composer (Cmd+I / Ctrl+I) and provide the agent workflow:

```plaintext
Review all files changed in my current branch. For each file:

1. Check for security issues:
   - Hardcoded secrets
   - SQL/command injection
   - XSS vulnerabilities
   - Insecure configurations

2. Check against coding standards:
   - Naming conventions
   - Function length
   - Error handling
   - Test coverage

3. Check for correctness:
   - Logic errors
   - Edge cases
   - Race conditions

Format findings as:
### [SEVERITY] file.ext:line
**Issue**: description
**Fix**: suggestion
```

Composer will autonomously navigate your codebase, read changed files, and produce a structured review.

## Scenario 3: Notepads as Reusable Marketplace Skills

**Situation**: You want marketplace skills available as reusable templates in Cursor.

### Create Notepads from skills

In Cursor, go to the Notepads panel and create entries that mirror marketplace skills:

**Notepad: "Code Review"**

```plaintext
Review the selected code for:
1. Security issues (OWASP top 10)
2. Coding standard violations
3. Performance concerns
4. Missing error handling
5. Missing tests

Format: [SEVERITY] file:line - issue - fix suggestion
```

**Notepad: "Write Tests"**

```plaintext
Generate tests for the selected code following these rules:
- Use pytest with fixtures
- One test function per behavior
- Name: test_<scenario>_<condition>_<expected_result>
- Include edge cases and error cases
- Mock external dependencies, not internal logic
```

Reference notepads in chat with `@notepad-name`.

## Scenario 4: MCP Servers for Organizational Context

**Situation**: You want Cursor to access Azure DevOps and internal documentation.

### Configure in Cursor settings

Go to Cursor Settings > MCP and add servers:

```json
{
  "mcp": {
    "servers": {
      "ado": {
        "command": "agency",
        "args": ["mcp", "ado"]
      },
      "internal-docs": {
        "command": "agency",
        "args": ["mcp", "docs"]
      },
      "kusto": {
        "command": "agency",
        "args": ["mcp", "kusto"]
      }
    }
  }
}
```

Now in Cursor Chat:

```plaintext
What work items are in the current sprint for my team?
Search our internal docs for the retry policy guidelines
Query auth service error rates for the last hour
```

## Scenario 5: Greenfield with Full Marketplace

```bash
mkdir new-service && cd new-service
git init

# Install marketplace
marketplace install starter-kit
marketplace install pr-review-agent

# Generate Cursor rules from marketplace
marketplace generate-cursor-rules

# Open in Cursor
cursor .
```

Cursor immediately picks up all the rules and your AI is org-standards-aware from the first keystroke.

## Key Cursor Concepts for the Marketplace

| Concept | Purpose | Where it lives |
| --- | --- | --- |
| Rules (.mdc files) | Project-level instructions | `.cursor/rules/` |
| Composer | Multi-step agent mode | Cmd+I / Ctrl+I |
| Chat | Conversational AI | Sidebar |
| Notepads | Reusable prompt templates | Notepads panel |
| MCP Servers | External tool integrations | Cursor Settings > MCP |
| @-mentions | Reference files/docs in prompts | Chat / Composer |

## Tips for Marketplace Authors Targeting Cursor

1.  **Use .mdc format** for rules. This is Cursor's native format with frontmatter for globs and conditions
    
2.  **Glob patterns matter**. Scope rules to relevant file types for efficiency
    
3.  **Design for Composer**. Write agent workflows as step-by-step instructions that Composer can follow
    
4.  **Create Notepad templates**. These are the skill equivalent in Cursor's UI
    
5.  **Keep rules concise**. Cursor has context limits; prioritize high-impact rules
    
6.  **Test with @codebase**. Verify rules are picked up when referencing the full codebase
    

## Quick Setup Checklist

```bash
# 1. Initialize marketplace
cd /path/to/your/project
marketplace init

# 2. Install plugins
marketplace install pr-review-agent
marketplace install test-writer

# 3. Generate Cursor-specific rules
marketplace generate-cursor-rules

# 4. (Optional) Add MCP servers via Cursor Settings > MCP

# 5. Open in Cursor
cursor .

# 6. Commit
git add .ai-marketplace/ .cursor/
git commit -m "Add AI Agent Marketplace for Cursor"
```

*   `.cursor/rules/*.mdc` files generated with org rules
    
*   `.ai-marketplace/rules/` present
    
*   MCP servers configured in Cursor Settings (optional)
    
*   Tested with a query in Cursor Chat
    
*   Created Notepads for frequently-used skills (optional)
