Skip to content

Instantly share code, notes, and snippets.

@ianballou
Created July 31, 2025 19:30
Show Gist options
  • Save ianballou/695bc37237673a522a6a0477bffbfa93 to your computer and use it in GitHub Desktop.
Save ianballou/695bc37237673a522a6a0477bffbfa93 to your computer and use it in GitHub Desktop.
Connect Claude Code to Katello dev database via MCP
As the vagrant user:
$ npm install -g @modelcontextprotocol/server-postgres
$ claude mcp add postgres-server npx @modelcontextprotocol/server-postgres "postgresql://katello:@localhost:5432/katello"
Example use:
$ claude
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code! │
│ │
│ /help for help, /status for your current setup │
│ │
│ cwd: /home/vagrant/katello │
╰───────────────────────────────────────────────────╯
※ Tip: Use /theme to change the color theme
> which host has the walrus RPM installed in it?
● I'll help you find which host has the walrus RPM installed. Let me search the database for this information.
● postgres-server - query (MCP)(sql: "SELECT h.name as host_name, h.id as host_id \nFROM hosts h \nJOIN host_installed_packages hip ON h.id = hip.host_id \nJOIN rpm_packages rp
ON hip.installed_package_id = rp.id \nWHERE rp.name ILIKE '%walrus%';")
⎿  Error: MCP error -32603: relation "host_installed_packages" does not exist
● Let me check the database schema to find the correct table names for host packages.
● postgres-server - query (MCP)(sql: "SELECT table_name FROM information_schema.tables WHERE table_name LIKE '%host%' AND table_name LIKE '%package%' ORDER BY table_name;")
⎿  [
{
"table_name": "katello_host_installed_packages"
… +2 lines (ctrl+r to expand)
● postgres-server - query (MCP)(sql: "SELECT h.name as host_name, h.id as host_id \nFROM hosts h \nJOIN katello_host_installed_packages khip ON h.id = khip.host_id \nJOIN
katello_installed_packages kip ON khip.installed_package_id = kip.id \nWHERE kip.name ILIKE '%walrus%';")
⎿  [
{
"host_name": "centos10-stream.example.com",
… +3 lines (ctrl+r to expand)
● The host centos10-stream.example.com (host ID: 3) has the walrus RPM installed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment