Skip to content

Commit ec025ce

Browse files
huixindaniel-lxs
authored andcommitted
add support for mcp server instructions
1 parent be2d83b commit ec025ce

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

src/core/prompts/sections/mcp-servers.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export async function getMcpServersSection(
3939
4040
return (
4141
`## ${server.name} (\`${config.command}${config.args && Array.isArray(config.args) ? ` ${config.args.join(" ")}` : ""}\`)` +
42+
(server.instructions ? `\n\n${server.instructions}` : "") +
4243
(tools ? `\n\n### Available Tools\n${tools}` : "") +
4344
(templates ? `\n\n### Resource Templates\n${templates}` : "") +
4445
(resources ? `\n\n### Direct Resources\n${resources}` : "")

src/services/mcp/McpHub.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ export class McpHub {
563563
await client.connect(transport)
564564
connection.server.status = "connected"
565565
connection.server.error = ""
566+
connection.server.instructions = client.getInstructions()
566567

567568
// Initial fetch of tools and resources
568569
connection.server.tools = await this.fetchToolsList(name, source)

src/shared/mcp.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type McpServer = {
1717
timeout?: number
1818
source?: "global" | "project"
1919
projectPath?: string
20+
instructions?: string
2021
}
2122

2223
export type McpTool = {

webview-ui/src/components/mcp/McpView.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,16 @@ const ServerRow = ({ server, alwaysAllowMcp }: { server: McpServer; alwaysAllowM
348348
fontSize: "13px",
349349
borderRadius: "0 0 4px 4px",
350350
}}>
351+
{server.instructions && (
352+
<div
353+
style={{
354+
paddingTop: "5px 0",
355+
opacity: 0.8,
356+
fontSize: "12px",
357+
}}>
358+
{server.instructions}
359+
</div>
360+
)}
351361
<VSCodePanels style={{ marginBottom: "10px" }}>
352362
<VSCodePanelTab id="tools">
353363
{t("mcp:tabs.tools")} ({server.tools?.length || 0})

0 commit comments

Comments
 (0)