Introduce ReadResourceContents type to properly handle MIME types in resource responses. Breaking change in FastMCP read_resource() return type.
Github-Issue:#152
The server was ignoring mime types set on resources, defaulting to text/plain
for strings and application/octet-stream for bytes. Now properly preserves
the specified mime type in both FastMCP and low-level server implementations.
Note that this is breaks backwards compatibility as it changes the return
values of read_resource() on FastMCP. It is BC compatible on lowlevel since
it only extends the callback.
Github-Issue: #152
Reported-by: eiseleMichael
During `mcp install` we are generating a config
that relies on `mcp run`. However `mcp` is only available
as a CLI command if we use the `cli` feature.
We need to specify that we want to install mcp
with the cli feature.
Fixes#128
Backport of #116 by @allenporter to v1.1.x branch.
Fixes an issue where exception handling code fails with AttributeError
when accessing the error field of McpError.
Pydantic treats fields starting with underscore as private/hidden. To fix this,
we need to use Field with alias='_meta' to properly handle these fields while
keeping the external API unchanged. This fixes#103 where meta fields were not
being properly assigned in request contexts.
This commit integrates FastMCP, a high-level MCP server implementation originally written by Jeremiah Lowin,
into the official MCP SDK. It also updates dependencies and adds new dev dependencies.
It moves the existing SDK into a .lowlevel .
We missed to have a handler for resource templates. We add this
now. One caveat is still that the `uriTemplate` in `ResourceTemplate`
is not a pydantic type.
Add methods to track and verify client capabilities during initialization. This
includes storing client parameters from the initialize request and providing a
check_client_capability method to verify if specific capabilities are supported
by the connected client.
We currently return a generic instance of RequestContext without
a specialization on the Session type. This makes it impossible
for servers to typesafe call `list_roots()` and other methods.
We now return a specific instance of `RequestContext[ServerSession]`