I am using the mssql extension which allows me to connect to my database and query it. I would like to use Cursor to create a query based on that metadata, for example: Generate a CREATE VIEW script for every table in schema ‘xyz’. Add a where clause [abc] = 10 if column [abc] exists in the table.
Is this possible? If yes, how?
I could also use a SSDT database project that resides on my local drive if that works better.
Johan
1 Like
You can use Cursor’s Model Context Protocol (MCP) server to access your database metadata and generate queries. This allows you to create custom tools that can interact with your MSSQL connection
Check out the docs on MCP here: Cursor – Model Context Protocol
The basic flow would be:
- Set up an MCP server that connects to your database
- Use it to fetch metadata about tables and columns
- Have Cursor generate the CREATE VIEW scripts based on that info
This would probably work better than using SSDT files since you’d have live access to the actual database structure. Theres a few websites, like cursor.directory, which have some good examples of existing MCP servers which you could use, or base your own off!