development

A set of development rules for the MCP Server Trending project. It describes branch preparation, naming, folder structure, data models, and how to add a new data fetcher.

In plain words
What is it for?
Starting feature or bug branches, adding platform fetchers, defining their data models, and following the repository's required preparation steps.
Why use it?
It keeps new work organized and consistent with the project's development conventions.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/talljack/mcp_server_trending/development
Clone the repo
git clone --depth 1 https://github.com/Talljack/mcp_server_trending

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,432 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02432
Opus 5 $0.00000 $0.01216
Sonnet 5 $0.00000 $0.00486
Haiku 4.5 $0.00000 $0.00243

Measured yesterday against content hash 1ebc8d23ae80, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

development scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/development.mdc · 377 lines

How it starts

The opening of the file, as written. The whole thing — 377 lines — stays where its author put it; the contents beside it link to each section on GitHub.

1. 开发前准备(必须执行)

在开始任何新功能开发之前,必须执行以下步骤:

1.1 切换到 main 分支并更新

# 切换到 main 分支
git checkout main

# 拉取最新的 main 分支代码
git pull origin main

1.2 基于用户意图创建新分支

根据用户的开发需求,创建语义化的分支名称:

# 分支命名规范
# - feat/xxx: 新功能
# - fix/xxx: Bug 修复
# - docs/xxx: 文档更新
# - refactor/xxx: 代码重构
# - test/xxx: 测试相关

git checkout -b feat/add-xxx-fetcher  # 示例:添加新的 fetcher
git checkout -b fix/xxx-serialization  # 示例:修复序列化问题
git checkout -b docs/update-readme     # 示例:更新文档

2. 新 Fetcher 开发规范

2.1 目录结构

新的 fetcher 必须遵循以下目录结构:

src/mcp_server_trending/
├── fetchers/
│   └── {platform_name}/        # 新平台目录
│       ├── __init__.py         # 导出 Fetcher 类
│       └── fetcher.py          # Fetcher 实现
└── models/
    └── {platform_name}.py      # 数据模型定义

2.2 Model 定义规范

所有数据模型必须继承自 BaseModel

from dataclasses import dataclass, field
from datetime import datetime
from typing import Any

from .base import BaseModel


@dataclass
class YourModel(BaseModel):
    """数据模型描述"""

    rank: int
    id: str
    name: str
    url: str
    # ... 其他字段

    # 可选字段使用默认值
    description: str | None = None
    created_at: datetime | None = None
    tags: list[str] = field(default_factory=list)

2.3 Fetcher 实现规范

from typing import Any

from ..base import BaseFetcher
from ...models.base import TrendingResponse
from ...models.{platform} import YourModel


class YourFetcher(BaseFetcher):
    """Fetcher 描述"""

    PLATFORM = "{platform_name}"
    BASE_URL = "https://api.example.com"

    async def fetch_xxx(
        self,
        limit: int = 20,
        use_cache: bool = True,
    ) -> TrendingResponse:
        """获取数据的方法描述"""

        cache_key = f"{self.PLATFORM}:xxx:limit={limit}"

        # 检查缓存
        if use_cache:
            cached = self._get_from_cache(cache_key)
            if cached:
                return cached

        try:
            # 实现数据获取逻辑
            items = []
            # ... 获取和解析数据

            response = TrendingResponse(
                success=True,
                platform=self.PLATFORM,
                data=items,
                metadata={"limit": limit},
            )

            # 保存到缓存
            self._save_to_cache(cache_key, response)
            return response

        except Exception as e:
            return TrendingResponse(
                success=False,
                platform=self.PLATFORM,
                error=str(e),
            )

Read the full file on GitHub · 377 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 377 lines · 0 tokens per session scan A 1ebc8d23ae80

Subscribe to this mod's changes

development is a cursor rule published in the GitHub repository Talljack/mcp_server_trending (2 stars, last pushed 9mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,432 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.