r/GithubCopilot • • 22h ago

Showcase ✨ Using Copilot Chat on a big database: an MCP server that sends only the tables each question needs (now on GitHub's MCP Registry)

Post image

I build schemagate, an open-source MCP server for asking questions of a database from Copilot Chat.

The problem I kept hitting with Copilot on real databases: the model either gets the whole schema (thousands of tokens on every question) or guesses table names. schemagate picks only the tables a question needs, plus the ones a foreign key away, and gives Copilot just those. On databases with 50+ tables that's a median 91% fewer schema tokens (measured on Spider 2.0-lite). Every query is read-only and checked before it runs.

New in 1.23.0, now on GitHub's MCP Registry:

  • Install from the registry and fill in a normal form: pick the database type from a list, then host, user, password. No connection URL to write, and the password is typed as is.
  • Already saved databases in VS Code (SQL Server, PostgreSQL or SQLTools extension, or Oracle SQL Developer)? Ask Copilot "which databases can you connect to?" and pick one. It sees names and hosts, never passwords. VS Code keeps saved passwords locked, so the first time you run one command: uvx schemagate-mcp login "<name>"
  • PostgreSQL, MySQL, SQL Server, Oracle (incl. Autonomous DB), SQLite, DuckDB, Snowflake, Databricks, BigQuery.

Where it stands: #1 for Oracle on the UniQL benchmark (64.93%, with error repair), 74.34 on BIRD's hidden test set, 14,000+ downloads.

What it doesn't do: it won't make the model write better SQL by itself, and on a small database you might as well send the whole schema.

Install: github.com/mcp/ashishsinha1602/schemagate

3 Upvotes

3 comments sorted by

1

u/kantorcodes1 21h ago

You also fetch tables that are one foreign key away. I maintain awesome-ai-plugins which is the list that people use to find MCP servers and agent tools. I could put the listing guide in a response here, if you'd like.

1

u/Temporary_Papaya1058 7h ago

Yes, one hop. A question usually names the tables that hold the answer, but the SQL also needs the tables that join them, and those are almost never named. Pulling in direct foreign-key neighbours catches most of them while the prompt stays small: a median 91% fewer schema tokens on databases with 50+ tables (Spider 2.0-lite). Today on a 35-table Oracle database, "top 5 countries by sales" sent 14 of the 35 tables, and the follow-up question sent 7.

Feel free to add it to your list. The registry entry has the install details: github.com/mcp/ashishsinha1602/schemagate

1

u/kantorcodes1 7h ago

One hop is the trick. The join tables are precisely the ones you don't mention in the question.

The schemagate listing is in the catalog README under Tools & Integrations, single entry, in your own words. This guide covers the format and the PR steps: https://github.com/hashgraph-online/awesome-ai-plugins/blob/main/CONTRIBUTING.md

Ping me here if any part of it is unclear.