# Add MCP prompt support to agent threads \(\#43523\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/4896f477e2353fa5f6eaf01642533e7f7bd56384)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 4896f477e2353fa5f6eaf01642533e7f7bd56384

Requested commit: 4896f477e2353fa5f6eaf01642533e7f7bd56384

Commit: 4896f477e2353fa5f6eaf01642533e7f7bd56384

Tree: 6062455602b7a0a75cf5d0bfce09eadb4aa02289

Author: max

Committer: GitHub

## Message

```
Add MCP prompt support to agent threads (#43523)

Fixes #43165

## Problem
MCP prompts were only available in text threads, not agent threads.
Users with MCP servers that expose prompts couldn't use them in the main
agent panel.

## Solution
Added MCP prompt support to agent threads by:
- Creating `ContextServerPromptRegistry` to track MCP prompts from
context servers
- Subscribing to context server events to reload prompts when MCP
servers start/stop
- Converting MCP prompts to available commands that appear in the slash
command menu
- Integrating prompt expansion into the agent message flow

## Testing
Tested with a custom MCP server exposing `explain-code` and
`write-tests` prompts. Prompts now appear in the `/` slash command menu
in agent threads.

Release Notes:

- Added MCP prompt support to agent threads. Prompts from MCP servers
now appear in the slash command menu when typing `/` in agent threads.

---------

Co-authored-by: Agus Zubiaga <agus@zed.dev>
```

## Parents

- [d07818b20fa9fbc24c906d0c81ffbe89cd4cd471](https://git.cafe/gitcafe/zed/commit/d07818b20fa9fbc24c906d0c81ffbe89cd4cd471?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/4896f477e2353fa5f6eaf01642533e7f7bd56384?format=markdown)
