Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 16, 2025

  • Understand the feedback - need single config object, not string
  • Revert previous changes to original state
  • Update TaskFrontMatter.MCPServer to use MCPServerConfig type
  • Update RuleFrontMatter.MCPServer to use MCPServerConfig type
  • Update Result.MCPServers() to return []MCPServerConfig slice
  • Update all tests to work with new structure
  • Update example files with proper config objects
  • Update documentation in file-formats.md
  • Update pkg/codingcontext/README.md
  • Run tests - all pass
  • Run linter - passes
  • Test YAML parsing with custom fields - works correctly
  • Reply to comment with commit hash
  • Remove empty MCP server detection checks per @alexec feedback
  • Update tests to handle empty configs in results
  • All tests pass after removing checks
Original prompt

Rather that many MCP servers per tool, I'd like a single mcp_server. The name can be the file name.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 16, 2025 23:30
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor to consolidate MCP servers into single instance Simplify MCP server config from map to single string field Dec 16, 2025
Copilot AI requested a review from alexec December 16, 2025 23:35
@alexec
Copy link
Contributor

alexec commented Dec 16, 2025

@copilot No. Sorry. Rules contain MCP servers. These are just like tools. In the front-matter, the must specific one instance of the MCP server configuration.

mcp_server:
    command: python
    args: ["-m", "server"]
    env:
      PYTHON_PATH: /usr/bin/python3
    # Arbitrary nested fields below
    custom_config:
      host: localhost
      port: 5432
      ssl: true
      pool:
        min: 2
        max: 10

Convert from map of server configs to single MCPServerConfig object.
Each task/rule now specifies one MCP server configuration with
standard fields (command, args, env, type, url, headers) plus
arbitrary custom fields via the Content map.

Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 16, 2025

@copilot No. Sorry. Rules contain MCP servers. These are just like tools. In the front-matter, the must specific one instance of the MCP server configuration.

Updated in commit 64b7225. Changed from mcp_servers map to single mcp_server configuration object. Each task/rule now specifies one MCPServerConfig with standard fields (command, args, env, type, url, headers) plus arbitrary custom fields via the Content map.

Copilot AI changed the title Simplify MCP server config from map to single string field Change mcp_servers map to single mcp_server configuration object Dec 16, 2025
@alexec alexec marked this pull request as ready for review December 17, 2025 17:31
Copilot AI review requested due to automatic review settings December 17, 2025 17:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the MCP (Model Context Protocol) server configuration from a map-based approach to a single-object configuration model. Instead of each task/rule specifying multiple named MCP servers via a mcp_servers map, each task/rule now specifies one MCP server configuration via the mcp_server field. The Result.MCPServers() method now returns a slice of all MCP server configurations collected from rules and the task.

Key changes:

  • API change: mcp_servers map field → mcp_server single object field in task/rule frontmatter
  • Return type change: MCPServers() returns []MCPServerConfig slice instead of MCPServerConfigs map
  • Documentation and examples updated to reflect the new single-server-per-file model

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/codingcontext/task_frontmatter.go Changed MCPServers field from map to single MCPServer object
pkg/codingcontext/rule_frontmatter.go Changed MCPServers field from map to single MCPServer object
pkg/codingcontext/result.go Refactored MCPServers() to return slice and append configs from rules and task
pkg/codingcontext/task_frontmatter_test.go Updated tests to use single MCP server object with Args field
pkg/codingcontext/rule_frontmatter_test.go Updated tests to use single MCP server object with Args field
pkg/codingcontext/result_test.go Rewrote tests for slice-based return type and removed override test case
pkg/codingcontext/README.md Updated API documentation for new slice return type
docs/reference/file-formats.md Updated reference docs with single-object configuration format and examples
examples/agents/tasks/example-with-standard-fields.md Updated example to show single MCP server configuration
examples/agents/tasks/example-mcp-arbitrary-fields.md Simplified example to show one server with arbitrary custom fields

Comment on lines 32 to 40
// Check if the MCPServer is not empty (has at least one field set)
if rule.FrontMatter.MCPServer.Command != "" || rule.FrontMatter.MCPServer.URL != "" {
servers = append(servers, rule.FrontMatter.MCPServer)
}
}

// Add servers from task (overriding any from rules)
if r.Task.FrontMatter.MCPServers != nil {
for name, config := range r.Task.FrontMatter.MCPServers {
servers[name] = config
}
// Add server from task if it has one
if r.Task.FrontMatter.MCPServer.Command != "" || r.Task.FrontMatter.MCPServer.URL != "" {
servers = append(servers, r.Task.FrontMatter.MCPServer)
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty server detection logic only checks Command and URL fields. However, a valid MCP server configuration could have only Args, Env, Headers, or Content fields set without Command or URL (though unlikely). Consider checking if any meaningful field is set, or implement an IsEmpty() method on MCPServerConfig for clearer semantics. For example, a config with only Type set (without Command or URL) would currently be excluded, which might be intentional but isn't clearly documented.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot remove these checks. This check will need to be done by the agent, so the check is duplicative.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in commit 6ad46e5. The MCPServers() method now returns all configs without filtering, including empty ones. The agent can perform any necessary filtering.

Remove the empty server detection logic from MCPServers() method
as requested. The agent will handle filtering empty configs. Updated
tests to expect empty MCPServerConfig structs in the returned slice.

Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Copilot AI requested a review from alexec December 17, 2025 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants