-
Notifications
You must be signed in to change notification settings - Fork 104
Open
Description
Description
The describe_branch tool creates a public.show_db_tree() function in the user's database via DESCRIBE_DATABASE_STATEMENTS in landing/mcp-src/tools/utils.ts, but never cleans it up afterward. The function persists in the database indefinitely.
Impact
For projects that use schema introspection tools to generate types from the live database (e.g., Kanel), the leftover show_db_tree function gets picked up and generates unexpected type files. This causes spurious diffs in PRs and can break CI checks that validate generated code matches the declared schema.
Steps to reproduce
- Connect an MCP client to a Neon database using the Neon MCP server
- Use the
describe_branchtool - Inspect the database:
SELECT routine_name FROM information_schema.routines WHERE routine_schema = 'public' AND routine_name = 'show_db_tree'; - The function exists and persists after the tool completes
Suggested fix
Either:
- Drop the function after use (
DROP FUNCTION IF EXISTS public.show_db_tree();) - Use a temporary mechanism (e.g., run the logic inline as a CTE/subquery instead of creating a persistent function)
- Create the function in a non-public schema (e.g.,
neon_mcp) that's less likely to be introspected by user tooling
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels