Skip to content

Support mcp prompts #1010

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Support mcp prompts #1010

wants to merge 6 commits into from

Conversation

thoo
Copy link

@thoo thoo commented Jul 5, 2025

Summary

Add MCP prompt support to enable user-controlled agent instruction generation. This enhancement allows MCP servers to provide prompts that can be used to dynamically generate agent instructions, enabling more flexible and user-controlled agent behavior.

Key changes:

  • Added abstract list_prompts() and get_prompt() methods to base MCPServer class
  • Implemented prompt support in MCPServerStdio and MCPServerStreamableHttp classes
  • Added comprehensive test suite for prompt functionality
  • Created example MCP prompt server with working demonstration
  • Updated documentation with prompt usage examples

Note: This PR implements MCP prompt support only. Resource support is not included in this implementation.

Test plan

  • Unit tests: Added 11 comprehensive tests in tests/mcp/test_prompt_server.py covering:
    • Prompt listing and retrieval
    • Argument formatting and validation
    • Agent integration with prompt-generated instructions
    • Streaming and non-streaming scenarios
    • Error handling for missing prompts
  • Integration tests: Updated existing MCP test suite to handle new abstract methods
  • Example verification: Created working example with MCP prompt server and client
  • All tests pass: 450/450 tests passing after adding optional dependencies

Issue number

Partially addresses #544 (prompts only, resources not implemented)

Checks

  • I've added new tests (if relevant)
  • I've added/updated the relevant documentation
  • I've run make lint and make format
  • I've made sure tests pass

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

Successfully merging this pull request may close these issues.

1 participant