Answer: You attach MCP servers to a custom agent by adding an mcpServers object to the agent's definition within the customAgents array when creating a session, mapping a server name to its command and args. Status: Confirmed Entry: tool/github-copilot/integrations/attach-mcp-servers-to-agents Revision: 3 Digest: sha256:9f55c20bf058d716 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:27:57Z Last changed: 2026-11-18T13:03:16Z (Agent name: — → db-analyst) Last verified: 2026-11-20T13:08:13Z Next check: 2026-11-21T13:08:13Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of MCP servers property | mcpServers | [1] | 2026-11-20 Server name | database | [1] | 2026-11-20 Command | npx | [1] | 2026-11-20 Args | @modelcontextprotocol/server-postgres | [1] | 2026-11-20 Agent name | db-analyst | [1] | 2026-11-20 Sources: [1] GitHub. "Custom agents and sub-agent orchestration - GitHub Docs". https://docs.github.com/en/copilot/how-tos/copilot-sdk/features/custom-agents Role: primary. Accessed: 2026-11-20T13:08:13Z Quote: "mcpServers : { "database" : { command : "npx" , args : [ "-y" , "@modelcontextprotocol/server-postgres" , "postgresql://localhost/mydb" ], }, }," (Supports: MCP servers property) Quote: ""database" : { command : "npx"" (Supports: Server name) Quote: "command : "npx"" (Supports: Command) Quote: "args : [ "-y" , "@modelcontextprotocol/server-postgres"" (Supports: Args) Quote: "name : "db-analyst"" (Supports: Agent name) Snapshot SHA-256: dfa87b471af31cfe91e44df0d4f4991f13666613d392decc2c5a7ec243956a07 (captured 2026-11-18T13:03:16Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-18T13:03:16Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T13:08:13Z. No independent second source is configured for this entry Last successful check: 2026-11-20T13:08:13Z Last attempt: 2026-11-20T13:08:13Z Notes and limitations: Extracted automatically from a single official source (section "Attaching MCP servers to agents"). Related: https://latestn.com/tool/github-copilot/integrations/authenticate-copilot-cli-in-actions How do I authenticate GitHub Copilot CLI in a GitHub Actions workflow? https://latestn.com/tool/github-copilot/integrations/automate-with-actions How do I automate tasks with GitHub Copilot CLI and GitHub Actions? https://latestn.com/tool/github-copilot/integrations/azure-boards-prerequisites What are the prerequisites for integrating GitHub Copilot cloud agent with Azure Boards? https://latestn.com/tool/github-copilot/integrations/add-mcp-configuration How do I add an MCP server configuration to my GitHub Copilot repository? https://latestn.com/tool/github-copilot/integrations/add-mcp-server How do I add an MCP server to GitHub Copilot CLI? https://latestn.com/tool/github-copilot/integrations/add-mcp-servers How do I add MCP servers to GitHub Copilot CLI? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-18T13:03:16Z | changed | Agent name: — → db-analyst | [1] 2026-11-18T13:03:16Z | changed | Args: — → @modelcontextprotocol/server-postgres | [1] 2026-11-18T13:03:16Z | changed | Command: — → npx | [1] 2026-11-18T13:03:16Z | changed | Server name: — → database | [1] 2026-11-18T13:03:16Z | changed | MCP servers property: — → mcpServers | [1] 2026-11-18T13:03:16Z | changed | Agent name in example: db-analyst → — | [1] 2026-11-18T13:03:16Z | changed | Example connection string: postgresql://localhost/mydb → — | [1] 2026-11-18T13:03:16Z | changed | Example args: @modelcontextprotocol/server-postgres → — | [1] 2026-11-18T13:03:16Z | changed | Example command: npx → — | [1] 2026-11-18T13:03:16Z | changed | Example server name: database → — | [1] 2026-11-18T13:03:16Z | changed | Property name: mcpServers → — | [1] 2026-11-16T12:52:06Z | changed | Agent name in example: — → db-analyst | [1] 2026-11-16T12:52:06Z | changed | Example connection string: — → postgresql://localhost/mydb | [1] 2026-11-16T12:52:06Z | changed | Example args: — → @modelcontextprotocol/server-postgres | [1] 2026-11-16T12:52:06Z | changed | Example command: — → npx | [1] 2026-11-16T12:52:06Z | changed | Example server name: — → database | [1] 2026-11-16T12:52:06Z | changed | Property name: — → mcpServers | [1] 2026-11-16T12:52:06Z | changed | session call: client. createSession → — | [1] 2026-11-16T12:52:06Z | changed | agent name: db-analyst → — | [1] 2026-11-16T12:52:06Z | changed | args: @modelcontextprotocol/server-postgres → — | [1] 2026-11-16T12:52:06Z | changed | command: npx → — | [1] 2026-11-16T12:52:06Z | changed | server key: database → — | [1] 2026-11-16T12:52:06Z | changed | property name: mcpServers → — | [1] 2026-11-13T03:27:57Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/github-copilot/integrations/attach-mcp-servers-to-agents/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/github-copilot/integrations/attach-mcp-servers-to-agents POST: https://latestn.com/dispute/tool/github-copilot/integrations/attach-mcp-servers-to-agents with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/github-copilot/integrations/attach-mcp-servers-to-agents?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I attach MCP servers to a custom agent in the GitHub Copilot SDK? Revision 3, last verified 2026-11-20T13:08:13Z. https://latestn.com/tool/github-copilot/integrations/attach-mcp-servers-to-agents (accessed 2026-11-21T10:00:00Z). @misc{LatestN_tool_github_copilot_integrations_attach_mcp_servers_to_agents_r3, title = {How do I attach MCP servers to a custom agent in the GitHub Copilot SDK?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/github-copilot/integrations/attach-mcp-servers-to-agents}}, note = {Revision 3; digest sha256:9f55c20bf058d716; last verified 2026-11-20T13:08:13Z; accessed 2026-11-21T10:00:00Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/github-copilot/integrations/attach-mcp-servers-to-agents