Skip to content

Add an MCP Server Manager#361

Merged
dwash96 merged 8 commits intocecli-dev:v0.95.9from
gopar:mcp-server-manager
Jan 8, 2026
Merged

Add an MCP Server Manager#361
dwash96 merged 8 commits intocecli-dev:v0.95.9from
gopar:mcp-server-manager

Conversation

@gopar
Copy link
Copy Markdown

@gopar gopar commented Jan 3, 2026

Right now, a connection is reset every time a new Coder instance is created (which is extremely frequently). To better handle resources and make switching modes faster (not waiting on establishing MCP server(s) connection again), we'll delegate all this to a manager that we can just pass around.

@gopar gopar marked this pull request as draft January 3, 2026 07:29

async def get_server_tools(server):
# Check if we already have tools for this server in mcp_tools
if self.mcp_tools:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So this block already prevents the recreation/reconnection to mcp servers that have already been declared and added to the list

@dwash96
Copy link
Copy Markdown
Collaborator

dwash96 commented Jan 3, 2026

I generally support having a central MCP manager but there are a few things it should do/interventions we should make to be considered complete:

Minimum:

  • You probably already do this, but the MCP manager should maintain structures of both the available servers and the server a specific tool name corresponds to and expose simple methods for accessing these structures so the act of MCP server tool calling is less iterative inside of base_coder.py

Possibly another PR

  • MCP configuration blocks should have a "enabled" flag that determines if they start on load or not
  • The MCP manager should have enable/disable commands (or probably load/remove for naming consistency with skills) that can remove an MCP server/it's associated tools to and from the returned server list and tools list
  • We should add user facing commands for these two internal methods

Possibly yet another PR

  • Add one more "/register-mcp" command that can accept either a configuration json or yml file path that can perform the registration for any server configurations inside of it, and NOT making the immediately available, but available to load

@gopar gopar marked this pull request as ready for review January 5, 2026 20:24
@gopar
Copy link
Copy Markdown
Author

gopar commented Jan 5, 2026

Right now, we have a base implementation that sets the ground for separate PRs. I dont want to add too much into a single PR.

For the rest of the points, we can create tickets and track them via that way.

@gopar
Copy link
Copy Markdown
Author

gopar commented Jan 5, 2026

Also, can we squash these commits when we merge them? There's no history loss here if its all condensed into a single commit (i believe github has a setting to allow this when merging PRs to make it easier)

Initialize tools from all configured MCP servers. MCP Servers that fail to be
initialized will not be available to the Coder instance.
"""
# TODO(@gopar): refactor here once we have fully moved over to use the mcp manager
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Still valid since this is a minimal PR to get the codebase using the mcp manager

@dwash96
Copy link
Copy Markdown
Collaborator

dwash96 commented Jan 6, 2026

Hey, there's quite a decent surface area still expecting and accessing "mcp_servers" vs "mcp_manager"

image

Which causes errors with starting up in agent mode

@gopar
Copy link
Copy Markdown
Author

gopar commented Jan 6, 2026

Hey, there's quite a decent surface area still expecting and accessing "mcp_servers" vs "mcp_manager"
Which causes errors with starting up in agent mode

Oh! Weird how I missed that. The only one that is an actual issue is the agent_coder.py file, the other ones are related to passing the arg mcp_servers which is still required. I updated agent related code, and tested it out. Its able to complete its task w/ no errors.

@gopar gopar requested a review from dwash96 January 6, 2026 17:12
@dwash96 dwash96 changed the base branch from main to v0.95.9 January 8, 2026 02:12
@dwash96 dwash96 merged commit 044f699 into cecli-dev:v0.95.9 Jan 8, 2026
8 checks passed
@dwash96 dwash96 mentioned this pull request Jan 8, 2026
@gopar gopar deleted the mcp-server-manager branch January 8, 2026 05:40
chemtov pushed a commit to chemtov/cecli that referenced this pull request Jan 8, 2026
* Add an MCP Server Manager

* Remove unneeded magic methods

* Handle asyncio errors and exit flow

* Working version with mcp manager

* Update tests

* Simplify manager class

* Update agent coder to use mcp server
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