workflows/workflows/agent-environment-setup/platforms/copilot/skills/mcp-server-builder/SKILL.md
Use when building MCP servers with spec-compliant tools, structured outputs, resource providers, transport configuration, and server testing.
npx skillsauth add cubetiq/cubis-foundry mcp-server-builderInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Guide the design and implementation of production-grade Model Context Protocol (MCP) servers covering protocol specification compliance, tool registration with JSON Schema input validation and structured output, resource providers for dynamic context injection, transport layer selection and configuration (stdio, streamable HTTP, SSE), prompt template authoring, and comprehensive server testing with mock clients.
Read the MCP specification before designing your server because the protocol defines strict message formats, capability negotiation, and lifecycle semantics that non-compliant servers violate silently, causing agent failures.
Choose the transport layer based on deployment context because stdio is simplest for local CLI tools, streamable HTTP enables remote multi-tenant access, and SSE provides server-push for long-running operations. Each has different authentication and scaling characteristics.
Register tools with descriptive names, clear descriptions, and JSON Schema input validation because AI agents select and invoke tools based on their descriptions, and schema validation prevents malformed inputs from reaching your handler logic.
Use action-oriented tool names that describe what the tool does, not what it is because agents match user intent to tool names, and names like search-issues are more discoverable than issue-manager or github-tool.
Return structured output from tools with consistent field naming because agents parse tool results to continue reasoning, and inconsistent or unstructured output forces the agent to guess the result format.
Mark destructive tools explicitly in their description because agents must distinguish read-only operations from operations that modify state, and clear labeling prevents accidental mutations during exploratory reasoning.
Implement resource providers for data that agents need as context but should not modify because resources are read-only context (files, database schemas, documentation) that agents reference during reasoning, distinct from tools that perform actions.
Use URI templates for resource providers that serve parameterized content because URI templates let agents request specific resources (e.g., file:///path/{filename}) without the server enumerating every possible resource upfront.
Author prompt templates for multi-step workflows because prompts encode expert knowledge about how to use the server's tools and resources together, reducing the number of trial-and-error tool calls an agent needs.
Implement capability negotiation in the server's initialize response because clients use the capabilities object to discover which features the server supports, and missing capabilities cause clients to skip available tools or resources.
Handle request cancellation and progress reporting for long-running tools because agents and users expect responsiveness, and tools that block without progress updates appear frozen. Use the protocol's progress notification mechanism.
Validate all tool inputs against the declared JSON Schema before processing because schema declarations are advisory to some clients, and server-side validation is the only guarantee against malformed inputs reaching business logic.
Log every tool invocation with input, output, duration, and error details because MCP servers are called by autonomous agents, and debugging agent failures requires a complete audit trail of tool interactions.
Write integration tests using a mock MCP client that exercises the full protocol lifecycle because unit tests on handler functions miss protocol-level issues like capability negotiation failures, transport serialization bugs, and lifecycle ordering problems.
Test error handling paths with malformed inputs, timeouts, and resource unavailability because agents retry failed tool calls, and servers that crash or hang on errors cause agent loops. Return structured error responses with actionable messages.
Version your server and tools to support backward-compatible evolution because deployed agents depend on specific tool signatures, and breaking changes without versioning cause silent failures across all connected clients.
## Server Architecture
[Transport choice, tool/resource/prompt inventory, capability matrix]
## Tool Implementation
[Registration code, input schema, handler logic, structured output]
## Resource Providers
[URI templates, content generation, caching strategy]
## Testing
[Mock client setup, protocol compliance checks, integration test suite]
| File | Load when |
| ----------------------------------- | ----------------------------------------------------------------------------------------- |
| references/tool-design-patterns.md | Understanding MCP tool contracts, schema design, output shape, or resource-oriented server structure. |
| references/transport-configuration.md | Choosing or configuring stdio, HTTP, or SSE transport layers. |
| references/testing-mcp-servers.md | Writing mock client tests, protocol compliance checks, or integration tests. |
tools
Use when investigating latest vendor behavior, comparing tools or platforms, verifying claims beyond the repo, or gathering external evidence before implementation.
documentation
Use when designing database schemas, normalization strategies, indexing plans, query optimization, and migration workflows for relational, document, or hybrid data stores.
development
Use when writing, reviewing, or refactoring modern C#/.NET code, including minimal APIs, records, async streams, pattern matching, DI lifetimes, and memory-efficient performance tuning.
development
Use when conducting code reviews, building review checklists, calibrating review depth, providing structured feedback, or establishing team review practices. Covers review methodology, feedback patterns, automated checks, and batch review strategies.