Skip to content

Prompt not visible in Claude Desktop #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
RYanamandra-ctm opened this issue May 6, 2025 · 3 comments
Open

Prompt not visible in Claude Desktop #389

RYanamandra-ctm opened this issue May 6, 2025 · 3 comments

Comments

@RYanamandra-ctm
Copy link

Describe the bug
I'm trying to create a prompt, but I don't see it when I test the Stdio server with Desktop Claude. This is similar to #186

To Reproduce
`[McpServerPromptType]
public static class MyPrompts
{
[McpServerPrompt, Description("Creates a prompt to summarize the provided message.")]
public static ChatMessage Summarize([Description("The content to summarize")] string content) =>
new(ChatRole.User, $"Please summarize this content into a single sentence: {content}");

}`

Expected behavior
Be able to see and use the prompt in Claude Desktop.

Logs
If applicable, add logs to help explain your problem.

Additional context

  • I'm using the latest nuget package. <PackageReference Include="ModelContextProtocol" Version="0.1.0-preview.12" />
@RYanamandra-ctm RYanamandra-ctm added the bug Something isn't working label May 6, 2025
@stephentoub
Copy link
Contributor

Can you share a complete repro? How are you loading in MyPrompts?

@stephentoub stephentoub removed the bug Something isn't working label May 6, 2025
@RYanamandra-ctm
Copy link
Author

I'm loading it using builder.Services .AddMcpServer() .WithStdioServerTransport() .WithPromptsFromAssembly() .WithToolsFromAssembly();

var builder = Host.CreateApplicationBuilder();

builder.Services
.AddMcpServer()
.WithStdioServerTransport()
.WithPromptsFromAssembly()
.WithToolsFromAssembly();

builder.Services.AddSingleton<ILogger>(sp => sp.GetRequiredService<ILogger<Program>>());

var app = builder.Build();

await app.RunAsync();

[McpServerPromptType]
public static class MyPrompts
{
  [McpServerPrompt, Description("Creates a prompt to summarize the provided message.")]
  public static ChatMessage Summarize([Description("The content to summarize")] string content) =>
    new(ChatRole.User, $"Please summarize this content into a single sentence: {content}");
}
<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net9.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0-preview.3.25171.5" />
        <PackageReference Include="Microsoft.Extensions.Http" Version="9.0.4" />
        <PackageReference Include="ModelContextProtocol" Version="0.1.0-preview.12"/>
    </ItemGroup>
</Project>

@stephentoub
Copy link
Contributor

I've not tried your repro, but just from glancing at it, I expect you're logging to stdout, which is going to interfere with this using a stdio transport. As in the README, try adding:

builder.Logging.AddConsole(consoleLogOptions =>
{
    // Configure all logs to go to stderr
    consoleLogOptions.LogToStandardErrorThreshold = LogLevel.Trace;
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants