Feature Request: Per-agent MCP server scoping to reduce context overhead

Open
#323,913 0 comments 0 reactions 1 assignee View on GitHub

@connor4312 is already working on this.

Since Jul 2, 2026.

Assessment

This issue has not been assessed yet.

Description

MCP servers defined in mcp.json files are loaded globally for all agents in the workspace. Each server's tool schemas consume context tokens regardless of which agent is running.

The tools: field in .agent.md can restrict which tools an agent may invoke, but it does not prevent the MCP server from starting or its schemas from being loaded into the prompt. The overhead is paid even for agents that never use those servers.

Request: Add an optional agents field to MCP server configs in mcp.json:

{
"servers": {
"playwright": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@playwright/mcp"],
"agents": ["Research"]
},
"sqlite": {
"type": "stdio",
"command": "npx",
"args": ["-y", "mcp-server-sqlite", "data.db"],
"agents": ["*"]
}
}
}

If agents is absent or ["*"], the server loads for all agents (current behaviour).
If agents lists specific agent names, only those agents get the server started and its schemas loaded.
Alternatively, allow inline MCP server definitions inside .agent.md frontmatter, scoped exclusively to that agent.

Use case: A "Manager" coding agent needs only read/edit/execute tools and a local SQLite MCP. A "Research" agent needs Playwright, web search, GitHub, and Context7. Currently both pay the context cost for all servers.

Dominant language
TypeScript
Stars
193k
Forks
42.9k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode

All issues in microsoft/vscode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.