mcp-patterns

Define MCP server-client tool protocols with JSON-RPC and transport layers.

161|21|Updated Mar 26, 2026
One-click install
npx skills add https://github.com/softspark/ai-toolkit --skill mcp-patterns-softspark
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mcp-patterns
Source: https://github.com/softspark/ai-toolkit/tree/main/app/skills/mcp-patterns
Command: npx skills add https://github.com/softspark/ai-toolkit --skill mcp-patterns-softspark

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Inconsistent and undocumented approaches to building Model Context Protocol (MCP) servers and clients cause integration friction, security gaps, and duplicated effort across AI‑augmented tools.

Core Features & Use Cases

  • Tool Schema Patterns: Standardized JSON Schema definitions with annotations such as readOnlyHint, idempotentHint, and openWorldHint.
  • Transport Implementations: Ready‑to‑use examples for stdio, HTTP with Server‑Sent Events, and streamable HTTP endpoints.
  • JSON‑RPC 2.0 Handling: Complete request, response, and error formats with batch support.
  • Security & Best Practices: Input validation, origin checks, rate limiting, structured logging, and session management. Use Case: A developer building an AI‑driven search service can adopt these patterns to expose a search_kb tool over HTTP/SSE with proper validation, batching, and security safeguards.

Quick Start

Ask the assistant to generate an MCP server that exposes a search_kb tool using the shown TypeScript pattern.

Frequently Asked Questions about mcp-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement JSON-RPC 2.0 batching in an MCP server?

MCP server tool schemas use standardized JSON Schema definitions with annotations like readOnlyHint, idempotentHint, and openWorldHint to define tool behavior and capabilities.

What transport layers can I use for a Model Context Protocol server?

MCP tool protocols enforce security through input validation, origin checks, rate limiting, structured logging, and session management to prevent integration friction and security gaps.

How do I define tool schemas with security annotations in MCP?

JSON-RPC 2.0 batching in an MCP server is implemented using complete request, response, and error formats that support multiple batched calls over a single transport connection.

What security best practices should I follow when building MCP tool protocols?

Model Context Protocol servers support stdio, HTTP with Server-Sent Events, and streamable HTTP endpoints as ready-to-use transport implementations for client communication.

Can I expose an AI search tool over HTTP/SSE using MCP patterns?

You can expose an AI search tool over HTTP/SSE using MCP patterns by adopting standardized tool definitions, transport implementations, and JSON-RPC 2.0 handling with proper validation and batching.