0Pricing
MCP Academy · Урок

Объяснение URI ресурсов

Узнайте, как адресовать ресурсы с помощью схемы и пути.

«Объяснение URI ресурсов» — бесплатный урок MCP Academy на CoddyKit. Это урок 1 из 4. Ты можешь прочитать весь урок бесплатно ниже — а потом практиковать его прямо в браузере с встроенным редактором кода и ИИ-репетитором 24/7. Это часть пути обучения MCP Academy, и твой прогресс синхронизируется между веб-версией и приложением CoddyKit. Курс MCP Academy содержит 4 уроков всего.

Части этого урока еще не переведены и отображаются на английском.

What a Resource Is

An MCP resource is read-only context your server hands the model, like a file, config, or record. The AI reads it, but never changes it.

Why an Address

Each resource needs a stable name so a client can ask for it by reference. That name is its URI, just like a web page has a URL. 🔗

Scheme Then Path

A resource URI is built from a scheme, then a colon and slashes, then a path. The scheme says what kind of thing the URI points to.

file:///notes/today.txt
config://app/settings

Pick Your Own Scheme

You are free to invent a scheme that fits your server, such as config or db. The scheme groups related resources under one clear label.

The file Scheme

The file scheme is common for documents on disk. Three slashes mean the path starts at the root, just like file URLs in a browser.

file:///home/data/report.md

Custom Scheme Example

For app data, a tidy custom scheme keeps things readable. The model sees a name that tells it exactly what the resource holds.

users://profile/active
weather://city/london

URIs Must Be Unique

Every resource needs its own distinct URI so requests are never ambiguous. Two resources sharing one URI would collide and confuse clients.

Declare It in FastMCP

In the Python SDK you attach a URI to a function with the resource decorator. That string is the address clients use to read it.

from mcp.server.fastmcp import FastMCP
mcp = FastMCP("Demo")

@mcp.resource("config://app")
def config(): ...

Clients List URIs

When a client connects, it asks the server to list every resource it offers. Each entry carries its URI, a name, and a short description.

Read by URI

To fetch content, the client sends a read request naming the exact URI. The server matches that URI to a handler and returns the body.

Keep URIs Stable

Treat a published URI like a promise. Renaming it later breaks any client or saved reference that pointed at the old address.

Quick Check

Spot the part that defines the resource type.

Recap

Resources are read-only context named by a URI: a scheme plus a path. Keep URIs unique and stable so clients can rely on them. ✅

Часто задаваемые вопросы

Урок «Объяснение URI ресурсов» бесплатный?

Да — полный текст урока «Объяснение URI ресурсов» бесплатно доступен здесь в веб-версии. Чтобы практиковать его интерактивно (встроенный редактор кода и ИИ-репетитор 24/7) и разблокировать остальной курс MCP Academy, подпишись на CoddyKit PRO. Курс MCP Academy содержит 4 уроков всего.

Чему я научусь в уроке «Объяснение URI ресурсов»?

Узнайте, как адресовать ресурсы с помощью схемы и пути. Ты практикуешь MCP Academy с помощью реального кода, который запускаешь прямо в браузере, и ИИ-репетитор 24/7 отвечает на твои вопросы во время урока.

Нужен ли мне опыт, чтобы начать MCP Academy?

Предыдущий опыт не требуется. MCP Academy на CoddyKit структурирован для всех уровней — от новичков до продвинутых, поэтому ты можешь начать отсюда или с самого начала и учиться в своем темпе. Это урок 1 из 4.

Сколько времени занимает урок «Объяснение URI ресурсов»?

Большинство уроков CoddyKit занимают около 5–10 минут. Каждый из них компактный и интерактивный, поэтому ты постоянно делаешь прогресс и продолжаешь с того же места в веб-версии и приложении.

Можно ли писать и запускать код в этом уроке MCP Academy?

Да. Каждый урок MCP Academy включает встроенный редактор кода, поэтому ты пишешь и запускаешь реальный код прямо в браузере и получаешь моментальную обратную связь от AI — локальная установка не требуется.

Все уроки этого курса

  1. Объяснение URI ресурсов
  2. Предоставление статического текстового ресурса
  3. Чтение файла с диска
  4. Выбор правильного типа MIME
← Назад к MCP Academy