agentleFS
DXHeroesDXHeroes/mcp-devtools/.cursor/rules/core-libraries-usage.mdc

mcp-devtools / rules

Cursor rule13 starsChanged 21 months agoMITArchived repositoryView on GitHub

Core Libraries Usage Guidelines

  • Reads credentials

The file

We split this core-libraries-usage.mdc into the rules it gives an agent

7 rules. About 0 are common, 7 are distinctive, and 0 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.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When developing MCP DevTools packages, prefer using shared core libraries over custom implementations to ensure consistency and …

    line 9
  2. Distinctive:

    Use the shared configuration management from core:

    line 38
  3. Distinctive:

    Use the shared HTTP client with standard error handling:

    line 55
  4. Distinctive:

    Use the standardized logging system:

    line 68
  5. Distinctive:

    Use shared authentication utilities:

    line 80
  6. Distinctive:

    Always check core libraries first: before implementing new functionality

    line 91
  7. Distinctive:

    Follow versioning guidelines: when updating core library dependencies

    line 95

≈ “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
core-libraries-usage.mdc
---
description: Core Libraries Usage Guidelines
globs: packages/*/src/**/*.ts
alwaysApply: true
---

# Core Libraries Usage Guidelines

When developing MCP DevTools packages, prefer using shared core libraries over custom implementations to ensure consistency and maintainability.

@file packages/jira/src/index.ts
@file .cursor/rules/mcp-server-implementation.mdc

## Required Core Libraries

| Library       | Package                           | Purpose                   | Import Statement                                                         |
| ------------- | --------------------------------- | ------------------------- | ------------------------------------------------------------------------ |
| MCP Server    | `@modelcontextprotocol/server`    | Core server functionality | `import { createMcpServer } from '@modelcontextprotocol/server';`        |
| MCP Inspector | `@modelcontextprotocol/inspector` | Debugging tools           | `import { inspector } from '@modelcontextprotocol/inspector';`           |
| MCP Types     | `@modelcontextprotocol/types`     | Shared type definitions   | `import { McpRequest, McpResponse } from '@modelcontextprotocol/types';` |

## Common Utilities

The MCP DevTools core utilities should be used instead of reimplementing common functionality:

```typescript
// PREFERRED: Import from core utilities
import { validateEnvVars, formatErrorResponse } from "@mcp-devtools/core/utils";

// AVOID: Custom implementation of utilities
const validateEnvVars = (required) => {
  /* ... */
}; // Don't do this
```

## Configuration Management

Use the shared configuration management from core:

```typescript
import { loadConfig } from "@mcp-devtools/core/config";

// Load configuration with standard validation
const config = loadConfig({
  requiredVars: ["API_KEY", "API_URL"],
  optionalVars: {
    TIMEOUT: "30000",
    DEBUG: "false",
  },
});
```

## HTTP Client

Use the shared HTTP client with standard error handling:

```typescript
import { httpClient } from "@mcp-devtools/core/http";

// Make HTTP requests with standard error handling
const response = await httpClient.get("https://api.example.com/data", {
  headers: { Authorization: `Bearer ${config.API_KEY}` },
});
```

## Logging

Use the standardized logging system:

```typescript
import { logger } from "@mcp-devtools/core/logger";

// Log with standard levels and formatting
logger.info("Operation successful", { operationId: "123" });
logger.error("API call failed", { error, statusCode: 500 });
```

## Authentication Helpers

Use shared authentication utilities:

```typescript
import { createAuthHeaders, validateToken } from "@mcp-devtools/core/auth";

// Create standard auth headers
const headers = createAuthHeaders(config.API_KEY, config.API_SECRET);
```

## Guidelines

1. **Always check core libraries first** before implementing new functionality
2. **Keep dependencies updated** to ensure security and compatibility
3. **Contribute improvements** back to core libraries instead of creating package-specific versions
4. **Document usage** of core libraries in your package's README
5. **Follow versioning guidelines** when updating core library dependencies

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.