mcpsdk

mcpsdk is a cursor rule for Cursor from MartinSchlott/BetterMCPFileServer. It costs 0 tokens per session (2,177 once invoked), scanned A, original, MIT.

A TypeScript guide for building an MCP server, a program that lets an AI assistant use outside tools through a standard interface. It covers server structure, tool implementation, and defining tool inputs with Zod.

In plain words
What is it for?
Use it when creating TypeScript MCP servers and adding tools whose inputs need defined schemas.
Why use it?
It gives you a focused starting point for building MCP tools without having to work out the basic server design yourself.

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/martinschlott/bettermcpfileserver/mcpsdk
Clone the repo
git clone --depth 1 https://github.com/MartinSchlott/BetterMCPFileServer

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 mcpsdk

README.md
[![agentmods](https://agentmods.dev/badge/rules/martinschlott/bettermcpfileserver/mcpsdk.svg)](https://agentmods.dev/rules/martinschlott/bettermcpfileserver/mcpsdk)
Your own site
<a href="https://agentmods.dev/rules/martinschlott/bettermcpfileserver/mcpsdk"><img src="https://agentmods.dev/badge/rules/martinschlott/bettermcpfileserver/mcpsdk.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,177 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.02177
Opus 5 $0.00000 $0.01089
Sonnet 5 $0.00000 $0.00435
Haiku 4.5 $0.00000 $0.00218

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

Security

Grade A, and why

mcpsdk scanned grade A with 1 finding 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 3d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

const response = await fetch(parsed.data.url);
.cursor/rules/mcpsdk.mdc · 351 lines

How it starts

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


description: MCP Server Implementation Guide: Tools in TypeScript globs: *.ts alwaysApply: false

MCP Server Implementation Guide: Tools in TypeScript

This guide provides a concise overview of how to implement an Anthropic Model Context Protocol (MCP) server that offers tools in TypeScript. It focuses specifically on the core aspects needed to create a functional MCP server without diving into general TypeScript project setup.

Core Concepts

The Model Context Protocol (MCP) is an open standard that allows AI assistants like Claude to interact with external systems through standardized interfaces. An MCP server can expose:

  • Resources: Read-only data (similar to GET endpoints)
  • Tools: Functions that perform actions (similar to POST endpoints)
  • Prompts: Reusable templates for AI interactions

This guide focuses specifically on implementing Tools.

Basic MCP Server Structure

Here's the minimal structure for an MCP server that provides tools:

import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
  CallToolRequestSchema,
  ListToolsRequestSchema,
  ToolSchema,
} from "@modelcontextprotocol/sdk/types.js";
import { z } from "zod"; // For input validation
import { zodToJsonSchema } from "zod-to-json-schema";

// Define server with metadata
const server = new Server(
  {
    name: "my-tool-server",
    version: "1.0.0",
  },
  {
    capabilities: {
      tools: {}, // Indicates we'll provide tools
    },
  }
);

// Start the server with stdio transport
async function runServer() {
  const transport = new StdioServerTransport();
  await server.connect(transport);
  console.error("MCP server running on stdio");
}

runServer().catch((error) => {
  console.error("Fatal error running server:", error);
  process.exit(1);
});

Implementing Tools

There are two key request handlers you need to implement for tools:

  1. ListToolsRequestSchema: Advertises available tools and their schemas
  2. CallToolRequestSchema: Handles actual tool invocations

Read the full file on GitHub · 351 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. 3d ago First seen · 351 lines · 2,177 tokens per session scan A 6bbf9a702cdc

Subscribe to this mod's changes

mcpsdk is a cursor rule published in the GitHub repository MartinSchlott/BetterMCPFileServer (1 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,177 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.