Skip to main content

Prompts Overview

Prompts are reusable message templates that you can attach to your MCP servers. They allow you to define structured conversations with arguments (variables) that get filled in at runtime.

What are Prompts?

MCP Prompts provide a standardized way to expose prompt templates to AI clients. When an MCP client (like Claude, Cursor, or Windsurf) connects to your server, it can discover available prompts and let users invoke them.

Key Features

  • Reusable Templates: Create prompts once, use them across multiple servers
  • Variable Arguments: Define placeholders like {{code}} that get filled in when the prompt is used
  • Multiple Message Types: Include text, resources, or images in your prompt messages
  • Role-based Messages: Structure conversations with user and assistant messages

Creating a Prompt

  1. Navigate to Prompts in the sidebar
  2. Click New Prompt
  3. Fill in the basic information:
    • Name: A unique identifier (letters, numbers, underscores only)
    • Title: Human-readable display name
    • Description: What the prompt does

Adding Arguments

Arguments are variables that users provide when invoking the prompt. For example, a code review prompt might have a code argument.

  1. In the Arguments section, click Add Argument
  2. Enter the argument name (e.g., code)
  3. Add an optional description
  4. Check "Required" if the argument must be provided

Adding Messages

Messages define the actual prompt content. Each message has a role (user or assistant) and content.

  1. In the Messages section, click Add Message
  2. Select the role (User or Assistant)
  3. Choose the content type:
    • Text: Plain text with optional variable placeholders
    • Resource: Reference to an existing resource
    • Image: Upload an image file

Using Variables in Text

Reference arguments in your text using double curly braces:

Please review this code:

{{code}}

Focus on:
- Code quality
- Potential bugs
- Performance improvements

Message Content Types

Text Messages

The most common type. Enter plain text and use {{argument_name}} to insert variable values.

Resource Messages

Reference existing resources (files, text, or connected services). You can choose to:

  • Embed content: Include the full resource content in the prompt
  • Link only: Send just a reference to the resource

Image Messages

Include images in your prompts. Supported formats:

  • PNG
  • JPEG
  • GIF
  • WebP

Maximum file size: 100 MB

See Image Messages for more details.

Linking Prompts to Servers

After creating a prompt, you can link it to one or more servers:

  1. Open the prompt details
  2. In the Linked Servers section, click Add to Servers
  3. Select the servers you want to add the prompt to
  4. The prompt will now be available when MCP clients connect to those servers

How MCP Clients Use Prompts

When an MCP client connects to your server:

  1. It calls prompts/list to discover available prompts
  2. The user can see prompts with their titles, descriptions, and required arguments
  3. When a prompt is selected, the client calls prompts/get with any required arguments
  4. Your server returns the interpolated messages with variables replaced

Example: Code Review Prompt

Name: code_review Title: Request Code Review Description: Asks the LLM to analyze code quality and suggest improvements

Arguments:

NameDescriptionRequired
codeThe code to reviewYes
languageProgramming languageNo

Messages:

  1. User message (text):
    Please review the following {{language}} code:

    {{code}}

    Provide feedback on:
    - Code quality and style
    - Potential bugs or issues
    - Performance considerations
    - Suggestions for improvement

When invoked with code="def hello(): print('world')" and language="Python", the message becomes:

Please review the following Python code:

def hello(): print('world')

Provide feedback on:
- Code quality and style
- Potential bugs or issues
- Performance considerations
- Suggestions for improvement