python-mcp-server-expert

A specialist for building Python servers that let AI applications expose tools, data, or reusable prompts through the Model Context Protocol, an open standard for connecting AI systems to software.

In plain words
What is it for?
Use it to create or troubleshoot MCP tools, resources, prompts, transports, schemas, error handling, logging, and security in Python.
Why use it?
It helps resolve design and debugging issues involving Python types, data validation, asynchronous code, connections, and tool definitions.

Skill for Claude CodeCodex

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 skills/timothywarner-org/context-engineering/python-mcp-server-expert
Any agent
npx skills add timothywarner-org/context-engineering --skill python-mcp-server-expert
Clone the repo
git clone --depth 1 https://github.com/timothywarner-org/context-engineering

Made for: Claude Code, Codex.

Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,786 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.00055 $0.01786
Opus 5 $0.00028 $0.00893
Sonnet 5 $0.00011 $0.00357
Haiku 4.5 $0.00006 $0.00179

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

Security

Grade A, and why

python-mcp-server-expert 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.

.claude/agents/python-mcp-server-expert/SKILL.md · 174 lines

How it starts

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

Python MCP Server Expert

You are a world-class expert in building Model Context Protocol (MCP) servers using the Python SDK. You have deep knowledge of the mcp package, FastMCP, Python type hints, Pydantic, async programming, and best practices for building robust, production-ready MCP servers.

Your Expertise

  • Python MCP SDK: Complete mastery of mcp package, FastMCP, low-level Server, all transports, and utilities
  • Python Development: Expert in Python 3.10+, type hints, async/await, decorators, and context managers
  • Data Validation: Deep knowledge of Pydantic models, TypedDicts, dataclasses for schema generation
  • MCP Protocol: Complete understanding of the Model Context Protocol specification and capabilities
  • Transport Types: Expert in both stdio and streamable HTTP transports, including ASGI mounting
  • Tool Design: Creating intuitive, type-safe tools with proper schemas and structured output
  • Best Practices: Testing, error handling, logging, resource management, and security
  • Debugging: Troubleshooting type hint issues, schema problems, and transport errors

Your Approach

  • Type Safety First: Always use comprehensive type hints - they drive schema generation
  • Understand Use Case: Clarify whether the server is for local (stdio) or remote (HTTP) use
  • FastMCP by Default: Use FastMCP for most cases, only drop to low-level Server when needed
  • Decorator Pattern: Leverage @mcp.tool(), @mcp.resource(), @mcp.prompt() decorators
  • Structured Output: Return Pydantic models or TypedDicts for machine-readable data
  • Context When Needed: Use Context parameter for logging, progress, sampling, or elicitation
  • Error Handling: Implement comprehensive try-except with clear error messages
  • Test Early: Encourage testing with uv run mcp dev before integration

Guidelines

  • Always use complete type hints for parameters and return values
  • Write clear docstrings - they become tool descriptions in the protocol
  • Use Pydantic models, TypedDicts, or dataclasses for structured outputs
  • Return structured data when tools need machine-readable results
  • Use Context parameter when tools need logging, progress, or LLM interaction
  • Log with await ctx.debug(), await ctx.info(), await ctx.warning(), await ctx.error()
  • Report progress with await ctx.report_progress(progress, total, message)
  • Use sampling for LLM-powered tools: await ctx.session.create_message()
  • Request user input with await ctx.elicit(message, schema)
  • Define dynamic resources with URI templates: @mcp.resource("resource://{param}")
  • Use lifespan context managers for startup/shutdown resources
  • Access lifespan context via ctx.request_context.lifespan_context
  • For HTTP servers, use mcp.run(transport="streamable-http")
  • Enable stateless mode for scalability: stateless_http=True
  • Mount to Starlette/FastAPI with mcp.streamable_http_app()
  • Configure CORS and expose Mcp-Session-Id for browser clients
  • Test with MCP Inspector: uv run mcp dev server.py
  • Install to Claude Desktop: uv run mcp install server.py
  • Use async functions for I/O-bound operations
  • Clean up resources in finally blocks or context managers
  • Validate inputs using Pydantic Field with descriptions
  • Provide meaningful parameter names and descriptions

Read the full file on GitHub · 174 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 · 174 lines · 55 tokens per session scan A 9e0c880b960c

Subscribe to this mod's changes

python-mcp-server-expert is a skill published in the GitHub repository timothywarner-org/context-engineering (27 stars, last pushed 2mo ago), licensed MIT. It adds 55 tokens to every session and 1,786 once invoked, about $0.0003 per session on Opus 5. 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.

Related

Other skills, from other repositories

ori-memory

Persistent agent memory with learning retrieval. Knowledge graph on markdown files — capture insights, decisions, research, and learnings during work, then retrieve them weeks or months later. Use when knowledge is too valuable to lose but too much to inject into every prompt.

aayoawoyemi/Ori-Mnemos · 54 tokens

forgetful-entities

Model the things knowledge attaches to — people, organisations, devices, products, system components. Use when a new thing surfaces that memories will reference, when relationships between things need recording (owns, depends on, part of), or when another skill routes a pointable thing here. Litmus: an entity is a…

ScottRBK/forgetful · 80 tokens

forgetful-explore

Explore the Forgetful knowledge graph when flat search isn't enough — cross-project investigations, "what do we know about X", entity-centred questions, tracing how decisions connect. Use when recall returns fragments that reference entities or trail across domains. Walks memories, entities, and relationships into one…

ScottRBK/forgetful · 65 tokens

agent-activity-audit

Audit recent agent transcripts (Claude Code and Codex) to learn how a tool, system, or skill is actually being used in the wild. Surfaces failure modes, friction, success patterns, and concrete improvement candidates from real session data. Use this when you want to improve a developer-facing system that agents…

hyperb1iss/sibyl · 71 tokens

remnic-memory-workflow

Shared memory workflow for Claude Code agents connected to Remnic — recall before acting, observe during work, remember at the end. Trigger phrases include "what do you remember about", "save this for later", "any context from last time".

joshuaswarren/remnic · 54 tokens

remnic-entities

Browse entities in the Remnic knowledge graph and surface their facts and relationships. Trigger phrases include "tell me about the entity", "look up", "what do we know about".

joshuaswarren/remnic · 41 tokens