[Bug] MCP Prompt Server doesn't receive extra arguments from cli #7036

Open
opened 2026-02-16 18:05:58 -05:00 by yindo · 2 comments
Owner

Originally created by @not94 on GitHub (Jan 21, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

I just ran a simple mcp server from local and install it on opencode.

Here is my mcp code:

from mcp.server.fastmcp import FastMCP

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


# Add an addition tool
@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two numbers"""
    return a + b


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


# Add a prompt
@mcp.prompt()
def greet_user(name: str, style: str) -> str:
    """Generate a greeting prompt"""
    styles = {
        "friendly": "Please write a warm, friendly greeting",
        "formal": "Please write a formal, professional greeting",
        "casual": "Please write a casual, relaxed greeting",
    }

    return f"{styles.get(style, styles['friendly'])} for someone named {name}."

But when I pass multiple arguments into command line, the server just receive name argument but not style argument:

# local_test is my mcp server name
/local_test:greet_user 123 formal

Please write a warm, friendly greeting for someone named 123 formal.

I have checked mcp prompt implementation https://github.com/anomalyco/opencode/pull/5767, but didn't find any issues.

Plugins

No response

OpenCode version

1.1.20

Steps to reproduce

See the description.

Screenshot and/or share link

No response

Operating System

No response

Terminal

ITerm2

Originally created by @not94 on GitHub (Jan 21, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description I just ran a simple mcp server from local and install it on opencode. Here is my mcp code: ```python from mcp.server.fastmcp import FastMCP # Create an MCP server mcp = FastMCP("Demo") # Add an addition tool @mcp.tool() def add(a: int, b: int) -> int: """Add two numbers""" return a + b # Add a dynamic greeting resource @mcp.resource("greeting://{name}") def get_greeting(name: str) -> str: """Get a personalized greeting""" return f"Hello, {name}!" # Add a prompt @mcp.prompt() def greet_user(name: str, style: str) -> str: """Generate a greeting prompt""" styles = { "friendly": "Please write a warm, friendly greeting", "formal": "Please write a formal, professional greeting", "casual": "Please write a casual, relaxed greeting", } return f"{styles.get(style, styles['friendly'])} for someone named {name}." ``` But when I pass multiple arguments into command line, the server just receive name argument but not style argument: ``` # local_test is my mcp server name /local_test:greet_user 123 formal Please write a warm, friendly greeting for someone named 123 formal. ``` I have checked mcp prompt implementation https://github.com/anomalyco/opencode/pull/5767, but didn't find any issues. ### Plugins _No response_ ### OpenCode version 1.1.20 ### Steps to reproduce See the description. ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal ITerm2
yindo added the bug label 2026-02-16 18:05:58 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 21, 2026):

This issue might be a duplicate of existing issues or related to known argument parsing problems. Please check:

  • #3272: Slash command accepts arguments - Feature request for argument passing in commands/prompts
  • #2226: Named arguments for command parsed from $ARGUMENTS - Explores better argument handling for commands
  • #7749: /editor command fails when VISUAL contains arguments with spaces/quotes - Similar issue with argument parsing

The root cause appears to be related to how command-line arguments are parsed and passed to MCP prompts. Feel free to ignore if your specific case is different from these issues.

@github-actions[bot] commented on GitHub (Jan 21, 2026): This issue might be a duplicate of existing issues or related to known argument parsing problems. Please check: - #3272: Slash command accepts arguments - Feature request for argument passing in commands/prompts - #2226: Named arguments for command parsed from `$ARGUMENTS` - Explores better argument handling for commands - #7749: /editor command fails when VISUAL contains arguments with spaces/quotes - Similar issue with argument parsing The root cause appears to be related to how command-line arguments are parsed and passed to MCP prompts. Feel free to ignore if your specific case is different from these issues.
Author
Owner

@jbeers commented on GitHub (Jan 22, 2026):

I have a similar issue using both 1.1.28 and 1.1.32.

I am not getting back any arguments though. I'm getting back their literal placeholders.

{
    "method": "prompts/get",
    "params": {
        "name": "tellJoke",
        "arguments": {
            "cats": "$1"
        }
    },
    "jsonrpc": "2.0",
    "id": 5
}
@jbeers commented on GitHub (Jan 22, 2026): I have a similar issue using both `1.1.28` and `1.1.32`. I am not getting back any arguments though. I'm getting back their literal placeholders. ``` { "method": "prompts/get", "params": { "name": "tellJoke", "arguments": { "cats": "$1" } }, "jsonrpc": "2.0", "id": 5 } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7036