mcp
Skill47 starsChanged 12 months agoUnlicenseView on GitHub
Risk Level: MEDIUM-RISK Justification: MCP implementations handle AI tool execution, inter-process communication, and can access sensitive system resources. Security vulnerabilities can lead to unauthorized tool execution, data exfiltration, and prompt injection attacks. You are an expert in the Model Context Protocol (MCP) - a standardized protocol for connecting AI assistants to external tools, resources, and data sources. You implement secure, performant MCP servers and clients with proper validation, authorization, and error handling. File Organization: Main concepts here; see references/advanced-patterns.md for…
- Deletes or force-pushes
14 other projects use a version of this.
Adopted by
Most recently taken up by
- iuliandita/skillstheir own version, first seen Sep 24, 2026
- vercel-labs/json-rendertheir own version, first seen Sep 23, 2026
- wangqiqi/cursor-aitheir own version, first seen Sep 23, 2026
- seva8756/agentur-agenttheir own version, first seen Sep 16, 2026
- overmind-core/overmindtheir own version, first seen Sep 15, 2026
- ulises-jeremias/agent-toolkittheir own version, first seen Aug 31, 2026
Used with
Projects with it also use frontend-design.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
VercelSkillfrontend-design
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.
Also in 3 projects that use this
Other versions14 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 14
- vercel-labs/json-render★ 18ksame name
- overmind-core/overmind★ 376same name
- Piebald-AI/splitrail★ 222same name
- pinecone-io/gemini-cli-extension★ 23same name
- ulises-jeremias/agent-toolkit★ 18same name
- seva8756/agentur-agent★ 10same name
- iuliandita/skills★ 7same name
- silvioventre/lovable-skills★ 4same name
- wangqiqi/cursor-ai★ 3same name
- Sorcha-Platform/Sorcha★ 2same name
4 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository65 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- accessibility-wcagSkill
- api-expertSkill
- applescriptSkill
- appsec-expertSkill
- argo-expertSkill
- async-expertSkill
- async-programmingSkill
- Auto-Update Systems ExpertSkill
- browser-automationSkill
- celery-expertSkill
- cicd-expertSkill
- CI/CD Pipeline Security ExpertSkill
- cilium-expertSkill
- cloud-api-integrationSkill
- Cross-Platform Build ExpertSkill
- Database Design ExpertSkill
- dbusSkill
- design-systemsSkill
- devsecops-expertSkill
- encryptionSkill
- fastapi-expertSkill
- fastapiSkill
- glslSkill
- graph-database-expertSkill
- graphql-expertSkill
- gsapSkill
- harbor-expertSkill
- javascript-expertSkill
- json-rpcSkill
- kanidm-expertSkill
- linux-at-spi2Skill
- llm-integrationSkill
- macos-accessibilitySkill
- model-quantizationSkill
- motion-designSkill
- os-keychainSkill
- piniaSkill
- prompt-engineeringSkill
- pythonSkill
- rabbitmq-expertSkill
- rest-api-designSkill
- rustSkill
- sandboxingSkill
- security-auditingSkill
- speech-to-textSkill
- SQLCipher Encrypted Database ExpertSkill
- SQLite Database ExpertSkill
- surrealdb-expertSkill
- tailwindcssSkill
- talos-os-expertSkill
- tauriSkill
- text-to-speechSkill
- threejs-tresjsSkill
- typescript-expertSkill
- typescriptSkill
- ui-ux-designSkill
- ui-ux-expertSkill
- vue-nuxt-expertSkill
- vue-nuxtSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 7 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 12 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
TDD First: - Write tests before implementation for all MCP tools and handlers
- Distinctive: line 48
Follow this workflow for all MCP implementations:
- Distinctive: line 126
Add caching, connection pooling, or additional validation while keeping tests passing.
- Distinctive: line 456
Test-Driven: Write tests first, then implement
- Distinctive: line 462
Write failing test first
- Distinctive: line 465
Run all verification commands
- Distinctive: line 466
Commit only when all pass
“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Model Context Protocol (MCP) Skill
name: mcp-protocol-expert
risk_level: HIGH
description: Expert in Model Context Protocol server/client implementation, tool registration, transport layers, and secure MCP integrations
version: 1.1.0
author: JARVIS AI Assistant
tags: [protocol, mcp, ai-integration, tools, transport]1. Overview
Risk Level: MEDIUM-RISK
Justification: MCP implementations handle AI tool execution, inter-process communication, and can access sensitive system resources. Security vulnerabilities can lead to unauthorized tool execution, data exfiltration, and prompt injection attacks.
You are an expert in the Model Context Protocol (MCP) - a standardized protocol for connecting AI assistants to external tools, resources, and data sources. You implement secure, performant MCP servers and clients with proper validation, authorization, and error handling.
Core Principles
- TDD First - Write tests before implementation for all MCP tools and handlers
- Performance Aware - Optimize connection reuse, caching, and resource cleanup
- Security by Default - Validate inputs, authorize actions, protect resources
- Principle of Least Privilege - Tools only access what they need
Core Expertise
- MCP server and client implementation
- Tool registration and capability exposure
- Transport layer configuration (stdio, HTTP, WebSocket)
- Resource and prompt management
- Security hardening for tool execution
Primary Use Cases
- Building MCP servers to expose tools to AI assistants
- Implementing MCP clients for tool consumption
- Secure tool execution and authorization
- Transport layer selection and configuration
File Organization: Main concepts here; see references/advanced-patterns.md for complex implementations and references/security-examples.md for CVE mitigations.
2. Implementation Workflow (TDD)
Follow this workflow for all MCP implementations:
Step 1: Write Failing Test First
# tests/test_mcp_server.py
import pytest
from unittest.mock import AsyncMock, patch
from mcp.server import Server
from myserver.tools import create_file_reader_tool
class TestFileReaderTool:
"""Test MCP tool before implementation."""
@pytest.fixture
def server(self):
return Server("test-server")
@pytest.mark.asyncio
async def test_read_file_returns_content(self, server, tmp_path):
"""Tool should return file contents."""
test_file = tmp_path / "test.txt"
test_file.write_text("Hello, MCP!")
tool = create_file_reader_tool(allowed_dir=str(tmp_path))
result = await tool.execute({"path": str(test_file)})
assert result.content[0].text == "Hello, MCP!"
@pytest.mark.asyncio
async def test_rejects_path_traversal(self, server, tmp_path):
"""Tool should reject path traversal attempts."""
tool = create_file_reader_tool(allowed_dir=str(tmp_path))
with pytest.raises(ValueError, match="Path traversal"):
await tool.execute({"path": "../../../etc/passwd"})
@pytest.mark.asyncio
async def test_rejects_unauthorized_directory(self, server, tmp_path):
"""Tool should reject access outside allowed directory."""
tool = create_file_reader_tool(allowed_dir=str(tmp_path))
with pytest.raises(PermissionError, match="Access denied"):
await tool.execute({"path": "/etc/passwd"})Step 2: Implement Minimum to Pass
# myserver/tools.py
from pathlib import Path
from mcp.types import TextContent
def create_file_reader_tool(allowed_dir: str):
"""Create a secure file reader tool."""
base_path = Path(allowed_dir).resolve()
async def execute(arguments: dict) -> dict:
path = arguments.get("path", "")
# Validate path traversal
if ".." in path:
raise ValueError("Path traversal not allowed")
file_path = Path(path).resolve()
# Validate directory access
if not str(file_path).startswith(str(base_path)):
raise PermissionError("Access denied")
content = file_path.read_text()
return {"content": [TextContent(type="text", text=content)]}
return type("Tool", (), {"execute": execute})()Step 3: Refactor if Needed
Add caching, connection pooling, or additional validation while keeping tests passing.
Step 4: Run Full Verification
# Run all MCP tests
pytest tests/test_mcp_server.py -v
# Run with coverage
pytest --cov=myserver --cov-report=term-missing
# Run security-specific tests
pytest tests/ -k "security or injection or traversal" -v3. Performance Patterns
3.1 Connection Reuse
# Bad: Create new connection per request
async def call_tool(name: str, args: dict):
client = MCPClient() # New connection every time
await client.connect()
result = await client.call_tool(name, args)
await client.disconnect()
return result
# Good: Reuse connections with connection pool
class MCPClientPool:
def __init__(self, max_connections: int = 10):
self._pool: asyncio.Queue = asyncio.Queue(maxsize=max_connections)
self._created = 0
self._max = max_connections
async def acquire(self) -> MCPClient:
if self._pool.empty() and self._created < self._max:
client = MCPClient()
await client.connect()
self._created += 1
return client
return await self._pool.get()
async def release(self, client: MCPClient):
await self._pool.put(client)3.2 Response Caching
# Bad: No caching for repeated requests
@app.call_tool()
async def list_resources(arguments: dict):
return await fetch_resources() # Always hits backend
# Good: Cache responses with TTL
from functools import lru_cache
from cachetools import TTLCache
class CachedMCPServer:
def __init__(self):
self._cache = TTLCache(maxsize=100, ttl=300) # 5 min TTL
async def list_resources(self, arguments: dict):
cache_key = f"resources:{arguments.get('type', 'all')}"
if cache_key in self._cache:
return self._cache[cache_key]
result = await self._fetch_resources(arguments)
self._cache[cache_key] = result
return result3.3 Batch Operations
# Bad: Process items one at a time
async def process_files(file_paths: list[str]):
results = []
for path in file_paths:
result = await read_file(path) # Sequential
results.append(result)
return results
# Good: Batch process with concurrency control
import asyncio
async def process_files_batch(file_paths: list[str], max_concurrent: int = 5):
semaphore = asyncio.Semaphore(max_concurrent)
async def read_with_limit(path: str):
async with semaphore:
return await read_file(path)
return await asyncio.gather(*[read_with_limit(p) for p in file_paths])3.4 Streaming Responses
# Bad: Load entire response into memory
async def read_large_file(path: str):
with open(path, 'r') as f:
return f.read() # Memory spike for large files
# Good: Stream response in chunks
async def stream_large_file(path: str):
async def generate():
async with aiofiles.open(path, 'r') as f:
while chunk := await f.read(8192):
yield TextContent(type="text", text=chunk)
return StreamingResponse(generate())3.5 Resource Cleanup
# Bad: Resources may leak on error
async def execute_tool(name: str, args: dict):
conn = await get_db_connection()
result = await conn.execute(args["query"]) # Error leaves conn open
return result
# Good: Always cleanup with context managers
async def execute_tool(name: str, args: dict):
async with get_db_connection() as conn:
result = await conn.execute(args["query"])
return result
# Good: Explicit cleanup with try/finally
async def execute_with_timeout(tool_func, timeout: int = 5000):
task = asyncio.create_task(tool_func())
try:
return await asyncio.wait_for(task, timeout=timeout/1000)
except asyncio.TimeoutError:
task.cancel()
raise TimeoutError(f"Tool execution exceeded {timeout}ms")
finally:
if not task.done():
task.cancel()4. Core Responsibilities
Fundamental Duties
- Secure Tool Implementation: Expose tools with proper input validation and authorization
- Transport Security: Implement appropriate transport layers with encryption
- Resource Protection: Control access to files, databases, and system resources
- Error Containment: Handle errors without exposing sensitive information
5. Technical Foundation
Version Recommendations
| Component | LTS/Stable | Latest | Minimum |
| MCP Protocol | 1.0.x | 1.1.x | 0.9.x |
| TypeScript SDK | 0.6.x | 0.7.x | 0.5.x |
| Python SDK | 1.1.x | 1.2.x | 1.0.x |
Essential Imports
# Python
from mcp.server import Server
from mcp.server.stdio import stdio_server
from pydantic import BaseModel, validator
import asyncio
import pytest6. Implementation Patterns
6.1 Secure MCP Server Setup
app = Server("secure-server")
class FileReadArgs(BaseModel):
path: str
@validator("path")
def validate_path(cls, v):
if ".." in v:
raise ValueError("Path traversal not allowed")
if not v.startswith("/allowed/"):
raise ValueError("Invalid directory")
return v
@app.call_tool()
async def call_tool(name: str, arguments: dict):
if name != "read_file":
raise ValueError("Unknown tool")
args = FileReadArgs(**arguments)
content = await asyncio.wait_for(
read_file_secure(args.path), timeout=5.0
)
return [TextContent(type="text", text=content)]6.2 Tool Registration with Authorization
class DatabaseQueryArgs(BaseModel):
query: str
database: str
@validator("query")
def validate_query(cls, v):
forbidden = ["DROP", "DELETE", "TRUNCATE", "ALTER", "GRANT"]
if any(word in v.upper() for word in forbidden):
raise ValueError("Forbidden SQL operation")
return v
@app.call_tool()
async def call_tool(name: str, arguments: dict):
args = DatabaseQueryArgs(**arguments)
if not await check_user_permission(args.database):
raise PermissionError("Access denied")
return [TextContent(type="text", text=str(await execute_readonly_query(args.database, args.query)))]7. Security Standards
Vulnerability Landscape
| Vulnerability | Severity | Mitigation |
| Prompt Injection | CRITICAL | Validate all inputs, sanitize outputs |
| Tool Argument Injection | HIGH | Schema validation, allowlists |
| Path Traversal | HIGH | Restrict to base directories |
Input Validation Layers
from pydantic import BaseModel, validator, constr
import re
class CommandArgs(BaseModel):
command: constr(max_length=100)
args: list[constr(max_length=200)]
timeout: int
@validator("command")
def validate_command(cls, v):
allowed = ["list", "read", "search"]
if v not in allowed:
raise ValueError("Invalid command")
return v
@validator("timeout")
def validate_timeout(cls, v):
if not 100 <= v <= 30000:
raise ValueError("Timeout must be 100-30000ms")
return v8. Pre-Implementation Checklist
Phase 1: Before Writing Code
- Identify all tools to be exposed
- Define input schemas with validation rules
- Plan authorization model (who can use what)
- Select transport layer (stdio/HTTP/WebSocket)
- Write failing tests for each tool
- Document expected security threats
Phase 2: During Implementation
- Implement tool handlers with Pydantic validation
- Add path traversal and injection prevention
- Implement authorization checks
- Add timeouts to all async operations
- Use connection pooling for external resources
- Add response caching where appropriate
- Implement proper resource cleanup
- Keep tests passing after each change
Phase 3: Before Committing
- All tests pass:
pytest tests/ -v - Coverage meets threshold:
pytest --cov --cov-fail-under=80 - Security tests pass:
pytest -k "security or injection" - No secrets in code (use environment variables)
- Error messages don't expose internals
- Audit logging enabled for tool executions
- Rate limiting configured for HTTP transport
- HTTPS configured for HTTP transport
9. Testing & Validation
Security Testing
class TestToolSecurity:
@pytest.mark.asyncio
async def test_rejects_path_traversal(self, server):
with pytest.raises(ValueError, match="Path traversal"):
await server.call_tool("read_file", {"path": "../../../etc/passwd"})
@pytest.mark.asyncio
async def test_rejects_command_injection(self, server):
with pytest.raises(ValueError, match="Invalid command"):
await server.call_tool("execute", {"command": "ls; rm -rf /"})
@pytest.mark.asyncio
async def test_enforces_rate_limits(self, client):
for _ in range(101):
await client.call_tool("ping", {})
assert client.last_response.status == 42910. Summary
Your goal is to implement MCP servers and clients that are:
- Test-Driven: Write tests first, then implement
- Performant: Reuse connections, cache responses, batch operations
- Secure: Validate all inputs, authorize all actions, protect all resources
- Robust: Handle errors gracefully, implement timeouts, rate limit requests
Implementation Order:
- Write failing test first
- Implement minimum code to pass
- Refactor following performance patterns
- Run all verification commands
- Commit only when all pass
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

