Skip to content

Add MCP server#51

Merged
djthorpe merged 1 commit into
mainfrom
djt/0611/mcp
Jun 11, 2026
Merged

Add MCP server#51
djthorpe merged 1 commit into
mainfrom
djt/0611/mcp

Conversation

@djthorpe

Copy link
Copy Markdown
Member

This pull request introduces a new MCP (Management Control Protocol) server endpoint to the PostgreSQL manager, allowing programmatic management and health checking of PostgreSQL clusters. It adds the necessary dependencies, command-line flags, server registration logic, and initial MCP tools (Ping and ListRoles) to support this functionality.

Major features and enhancements:

MCP Server Integration:

  • Added a new --mcp command-line flag to enable the MCP endpoint in the server (pgmanager/cmd/server.go).
  • Registered the MCP server and its HTTP handler at the /mcp endpoint when enabled, including setup of instructions and tracing.

MCP Server and Tool Implementation:

  • Implemented the MCP server wrapper in pgmanager/mcp/server.go, integrating with the PostgreSQL manager and registering initial tools.
  • Added a Ping tool to check the health status of the PostgreSQL cluster.
  • Added a ListRoles tool to list roles in the PostgreSQL cluster, with optional filtering by role name.

Dependency Updates:

  • Updated go.mod with new dependencies required for MCP, JWT/OAuth, JSON handling, and PostgreSQL management, as well as minor updates to existing indirect dependencies. [1] [2] [3] [4] [5]
  • Imported new packages in pgmanager/cmd/server.go to support MCP server integration.

These changes lay the groundwork for advanced programmatic management of PostgreSQL clusters via a standardized protocol and make it easy to add further tools to the MCP server in the future.

@djthorpe djthorpe self-assigned this Jun 11, 2026
Copilot AI review requested due to automatic review settings June 11, 2026 13:29
@github-actions

Copy link
Copy Markdown

Coverage for this change: 62.4%

@djthorpe djthorpe merged commit d8bda0a into main Jun 11, 2026
3 checks passed
@djthorpe djthorpe deleted the djt/0611/mcp branch June 11, 2026 13:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds an optional MCP (Management Control Protocol) HTTP endpoint to the pgmanager server, wiring in an MCP server wrapper and exposing initial MCP tools for basic cluster health and role inspection.

Changes:

  • Introduces a new --mcp flag and registers an MCP handler endpoint when enabled.
  • Adds an pgmanager/mcp package implementing an MCP server wrapper plus initial ping and list_roles tools.
  • Updates module dependencies to include the MCP/LLM server library and related transitive requirements.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
pgmanager/mcp/server.go New MCP server wrapper and tool adapter implementation.
pgmanager/mcp/ping.go Adds MCP ping tool backed by manager.Ping.
pgmanager/mcp/roles.go Adds MCP list_roles tool backed by manager.GetRole / manager.ListRoles.
pgmanager/cmd/server.go Adds --mcp flag and conditional route registration for the MCP endpoint.
go.mod Adds go-llm dependency and updates indirect requirements.
go.sum Records new/updated dependency checksums.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pgmanager/mcp/server.go
Comment on lines +74 to +76
func (tool *tool) OutputSchema() *jsonschema.Schema {
return tool.output
}
Comment thread pgmanager/mcp/roles.go
Comment on lines +39 to +43
if len(input) > 0 && string(input) != "null" {
if err := json.Unmarshal(input, &in); err != nil {
return nil, err
}
}
Comment thread pgmanager/mcp/roles.go
Comment on lines +58 to +63
result := make([]*schema.Role, 0, len(list.Body))
for i := range list.Body {
role := list.Body[i]
result = append(result, &role)
}
return ListRolesOutput{Roles: result}, nil
Comment thread pgmanager/cmd/server.go

// Serve the MCP endpoint
handler := mcpServer.Handler()
return router.RegisterPath("/mcp", nil, httprequest.NewPathItem("MCP", "Management Control Protocol endpoint").
Comment thread pgmanager/mcp/server.go
Comment on lines +47 to +50
// Add tools to the server
if err := self.AddTools(self.Ping(), self.ListRoles()); err != nil {
return nil, err
}
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