Przejdź do treści
Biblioteka skilli
Programowanie · Nauka i wyjaśnianie

mcp-patterns

/mcp-patterns

Wczytuje wzorce i dobre praktyki tworzenia narzędzi MCP z @umbraco-cms/mcp-server-sdk, przydatne na starcie prac nad narzędziami lub jako ściąga ze wzorców.

Licencja
MIT
Ostatnia zmiana repozytorium
21.10.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
2
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 21.10.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Wczytuje wzorce i dobre praktyki tworzenia narzędzi MCP z @umbraco-cms/mcp-server-sdk, przydatne na starcie prac nad narzędziami lub jako ściąga ze wzorców.

Oryginalny opis (EN)

Load MCP development patterns and best practices for building tools with the @umbraco-cms/mcp-server-sdk. Use when starting tool development or needing pattern reference.

Jak działa

  1. When to Use
  2. Core Architecture
  3. Helper Functions
  4. Slices (Tool Categorization)
  5. Annotations Reference
  6. Schema Flattening for Nested Reference Objects
  7. Project Structure
  8. Orval Code Generation
  9. Best Practices
Sekcje z nagłówków SKILL.md, w oryginale · 154 linii, 566 słów
Podgląd SKILL.md
---
name: mcp-patterns
description: Load MCP development patterns and best practices for building tools with the @umbraco-cms/mcp-server-sdk. Use when starting tool development or needing pattern reference.
---

# MCP Development Patterns

This skill loads comprehensive patterns for building MCP tools using the `@umbraco-cms/mcp-server-sdk`.

## When to Use

Use this skill when:
- Starting to create new MCP tools
- Needing a reference for tool patterns
- Understanding how to use the toolkit helpers
- Setting up a new MCP server project

## Core Architecture

### Tool Definition Pattern

All tools follow this structure:

```typescript
import {
  withStandardDecorators,
  executeGetApiCall,
  executeVoidApiCall,
  createToolResult,
  CAPTURE_RAW_HTTP_RESPONSE,
  ToolDefinition,
} from "@umbraco-cms/mcp-server-sdk";

const MyTool = {
  name: "tool-name",
  description: "What the tool does",
  inputSchema: zodSchema.shape,
  outputSchema: responseSchema,  // For GET operations
  slices: ["read"],              // Categorization
  annotations: {
    readOnlyHint: true,          // For GET
    destructiveHint: true,       // For DELETE
    idempotentHint: true,        // For PUT
  },
  handler: async (params) => {
    // Implementation
  },
} satisfies ToolDefinition<...>;

export default withStandardDecorators(MyTool);
```

### API Client Configuration

Configure once at server startup:

```typescript
import { configureApiClient } from "@umbraco-cms/mcp-server-sdk";
import { getMyAPI } from "./api/generated/myApi.js";

configureApiClient(() => getMyAPI());
```

## Helper Functions

### executeGetApiCall
For GET operations that return data:
```typescript
return executeGetApiCall<ReturnType<Client["method"]>, Client>(
  (client) => client.method(params, CAPTURE_RAW_HTTP_RESPONSE)
);
```

### executeVoidApiCall
For DELETE/PUT operations that return void:
```typescript
return executeVoidApiCall<Client>(
  (client) => client.deleteItem(id, CAPTURE_RAW_HTTP_RESPONSE)
);
```

### createToolResult / createToolResultError
For custom responses (typically CREATE operations):
```typescript
if (response.status === 201) {
  return createToolResult({ success: true, id: extractedId });
} else {
  return createToolResultError(response.data);
}
```

## Slices (Tool Categorization)

Tools are categorized by operation type:
- `read` - GET operations
- `create` - POST create operations
- `update` - PUT operations
- `delete` - DELETE operations
- `search` - Search/filter operations

## Annotations Reference

| Operation | readOnlyHint | destructiveHint | idempotentHint |
|-----------|--------------|-----------------|----------------|
| GET       | ✅           | ❌              | ❌             |
| DELETE    | ❌           | ✅              | ❌             |
| POST      | ❌           | ❌              | ❌             |
| PUT       | ❌           | ❌              | ✅             |

**Important**: DELETE is NOT idempotent (2nd call returns 404).

## Schema Flattening for Nested Reference Objects

Umbraco APIs wrap references to other entities in a nested object — most commonly
`parent: { id }` or `parent: { path }`. Never expose that shape to the LLM: accept a flat
scalar (`parentId`, `path`) and rebuild the nested object inside the handler. See
`references/schema-flattening.md` for the full pattern, the when-to-apply matrix, and the rules.

## Project Structure

```
src/
├── api/
│   ├── client.ts           # API client with mock support
│   ├── openapi.yaml        # OpenAPI spec
│   └── generated/          # Orval-generated client + Zod schemas
├── tools/
│   └── {entity}/
│       ├── get/
│       ├── post/
│       ├── put/
│       ├── delete/
│       └── index.ts        # Collection export
└── index.ts                # MCP server entry
```

## Orval Code Generation

Generate client and Zod schemas from OpenAPI:
```bash
npm run generate
```

Configuration in `orval.config.ts`:
- Generates TypeScript client (configurable via `client` option)
- Generates Zod schemas for validation
- Uses custom mutator for authentication

## Best Practices

1. **Use Zod schemas** from generated code for type safety
2. **Hide UUID generation** - create internally, don't expect LLM to provide
3. **Clear descriptions** - tools should be self-documenting
4. **Consistent naming** - follow `{action}-{entity}` pattern
5. **Error handling** - `withStandardDecorators` handles errors automatically
6. **Flatten nested reference objects** - accept `parentId` / `path`, rebuild `parent: { id }` /
   `parent: { path }` in the handler (see [Schema Flattening](#schema-flattening-for-nested-reference-objects) above, or `references/schema-flattening.md` for the full pattern)
Pliki w paczce (2)
  • SKILL.md 5 KB
  • references/schema-flattening.md 4 KB

Wersje

RepozytoriumWynikLicencja
Ta strona · umbraco/Umbraco-MCP-Base100MIT
yonatangross/orchestkit100MIT

Migawka bazy z 28.10.2026 · wersja paczki dc5be4a5f20c (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100mcp-testing
    Wczytuje wzorce testów ewaluacyjnych MCP z @umbraco-cms/mcp-server-sdk/evals, przydatne przy pisaniu testów akceptacyjnych narzędzi MCP opartych na LLM.
  • 100umb-cms-mcp-setup
    Instaluje i konfiguruje serwer MCP Umbraco w kliencie AI jako aktywne połączenie i rozwiązuje jego problemy.
  • 100umb-cms-dev-cli
    Prowadzi przez uruchamianie i debugowanie serwera MCP Umbraco z CLI: listę narzędzi, filtrowanie i tryb tylko do odczytu.
  • 100mcp-cli
    Prowadzi przez uruchamianie i debugowanie serwera MCP Umbraco z CLI: lista i wywołania narzędzi, filtrowanie, dry-run, tryb tylko do odczytu oraz diagnostyka konfiguracji.
  • 100mcp-cli
    Prowadzi przez uruchamianie i debugowanie serwera MCP Umbraco z CLI: lista i wywołania narzędzi, filtrowanie, dry-run, tryb tylko do odczytu oraz diagnostyka konfiguracji.
  • 81webflow-mcp:cms-best-practices
    Doradza w architekturze CMS Webflow: projektowanie kolekcji, relacji i struktury treści.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.