with-mcp

A set of rules for building servers with the Model Context Protocol, or MCP. MCP is a standard for connecting AI clients to tools, data resources, and reusable prompts through JSON-RPC messages.

In plain words
What is it for?
Use it while developing or reviewing an MCP server with the MCP TypeScript SDK, including its tools, resources, and prompts.
Why use it?
It provides the protocol details needed to handle connection setup, version compatibility, capabilities, requests, responses, and notifications correctly.

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/zackiles/cursor-config/with-mcp
Clone the repo
git clone --depth 1 https://github.com/zackiles/cursor-config

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 4,701 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.04701
Opus 5 $0.00000 $0.02351
Sonnet 5 $0.00000 $0.00940
Haiku 4.5 $0.00000 $0.00470

Measured 2d ago against content hash bb9e2aed787c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

with-mcp 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 2d 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.

Origin

Copies of this mod

2 near-identical copies found in the catalogue:

  • with-mcp — 92% identical, 6 lines differ
  • with-mcp — 92% identical, 6 lines differ
.cursor/rules/global/with-mcp.mdc · 604 lines

How it starts

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

Context on a Model Context Protocol (MCP) Server

You're working on an MCP server and must use this information to guide your decisions and opinions. MCP servers provide LLMs with tools, resources, and prompts they can access with either stdio or server side events (WebSockets).

MCP Message Types

Protocol: JSON-RPC2.0 Requests → Initiate operations; require a unique ID and method name.
Responses → Reply to requests; must include the same ID as the request.
Notifications → One-way messages; must not include an ID.

MCP Clien/Server Lifecycle

Initialization Phase:

  • Client sends initialize request with protocol version, capabilities, and implementation info.
  • Server responds with its protocol version and capabilities.
  • Client sends initialized notification after successful initialization.

Version Negotiation:

  • Client proposes protocol version in initialize request.
  • Server responds with supported version.
  • If versions are incompatible, client should disconnect.

Capability Negotiation:

  • Both client and server declare supported capabilities during initialization.
  • Key capabilities:
    • Client:
      • roots: Provides filesystem roots.
      • sampling: Supports LLM sampling requests.
    • Server:
      • prompts: Offers prompt templates.
      • resources: Provides readable resources.
      • tools: Exposes callable tools.
      • logging: Emits structured log messages.

Operation Phase:

  • After initialization, normal protocol operations commence.

Shutdown Phase:

  • Client disconnects to terminate the connection gracefully.

MCP Tools

Purpose

Facilitates LLM interaction with external systems (APIs, databases, computations) via server-exposed tools.

](mdc:https:/spec.modelcontextprotocol.io/specification/2024-11-05/server/tools)

Endpoints

tools/list
  • Request: Optional cursor for pagination.
  • Response: List of tools + nextCursor if more available.

Read the full file on GitHub · 604 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. 2d ago First seen · 604 lines · 0 tokens per session scan A bb9e2aed787c

Subscribe to this mod's changes

with-mcp is a cursor rule published in the GitHub repository zackiles/cursor-config (17 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 4,701 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.