Skip to content

Add RFC for supporting MCP with Presto#53

Open
agrawalreetika wants to merge 1 commit intoprestodb:mainfrom
agrawalreetika:rfc-mcp-022
Open

Add RFC for supporting MCP with Presto#53
agrawalreetika wants to merge 1 commit intoprestodb:mainfrom
agrawalreetika:rfc-mcp-022

Conversation

@agrawalreetika
Copy link
Member

Add RFC for supporting MCP with Presto

@prestodb-ci prestodb-ci added the from:IBM PRs from IBM label Nov 25, 2025
@prestodb-ci prestodb-ci requested review from a team, infvg and namya28 and removed request for a team November 25, 2025 17:12
- Implement the core MCP primitives:
- `tools/list` for tool discovery
- `tools/call` for executing tools
- Initially provide a single tool: `query.run`, which executes SQL queries against Presto.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any restriction on the type of queries supported? If it's a DML, might we need a new tool to support it, since they don't return data but return metadata about what was modified?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes — query.run is intentionally limited to read-only, row-producing queries.
LLM agents primarily issue analytical (SELECT-style) queries, and MCP tools are designed to return tabular JSON data.
My understanding is that if support for mutations is needed later, they could be exposed as separate MCP tools with their own semantics.

- Initially provide a single tool: `query.run`, which executes SQL queries against Presto.
- Internally communicate with Presto coordinators using standard Presto HTTP APIs.
- Forward OAuth/JWT Bearer tokens transparently from MCP clients to Presto, ensuring that Presto performs all authentication and authorization checks.
- Translate between the two protocols, aggregating streaming results into a single response.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the query requests too much data and creates memory pressure in the MCP server?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point - Although results are aggregated, the MCP server enforces a strict row limit (auto-injected if missing), ensuring memory is bounded and preventing large result sets from being materialized.

I am open to suggestions if additional safeguards should be added.

- Table metadata tools
- Query explanation tools

## WIP - Draft PR Changes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## WIP - Draft PR Changes

I presume it's not WIP anymore?

- Implement the core MCP primitives:
- `tools/list` for tool discovery
- `tools/call` for executing tools
- Initially provide a single tool: `query.run`, which executes SQL queries against Presto.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume this will also run SHOW catalogs; and other statements ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, query.run in the initial version is intentionally limited to read-only, row-producing queries (e.g., SELECT, SHOW, DESCRIBE).
Then there would be additional metadata oriented different tools - metadata.listCatalogs, metadata.listSchemas, metadata.listTables, metadata.getColumns

Thanks for pointing out, will update RFC details as well.

Copy link
Member

@hantangwangd hantangwangd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agrawalreetika thanks for this interesting proposal. Is there a prototype or draft PR already in the works that we could look at?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PRs from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants