Not loaded · from fastmcp-engineering
Design FastMCP Context and dependency injection without turning request context into a Service Locator, God Object, or hidden application container.
Claude Code won't load this skill
It ships in fastmcp-engineering at skills/, but Claude Code only loads skills/<name>/SKILL.md and folders listed under skills in plugin.json. Installing the plugin doesn't add it.
Use FastMCP Context only for MCP/runtime concerns exposed by the target version and use dependency injection for explicit dependency composition. Preserve a strict boundary between protocol/runtime context and application/domain dependencies.
Scope / When to use: FastMCP Context and dependency injection without turning request context into a Service Locator, God Object, or hidden application container.
Trigger: designing or changing FastMCP Context usage or dependency-injection wiring.
Upstream / Prerequisite: AGENTS.md and engineering contracts read; identified exact FastMCP and Python versions; evidence recorded before implementation.
Mission / Goal: use FastMCP Context only for MCP/runtime concerns exposed by the target version; use dependency injection for explicit dependency composition; preserve a strict boundary between protocol/runtime context and application/domain dependencies.
Research / Evidence: read official FastMCP Context and dependency/DI documentation; inspect relevant official PrefectHQ/fastmcp examples; inspect source/tests for ambiguous or version-sensitive semantics; check MCP specification/SEP material where protocol semantics are relevant; check first-party dependency documentation for involved DI/validation libraries; never infer Context/DI signatures or lifecycle behavior from memory.
Decision / Selection rules: explicitly distinguish Context (runtime/request-facing MCP capability) from dependency injection, application services, domain services, lifespan-managed resources, middleware-established context, authentication/authorization context, and configuration; do not use Context merely because it is convenient; dependencies flow inward through explicit abstractions; reject designs where Context becomes a bag of services.
Version / Compatibility: identify exact FastMCP and Python versions; the exact supported Context surface is version-sensitive and must be verified.
Deliverables / Artifacts: version-specific Context/DI research artifact; dependency graph and scope map; Context-vs-DI decision record; implementation; wiring tests; lifecycle/concurrency verification; architecture re-check; reproducible evidence. Verification / Testing: test Context-dependent behavior, injected fake/stub implementations, missing/invalid dependency cases, scope/lifecycle behavior, concurrent use where relevant, authorization context where relevant, MCP Client/in-process behavior, and startup/shutdown cleanup for lifecycle-managed resources. Failure / Stop conditions: reject if Context is used as a service registry, application services depend directly on FastMCP Context without an approved boundary, dependency scope is undefined, lifecycle ownership is ambiguous, mutable shared state lacks a concurrency model, or target-version Context/DI behavior was not verified. Positive scenario: Context is used only for runtime concerns and dependencies are explicitly injected with a defined scope. Negative scenario: Context becomes a service-locator bag that hides dependencies and couples application logic to the MCP runtime.
Before implementation:
AGENTS.md and engineering contracts.Never infer Context/DI signatures or lifecycle behavior from memory.
Explicitly distinguish:
Context as runtime/request-facing MCP capability;Do not use Context merely because it is convenient to reach an object.
Context may carry or expose runtime concerns supported by the target FastMCP version, such as request/session information, logging, progress/reporting, resource access, lifecycle state, and protocol-aware capabilities.
The exact supported surface is version-sensitive and must be verified.
Do not place arbitrary application state into Context to avoid defining interfaces.
Dependencies should flow inward through explicit abstractions:
FastMCP adapter
│
├── Context/runtime capabilities
│
└── injected application ports
│
▼
application services
│
▼
domain
Infrastructure implementations are composed at the composition root/lifecycle boundary, not discovered dynamically by business code.
Reject designs where Context becomes a bag of services such as:
ctx.services.database
ctx.services.user_service
ctx.services.payment_service
ctx.services.anything
This hides dependencies, weakens testability, and couples application logic to the MCP runtime.
Prefer explicit constructor/function dependencies and typed application ports.
If a dependency owns startup/shutdown resources, determine whether it belongs to FastMCP lifespan management. Verify exact lifespan and Context interaction from first-party sources before implementation.
Do not create per-request heavyweight clients if a correctly scoped lifecycle resource is appropriate.
For every injected dependency document its scope:
For mutable or stateful dependencies document concurrency guarantees and ownership. Never assume a client, session, ORM object, or cache is safe to share concurrently.
Treat identity/authentication context as untrusted input until established by the documented security boundary. Do not let arbitrary Context fields become authorization decisions. Define the policy owner and fail-closed behavior.
Use typed contracts at boundaries. Prefer Pydantic models for external/data contracts when appropriate and ordinary Python protocols/interfaces for application ports when that provides a cleaner dependency boundary. Do not introduce Pydantic solely to satisfy a pattern.
Test both behavior and dependency wiring:
What SKILL.md sets; muted values are Claude Code's defaults
Generated from the plugin's indexed repository (evgenygurin/fastmcp-engineering) — no native marketplace selected
npx claudepluginhub p/evgenygurin-fastmcp-engineering58 skills in this plugin
/pydantic-ai-agent-integrationEngineer PydanticAI agents behind explicit application boundaries and integrate them with FastMCP without leaking agent state, prompts, model concerns, or provider details into domain logic./api-contract-schema-engineeringEvidence-first API and MCP contract engineering with Pydantic v2 and JSON Schema./api-lifecycle-versioningEvidence-first API lifecycle, schema evolution and compatibility engineering for FastMCP/MCP servers.Other plugins' skills for the same job