agentleFS
floriscornelfloriscornel/todo-mcp/.cursor/rules/mcp-development.mdc

todo-mcp / rules

Cursor rule2 starsChanged 18 months agoMITView on GitHub

@src/index.ts

The file

We split this mcp-development.mdc into the rules it gives an agent

9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    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
  1. Distinctive:

    When adding new MCP tools:

    line 9
  2. Distinctive:

    Use Zod schemas for all parameters

    line 22
  3. Distinctive:

    Always return structured responses

    line 28
  4. Distinctive:

    Use consistent error handling

    line 30
  5. Distinctive:

    Use camelCase for tool names

    line 40
  6. Very specific:

    Start with verb: getTasks, createList, completeTask

    line 41
  7. Very specific:

    Use formatRelativeTime() for timestamps

    line 46
  8. Distinctive:

    Test edge cases (empty results, missing data)

    line 56
  9. Distinctive:

    Use stdio transport for Claude integration

    line 61

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
mcp-development.mdc
---
description: 
globs: 
alwaysApply: true
---
# MCP Development Patterns

## Tool Definition Structure
When adding new MCP tools:

1. **Tool Registration**:
   ```typescript
   server.tool(
     "toolName",
     "Clear description of what this tool does",
     { /* Zod schema for parameters */ },
     async (params) => { /* implementation */ }
   );
   ```

2. **Parameter Validation**:
   - Use Zod schemas for all parameters
   - Provide clear descriptions for each parameter
   - Include validation constraints (min/max length, etc.)
   - Set sensible defaults where appropriate

3. **Response Format**:
   - Always return structured responses
   - Include metadata when helpful
   - Use consistent error handling
   - Format dates with relative timestamps

## Error Handling Patterns
- Throw descriptive errors for invalid inputs
- Include available options in error messages
- Handle database connection failures gracefully
- Validate foreign key relationships

## Tool Naming Conventions
- Use camelCase for tool names
- Start with verb: `getTasks`, `createList`, `completeTask`
- Be specific about what the tool does
- Match the function to the tool name

## Response Formatting
- Use `formatRelativeTime()` for timestamps
- Sort results consistently (priority first, then date)
- Include relevant metadata in responses
- Structure JSON responses with proper nesting

## Testing MCP Tools
- Test parameter validation
- Test error scenarios
- Test database interactions
- Verify response formats
- Test edge cases (empty results, missing data)

## MCP Server Configuration
- Set proper server name and version
- Initialize database before starting server
- Use stdio transport for Claude integration
- Include proper metadata in responses

@src/index.ts

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.