Skip to content

Commit aefca43

Browse files
authored
refactor: improve readability on mcpHub check
1 parent c8ef802 commit aefca43

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/core/prompts/instructions/create-mcp-server.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,14 @@ IMPORTANT: Regardless of what else you see in the MCP settings file, you must de
279279
280280
## Editing MCP Servers
281281
282-
The user may ask to add tools or resources that may make sense to add to an existing MCP server (listed under 'Connected MCP Servers' above: ${
283-
mcpHub
284-
? mcpHub
285-
.getServers()
286-
.map((server) => server.name)
287-
.join(", ") || "(None running currently)"
288-
: "(None running currently)"
289-
}, e.g. if it would use the same API. This would be possible if you can locate the MCP server repository on the user's system by looking at the server arguments for a filepath. You might then use list_files and read_file to explore the files in the repository, and use write_to_file${diffStrategy ? " or apply_diff" : ""} to make changes to the files.
282+
The user may ask to add tools or resources that may make sense to add to an existing MCP server (listed under 'Connected MCP Servers' above: ${(() => {
283+
if (!mcpHub) return "(None running currently)"
284+
const servers = mcpHub
285+
.getServers()
286+
.map((server) => server.name)
287+
.join(", ")
288+
return servers || "(None running currently)"
289+
})()}, e.g. if it would use the same API. This would be possible if you can locate the MCP server repository on the user's system by looking at the server arguments for a filepath. You might then use list_files and read_file to explore the files in the repository, and use write_to_file${diffStrategy ? " or apply_diff" : ""} to make changes to the files.
290290
291291
However some MCP servers may be running from installed packages rather than a local repository, in which case it may make more sense to create a new MCP server.
292292

0 commit comments

Comments
 (0)