project-structure

project-structure is a cursor rule for Cursor from noveldig/mcp-xhs-publisher. It costs 1,653 tokens per session, scanned A, original, MIT.

A project-structure guide for Python servers that use MCP, a standard for connecting AI assistants to tools. It recommends where to put source code, configuration, dependencies, tests, documentation, and related files.

In plain words
What is it for?
Use it when organising a Python MCP server, setting up its package and configuration files, and deciding where supporting project files belong.
Why use it?
It gives a project a predictable layout, making files easier to find and helping contributors maintain the same conventions.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when organising a Python MCP server, setting up its package and configuration files, and deciding where supporting project files belong.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/noveldig/mcp-xhs-publisher/project-structure
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.

Clone the repo
git clone --depth 1 https://github.com/noveldig/mcp-xhs-publisher

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for project-structure

README.md
[![agentmods](https://agentmods.dev/badge/rules/noveldig/mcp-xhs-publisher/project-structure/github.svg)](https://agentmods.dev/rules/noveldig/mcp-xhs-publisher/project-structure)
Your own site
<a href="https://agentmods.dev/rules/noveldig/mcp-xhs-publisher/project-structure"><img src="https://agentmods.dev/badge/rules/noveldig/mcp-xhs-publisher/project-structure/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for project-structure

Your own site · 80×15
<a href="https://agentmods.dev/rules/noveldig/mcp-xhs-publisher/project-structure"><img src="https://agentmods.dev/badge/rules/noveldig/mcp-xhs-publisher/project-structure.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,653 This file is loaded in full into every session.
When invoked 1,653 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.01653 $0.01653
Opus 5 $0.00826 $0.00826
Sonnet 5 $0.00331 $0.00331
Haiku 4.5 $0.00165 $0.00165

Measured 8d ago against content hash 4132bb85997a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

project-structure 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 8d ago.

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/project-structure.mdc · 79 lines

How it starts

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

项目结构指南 (Project Structure Guide)

本文档旨在为基于 MCP (Model Context Protocol) 的 Python 项目提供标准的项目结构和文件组织规范。遵循这些规范有助于保持代码库的清晰、一致和易于维护,特别是对于构建 MCP 服务器的场景。

核心目录与文件 (顶层结构)

一个典型的 MCP 服务器项目应包含以下核心目录和文件:

  1. 源代码 (src/):

    • 所有项目的 Python 源代码都应放置在 src/ 目录下,并以项目名称(通常是 PyPI 包名)命名子目录。例如,src/my_mcp_server/
    • 包的初始化文件 __init__.py 应位于 src/my_mcp_server/__init__.py
  2. 配置文件:

    • [pyproject.toml](mdc:pyproject.toml): 项目构建配置、依赖项及元数据。详细的配置和使用方法参见 使用 uv 打包与依赖管理指南
    • [uv.lock](mdc:uv.lock) (或等效的锁定文件): 确保依赖版本一致性。其生成和管理参见 使用 uv 打包与依赖管理指南
    • [.pre-commit-config.yaml](mdc:.pre-commit-config.yaml): (推荐) pre-commit 钩子配置。
    • [.python-version](mdc:.python-version): (推荐) 指定项目 Python 版本。
  3. 文档与许可证:

    • [README.md](mdc:README.md): 项目入口文档。
    • [LICENSE](mdc:LICENSE): 开源许可证文件。
    • [CONTRIBUTING.md](mdc:CONTRIBUTING.md): (推荐) 贡献指南。
  4. 其他:

    • [Dockerfile](mdc:Dockerfile): (如果适用) Docker 镜像构建文件。
    • [.gitignore](mdc:.gitignore): Git 忽略配置。

模块化与包架构 (src/<project_package_name>/ 内部)

在项目源代码包(例如 src/my_mcp_server/)内部,应根据功能和 MCP 核心概念将代码组织到不同的子包或模块中,以实现高内聚、低耦合。以下是一个推荐的通用包架构模式,供 MCP 服务器开发者参考:

  • __init__.py: 包的根初始化文件。可以用于暴露包的公共 API。
  • server_runner.py (或 main.py, app.py, __main__.py):
    • 职责:MCP 服务器的启动入口。负责实例化服务器、配置路由/消息处理器、注册所有 MCP 资源 (由 resources/ 子包实现其定义) 和 MCP 工具 (由 tools/ 子包实现其定义) 的提供者/执行器,并启动服务器监听。
  • config.py:
    • 职责:加载、管理和提供对服务器配置(如端口、外部服务凭证、功能开关等)的访问。
  • models/ (子包):
    • 职责:存放数据结构定义,通常使用 Pydantic 或 dataclasses 实现。
    • models/__init__.py
    • models/base_schemas.py: (可选) 定义通用的基础数据模型或共享结构。
    • models/resource_schemas.py: 定义各种 MCP 资源内容的具体数据结构。
    • models/tool_io_schemas.py: 定义 MCP 工具的输入参数和输出结果的数据结构。
    • (可根据领域进一步细化,例如 models/domain_specific_schemas.py)
  • resources/ (子包):
    • 职责:实现 MCP 资源指南 中定义的 MCP 资源逻辑。每个主要的资源类型或一组相关的资源可以有自己的模块。
    • resources/__init__.py
    • resources/base_provider.py: (可选) 如果多个资源提供者有共享逻辑,可以定义一个基类。
    • resources/resource_type_A_provider.py: 实现特定类型(例如 "documents" 或 "tasks")资源的 listResources, retrieveResource, subscribeToResource 等逻辑。
    • resources/another_resource_group_provider.py: 实现另一组相关资源的逻辑。
  • tools/ (子包):
    • 职责:实现 MCP 工具指南 中定义的 MCP 工具的执行逻辑。每个工具或一组功能相近的工具可以组织在一个模块中。
    • tools/__init__.py
    • tools/base_executor.py: (可选) 如果多个工具有共享的执行前/后逻辑,可以定义一个基类。
    • tools/action_category_X_executor.py: 实现某一类操作(例如 "file_operations" 或 "notification_services")的工具逻辑。
    • tools/data_processing_executor.py: 实现数据处理相关工具的逻辑。
  • services/ (或 adapters/clients/) (子包):
    • 职责:封装与外部服务或数据源(如第三方 API、数据库、消息队列等)的交互逻辑。
    • services/__init__.py
    • services/external_api_client.py: 与某个特定第三方 HTTP API 通信的客户端。
    • services/database_accessor.py: 提供数据库的增删改查接口。
  • exceptions.py:
    • 职责:定义项目中使用的自定义异常类,方便统一错误处理。
  • util/ (或 common/helpers/) (子包):
    • 职责:存放项目中多处用到的通用辅助函数、类或常量。
    • util/__init__.py
    • util/datetime_helpers.py
    • util/string_formatters.py

Read the full file on GitHub · 79 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. 8d ago First seen · 79 lines · 1,653 tokens per session scan A 4132bb85997a

Subscribe to this mod's changes

project-structure is a cursor rule published in the GitHub repository noveldig/mcp-xhs-publisher (1 stars, last pushed 1y ago), licensed MIT. It adds 1,653 tokens to every session, about $0.0083 per session on Opus 5. 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.