with-mcp

A set of coding rules for building MCP servers with the TypeScript SDK. MCP, or Model Context Protocol, lets AI applications use server-provided tools, data, and prompts.

In plain words
What is it for?
Use it while developing or reviewing an MCP server. It helps with client-server initialization, requests, responses, notifications, and available server features.
Why use it?
It gives the agent the protocol details needed to reason consistently about JSON-RPC messages, startup, version negotiation, and capabilities.

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

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 4,665 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 92% copy Near-identical to another mod 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.04665
Opus 5 $0.00000 $0.02332
Sonnet 5 $0.00000 $0.00933
Haiku 4.5 $0.00000 $0.00466

Measured 2d ago against content hash 6bf8a4072fa0, 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

This is a copy

92% identical to with-mcp — 6 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/with-mcp.mdc · 600 lines

How it starts

The opening of the file, as written. The whole thing — 600 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 decisons 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 · 600 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 · 600 lines · 0 tokens per session scan A 6bf8a4072fa0

Subscribe to this mod's changes

with-mcp is a cursor rule published in the GitHub repository zackiles/deno-kit (3 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 4,665 tokens. A static security scan graded it A with 0 findings. It is 92% identical to with-mcp, differing in 6 lines, and is treated as a copy.