Skip to content

Using Context in resource definitions results in inccorect resource template classification #1635

Description

@aarondiel

Initial Checks

Description

expected behaivor / actual behavior

looking at the provided sample code i would assume current_time would show up as a regular resource, because it needs no arguments from the llm / user.

however, is is only being listed as a resource template and cannot be invoked via the inspector.

Image

Example Code

from contextlib import asynccontextmanager
from mcp import ServerSession
from mcp.server import FastMCP
from mcp.server.fastmcp import Context

class AppContext:
    pass

@asynccontextmanager
async def lifespan(server: FastMCP):
    yield AppContext()

mcp = FastMCP("Demo", lifespan=lifespan)

@mcp.resource("time://current")
async def current_time(ctx: Context[ServerSession, AppContext]):
    return "11:41"

Python & MCP Python SDK

`uv run python` shows `3.13.8`
`uv pip freeze` shows `mcp==1.21.1`

Activity

  1. added
    bugSomething isn't working
    ready for workEnough information for someone to start working on
    P2Moderate issues affecting some users, edge cases, potentially valuable feature
    on Nov 16, 2025
  2. added 3 commits that reference this issue on Mar 2, 2026
    1eb9fb3
    9c807f7
    84c98ef
  3. maxisbey commented on Mar 5, 2026

    @maxisbey
    Contributor

    Closing as duplicate of #1405, which is tracking the same bug (older issue).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Moderate issues affecting some users, edge cases, potentially valuable featurebugSomething isn't workingready for workEnough information for someone to start working on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions