Skip to content
Skills Library
AI & agents · Tool integration

mcp-agent-patterns

/mcp-agent-patterns

Use when integrating or optimizing Model Context Protocol (MCP) servers and clients. Keywords: MCP, Model Context Protocol, tool discovery, lazy loading, sampling, resource subscription, MCP server.

Licence
Apache-2.0
Last repository change
24.10.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
2
Deprecation

No signals detected. Repository changed on 24.10.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Use when integrating or optimizing Model Context Protocol (MCP) servers and clients. Keywords: MCP, Model Context Protocol, tool discovery, lazy loading, sampling, resource subscription, MCP server.

Original author description

Use when integrating or optimizing Model Context Protocol (MCP) servers and clients. Keywords: MCP, Model Context Protocol, tool discovery, lazy loading, sampling, resource subscription, MCP server.

How it works

  1. Overview
  2. When To Use
  3. Core MCP Concepts
  4. Advanced Patterns
  5. Security Considerations
  6. Quality Gates
  7. MCP 2.0 Features (2025-2026)
  8. References
Original SKILL.md headings · 61 lines, 503 words
SKILL.md preview
---
name: "mcp-agent-patterns"
description: >-
  Use when integrating or optimizing Model Context Protocol (MCP) servers and clients. Keywords: MCP, Model Context Protocol, tool discovery, lazy loading, sampling, resource subscription, MCP server.
---
# MCP Agent Patterns (Model Context Protocol)

## Overview
The Model Context Protocol (MCP) provides a standardized way for AI agents to interact with external tools, data resources, and environments. This skill defines architectural patterns and implementation best practices for building, connecting, and optimizing MCP-based systems within the KILO-KIT ecosystem.

## When To Use
- Implementing custom MCP servers or clients.
- Integrating external services (APIs, DBs, filesystems) as MCP servers.
- Optimizing context windows when dealing with large tool catalogs.
- Implementing real-time resource synchronization or complex multi-server orchestrations.
- Security-critical integrations requiring isolated execution environments.

## Core MCP Concepts
- **Tools**: Executable functions exposed to the LLM.
- **Resources**: Data sources that can be read by the LLM (e.g., file contents, database records).
- **Prompts**: Reusable templates or workflows designed to be used by the LLM.
- **Sampling**: A protocol allowing an MCP server to request the host client to perform LLM inference on its behalf, enabling agentic tool behavior.

## Advanced Patterns

### Dynamic Tool Catalog & Progressive Loading
To prevent token bloat:
1. **Manifest Exposure**: Expose only essential, high-level tool definitions initially.
2. **On-Demand Loading**: Load detailed JSON Schemas only when a tool is selected or explicitly requested by the agent context.

### MCP Sampling Protocol
When a server needs LLM intelligence (e.g., parsing unstructured output or making a decision):
- The server issues a `sampling/createMessage` request to the client.
- The client acts as the host/gateway, maintaining control over the model selection and cost.

### Resource Streaming & Subscriptions
- Use **URI Templates** (`res://server/type/{id}`) to create flexible resource paths.
- Implement **Resource Subscriptions** to push data updates from the server to the client without polling.

### Eager vs Lazy Tool Registration
- **Eager**: Best for small sets of essential core tools (zero-latency startup).
- **Lazy**: Mandatory for large or dynamic catalogs to keep initial prompts lean.

### Multi-Server Orchestration
- **Namespace Routing**: Prefix tool names with server aliases (`serverA:toolX`).
- **Conflict Resolution**: Implement a central router to handle collisions between tools of the same name across different servers.

## Security Considerations
- **Server Sandboxing**: Run MCP servers in isolated containers or limited-permission processes.
- **Credential Isolation**: Inject sensitive environment variables (API keys, tokens) only into the specific server process that requires them. Use a secure configuration store (e.g., HashiCorp Vault) for production deployments.

## Quality Gates
- **Contract Verification**: Ensure MCP server implementations conform to the JSON-RPC message schema.
- **Context Hygiene**: Verify that only relevant tools/resources are included in the prompt; prune dormant subscriptions.
- **Error Handling**: Standardize error codes for common failures (e.g., timeout, auth denied, connection lost).

## MCP 2.0 Features (2025-2026)
- **OAuth 2.0 Auth**: Native support for delegated access without sharing long-lived keys.
- **Elicitation API**: Interactive flow where the client helps the user provide missing inputs for a tool call.
- **Structured Tool Results**: Formalized response types beyond simple strings (e.g., rich content types, UI components).

## References
- [MCP Official Documentation](https://modelcontextprotocol.io)
- [JSON-RPC 2.0 Specification](https://www.jsonrpc.org/specification)
- [KILO-KIT MCP Integration Best Practices](docs/mcp-integration.md)

Versions

The database has no other skills named mcp-agent-patterns.

Database snapshot: 13.11.2026 · package version e8bf347695a2 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100mcp
    Use when implementing or integrating with the Model Context Protocol (MCP) for AI tool servers, resources, prompts, and context management. USE FOR: building MCP tool servers, exposing resources to agents, prompt templates, connecting agents to external APIs DO NOT USE FOR:…
  • 80MCP Integration
    This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context Protocol", "connect external service", mentions "${CLAUDE_PLUGIN_ROOT} with MCP", or discusses MCP server types (SSE, stdio, HTTP,…
  • 100ap2-mcp-server
    Implement AP2 MCP servers — payment tools exposed via Model Context Protocol for agent access to payment capabilities. Use when building MCP-based payment tool integrations for AP2.
  • 95go-mcp-server
    Best practices and patterns for building Model Context Protocol (MCP) servers in Go using the official github.com/modelcontextprotocol/go-sdk package. Triggers on: **/*.go, **/go.mod, **/go.sum
  • 100langchain4j-mcp-server-patterns
    Provides LangChain4j patterns for implementing MCP (Model Context Protocol) servers, creating Java AI tools, exposing tool calling capabilities, and integrating MCP clients with AI services. Use when building a Java MCP server, implementing tool calling in Java, connecting…
  • 100mcp
    Use when building or consuming Model Context Protocol (MCP) servers and clients in .NET. Covers tool registration, resource providers, prompt templates, transport configuration, and integration with Microsoft.Extensions.AI. USE FOR: building MCP tool servers, consuming MCP tools…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.