Warum enthüllt MCP Server meine Ressourcen nicht?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Warum enthüllt MCP Server meine Ressourcen nicht?

by Anonymous » 04 Sep 2025, 23:27

Hier ist der MCP-Code, den ich habe: < /p>

Code: Select all

from mcp.server.fastmcp import FastMCP

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

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

@mcp.resource("file://data/file.txt")
def read_file_txt() -> str:
"""Read contents of file.txt from data directory"""
try:
with open('/tmp/file.txt', "r") as f:
return f.read()
except Exception as e:
return f"Error reading file: {str(e)}"
#

@mcp.prompt()
def greet_user_prompt(name: str) -> str:
"""Generates a message asking for a greeting"""
return f"""
Return a greeting message for a user called '{name}'.
if the user is called 'Laurent', use a formal style, else use a street style.
"""
Ich habe diesen MCP -Server in Claude Desktop installiert. get_greeting Ressource, in einer ganzen Reihe von Tutorials erwähnt. ist nicht sichtbar. />

Top