python-sdk icon indicating copy to clipboard operation
python-sdk copied to clipboard

dynamic resource not working in Claude desktop

Open Nriver opened this issue 9 months ago • 22 comments

Describe the bug A clear and concise description of what the bug is.

To Reproduce use the demo server in quick start document

# server.py
from mcp.server.fastmcp import FastMCP

# Create an MCP server
mcp = FastMCP("Demo")

@mcp.resource("config://app")
def get_config() -> str:
    """Static configuration data"""
    return "App configuration here"

# dynamic resource
@mcp.resource("greeting://{name}")
def get_greeting(name: str) -> str:
    """Get a personalized greeting"""
    return f"Hello, {name}!"

Claude can not see the dynamic resource, only the static one works.

Expected behavior Use dynamic resource in Claude

Screenshots

Image

Desktop (please complete the following information):

  • OS: windows 10

Nriver avatar Mar 12 '25 03:03 Nriver

Yes, sadly Claude Desktop does currently not support dyanmic resources.

dsp-ant avatar Mar 13 '25 14:03 dsp-ant

Do you know which application can work with dynamic resources? I want to test it with my mcp server.

Nriver avatar Mar 13 '25 15:03 Nriver

Not work in MacOS, too, I try bunch of time.....

btcsing avatar Mar 14 '25 09:03 btcsing

Maybe a note should be added in the "Notes" of the "Feature support matrix" for Claude Desktop, spent a bunch of time wondering what was wrong.

serranoarevalo avatar Mar 16 '25 11:03 serranoarevalo

Claude calls resources/list which is for static resources. But dynamic resources are called at resources/templates/list -- which it seems based on logs Claude does not call on.

This can be seen in the MCP Inspector > Resources tab at top

WSJUSA avatar Mar 17 '25 13:03 WSJUSA

Can we prioritise this please.. need to experiment few things with resources.. currently blocked on this

raolak avatar Mar 24 '25 02:03 raolak

I've spent more than a day trying to make it work. This is a major disappointment.

shlomi-schwartz avatar Mar 26 '25 17:03 shlomi-schwartz

I thought I did something wrong..

jingcheng-chen avatar Mar 26 '25 21:03 jingcheng-chen

+1, spent a bunch of time testing my MCP, only to discover it is not yet supported ...

spin avatar Apr 13 '25 03:04 spin

+1. It isnt showing up in the inspector either

HoaX7 avatar Apr 17 '25 13:04 HoaX7

I successfully made it work in the inspector, but unfortunately couldn't get it working in Claude Desktop. The same approach doesn't seem to function properly in the desktop app.

qlmmlp avatar Apr 19 '25 14:04 qlmmlp

You might have got it working for static resources .. not dynamic resources .. without resources mcp tooling feels incomplete . Please do let me know if it’s working for you. I will give it a try .

On Sat, 19 Apr 2025 at 7:34 PM, Anton Sakharov @.***> wrote:

I successfully made it work in the inspector, but unfortunately couldn't get it working in Claude Desktop. The same approach doesn't seem to function properly in the desktop app.

— Reply to this email directly, view it on GitHub https://github.com/modelcontextprotocol/python-sdk/issues/263#issuecomment-2816720861, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGPZOJMOJP462PSO2547PD22JJYNAVCNFSM6AAAAABY2PLXM2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJWG4ZDAOBWGE . You are receiving this because you commented.Message ID: @.***> qlmmlp left a comment (modelcontextprotocol/python-sdk#263) https://github.com/modelcontextprotocol/python-sdk/issues/263#issuecomment-2816720861

I successfully made it work in the inspector, but unfortunately couldn't get it working in Claude Desktop. The same approach doesn't seem to function properly in the desktop app.

— Reply to this email directly, view it on GitHub https://github.com/modelcontextprotocol/python-sdk/issues/263#issuecomment-2816720861, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGPZOJMOJP462PSO2547PD22JJYNAVCNFSM6AAAAABY2PLXM2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQMJWG4ZDAOBWGE . You are receiving this because you commented.Message ID: @.***>

raolak avatar Apr 19 '25 16:04 raolak

I am also having the same issue. Can you guys make it quick ?

HRS0986 avatar May 05 '25 19:05 HRS0986

Me too, also the inspector doesn't support adding template params

yonidavidson avatar May 10 '25 19:05 yonidavidson

in puppeteer the snapshot is exposed to claude desktop as an image resource (correct?) ... so somehow they are doing it correctly there ?

ruilacerda avatar May 21 '25 12:05 ruilacerda

Image it doesn't work, tried many times

2noScript avatar May 24 '25 01:05 2noScript

yeah, meatime I read more on it and looks like resources aren't support in claude desktop in windows at least (although in the Feature support matrix it suposedly suports). But I found one of the thing I was looking into, the correct way to deliver image to the mcp client (I am sure it is also how they are doing in puppeteer) below in python for example a take_screenshot, adapted from example in github examples

@mcp.tool()
def read_screen():
    """
    Take a screenshot of the user's screen and return it as an image. Use
    this tool anytime the user wants you to look at something they're doing.
    """
    
    logger.info("Taking screenshot")
    
    try:
        
        buffer = io.BytesIO()
        
        # if the file exceeds ~1MB, it will be rejected by Claude
        screenshot = pyautogui.screenshot()
        screenshot.convert("RGB").save(buffer, format="JPEG", quality=60, optimize=True)
        buffer.seek(0)
        
        logger.info("Screenshot captured successfully")
        return Image(data=buffer.getvalue(), format="jpeg")
    
    except Exception as e:
        logger.error(f"Error taking screenshot: {str(e)}")
        raise Exception(f"Failed to take screenshot: {str(e)}")

ruilacerda avatar May 24 '25 15:05 ruilacerda

yeah, meatime I read more on it and looks like resources aren't support in claude desktop in windows at least (although in the Feature support matrix it suposedly suports). But I found one of the thing I was looking into, the correct way to deliver image to the mcp client (I am sure it is also how they are doing in puppeteer) below in python for example a take_screenshot, adapted from example in github examples

@mcp.tool()
def read_screen():
    """
    Take a screenshot of the user's screen and return it as an image. Use
    this tool anytime the user wants you to look at something they're doing.
    """
    
    logger.info("Taking screenshot")
    
    try:
        
        buffer = io.BytesIO()
        
        # if the file exceeds ~1MB, it will be rejected by Claude
        screenshot = pyautogui.screenshot()
        screenshot.convert("RGB").save(buffer, format="JPEG", quality=60, optimize=True)
        buffer.seek(0)
        
        logger.info("Screenshot captured successfully")
        return Image(data=buffer.getvalue(), format="jpeg")
    
    except Exception as e:
        logger.error(f"Error taking screenshot: {str(e)}")
        raise Exception(f"Failed to take screenshot: {str(e)}")

@ruilacerda what is exactly the type/package of Image that your are using? tried to use ktinker/PIL but seems like Claude coulndt handle the object

ofekfell avatar Jun 09 '25 14:06 ofekfell

Hi everyone,

If you can get Claude Desktop to work with static resources, could you please help me with this issue of MCP resources Any help would be appreciated.

Thank you so much

terrynguyen255 avatar Jun 24 '25 14:06 terrynguyen255

Ping on this. Can we prioritize this? Without dynamic MCP resources, claude code is less useful.

shouhengyi avatar Jul 21 '25 23:07 shouhengyi

This is not a Python SDK issue. Unfortunately, there is no Claude Desktop repo for requests such as these. Any chance that's coming @felixrieseberg ?

Also: resources in Claude Desktop

  • https://github.com/modelcontextprotocol/python-sdk/issues/92
  • https://github.com/modelcontextprotocol/python-sdk/issues/1016

(The Claude Code repo has issues related to Resources, list-changed notifications, and Resource Templates.)

richardkmichael avatar Jul 21 '25 23:07 richardkmichael

Do you know which application can work with dynamic resources? I want to test it with my mcp server.

GitHub CoPilot in VS Code supports resource templates. Still not in Claude Desktop - just tried it.

pkillick-airiq avatar Nov 29 '25 16:11 pkillick-airiq