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.
npx agentmods add rules/tienan92it/binance-mcp/mcp-rulesgit clone --depth 1 https://github.com/tienan92it/binance-mcpWrote 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.
[](https://agentmods.dev/rules/tienan92it/binance-mcp/mcp-rules)<a href="https://agentmods.dev/rules/tienan92it/binance-mcp/mcp-rules"><img src="https://agentmods.dev/badge/rules/tienan92it/binance-mcp/mcp-rules.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.04089 |
| Opus 5 | $0.00000 | $0.02044 |
| Sonnet 5 | $0.00000 | $0.00818 |
| Haiku 4.5 | $0.00000 | $0.00409 |
Grade A, and why
mcp-rules 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 5d 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.
How it starts
The opening of the file, as written. The whole thing — 63 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Architecture & Code Structure
- Use the MCP SDK's server builder (FastMCP) – Initialize a
FastMCPserver instance (e.g. in a mainserver.py) with a clear name for your application. Avoid writing custom networking or JSON handling; let the SDK handle connection management and message routing. - Separation of concerns – Organize code into modules for distinct purposes. Keep MCP interface code (server setup, tool/resource definitions) separate from business logic (strategy algorithms, data loading, backtest engine). For example, have a module for strategy logic and another for MCP server initialization that calls into that logic.
- Leverage SDK conventions – Define MCP tools and resources using the provided decorators (e.g.
@mcp.tool(),@mcp.resource()) instead of manual routing. This ensures the server advertises capabilities correctly to the client and maintains protocol compliance. Use the SDK’s structure (prompts, tools, resources as needed) to align with MCP’s expected architecture. - Lifecycle management – If your server needs setup/teardown (database connections, data pre-loading), use the
lifespancontext provided by FastMCP (or similar startup hooks) rather than running setup code at import time. This yields a cleaner architecture and integrates with MCP’s lifecycle (init and shutdown events) gracefully. - Minimal server entry-point – Keep the code that launches the server lightweight. For example, use an
if __name__ == "__main__":block or a small CLI to start the MCP server (possibly usingmcp.run()oruvicornif using HTTP). This makes it easier to start the server in different modes (dev, production) and to test components in isolation.
Agent Registration & Session Management
- Explicit agent registration – Provide tools or functions for registering a new trading strategy/agent into the system (e.g. a
register_strategy(name, config)tool). When an agent is registered, store its definition (parameters, possibly code or identifier) in an internal registry. Confirm registration by returning a unique ID or name to reference that strategy later. - Session isolation – Design the server to handle multiple sessions or users without interference. Utilize MCP’s session features to keep each session’s data separate. For example, maintain a session-specific structure (dictionary or context object) that holds the strategies and state for that session. Do not use global state for per-session data; instead, use the
Contextor session storage provided by the SDK (e.g.ctx.sessionor similar) to tie data to a session. - Track session state – Maintain clear state for each strategy/agent within a session: whether it’s idle, running a backtest, or completed. If a strategy is running, subsequent actions (like checking results) should reference the correct session and strategy. Use unique keys (like session_id + strategy_id) if storing in a global registry to avoid collisions, but prefer built-in session context when available.
- Cleanup and lifecycle – Handle the removal or resetting of strategies when appropriate. For example, if a session ends or an agent is unregistered, ensure its state is cleaned up from the registry. This prevents stale data from accumulating and ensures each new session starts fresh or with only intended persisted state.
- Concurrent execution considerations – If multiple agents or multiple sessions might run backtests concurrently, ensure that shared resources are managed safely. Use locks or asyncio synchronization for shared data, or better, avoid sharing mutable global data altogether by scoping it per session/agent. This will prevent race conditions when traders run strategies in parallel.
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.
- 5d ago First seen · 63 lines · 4,089 tokens per session scan A 0400dcd91acb
mcp-rules is a cursor rule published in the GitHub repository tienan92it/binance-mcp (20 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 4,089 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-30.
Other cursor rules, from other repositories
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
cli-error-handling
CLI command error handling patterns.
family-instance-domain-actions
Family instance domain action implementation patterns.
prefer-assertions-over-defensive-checks
Prefer assertions over defensive checks when data is guaranteed to be valid.
prefer-direct-imports-over-module-mocks
Prefer extracting a testable core over vi.mock / vi.resetModules when unit tests need to reach production logic entangled with config, env, or singletons.