flink-mcp — Flink MCP Server
This project provides an MCP server that connects to Apache Flink SQL Gateway.
Prerequisites
-
A running Apache Flink cluster and SQL Gateway
- Start cluster:
./bin/start-cluster.sh - Start gateway:
./bin/sql-gateway.sh start -Dsql-gateway.endpoint.rest.address=localhost - Verify:
curl http://localhost:8083/v3/info
- Start cluster:
-
Configure environment:
- Set
SQL_GATEWAY_API_BASE_URL(defaulthttp://localhost:8083). You can use a.envfile at repo root.
- Set
Run
Install and run via the console script:
pip install -e .
flink-mcp
MCP clients should launch the server over stdio with command: flink-mcp.
Ensure SQL_GATEWAY_API_BASE_URL is set in your environment or .env.
Tools (v0.2.5)
flink_info(resource): returns cluster info from/v3/info.open_new_session(properties?: dict)->{ sessionHandle, ... }.get_config(sessionHandle: str): returns session configuration.configure_session(sessionHandle: str, statement: str): apply session-scoped DDL/config (CREATE/USE/SET/RESET/LOAD/UNLOAD/ADD JAR).run_query_collect_and_stop(sessionHandle: str, query: str, max_rows: int=5, max_seconds: float=15.0): execute, fetch up to N rows within T seconds, then STOP the job if ajobIDis present; closes the operation.run_query_stream_start(sessionHandle: str, query: str): execute a streaming query and return{ jobID, operationHandle }; the job is left running.fetch_result_page(sessionHandle: str, operationHandle: str, token: int): fetch a single page; returns{ page, nextToken, isEnd }.cancel_job(sessionHandle: str, jobId: str): issueSTOP JOB '<jobId>', wait until DESCRIBE JOB status is not RUNNING; returns{ jobID, status, jobGone, jobStatus }.
Notes
-
Tools are stateless; clients manage and pass session/operation handles explicitly.
-
run_query_stream_startreturns bothjobIDandoperationHandle; usefetch_result_pageto stream results. -
cancel_jobissues STOP and waits using DESCRIBE JOB;close_operationis invoked internally where appropriate. -
Endpoints target SQL Gateway v3-style paths.
Metadata
Release files for flink-mcp 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flink_mcp-0.2.6.tar.gz | 10.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flink_mcp-0.2.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.2 kB
Release files / flink_mcp-0.2.6.tar.gz
| Download URL | flink_mcp-0.2.6.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c331538b5aa5f7b3e7c53ab35d5133eb2f507bc2a503176f4b1a0c4a21e0140b
|
|
BLAKE2b-256 checksum How to use checksums |
2ec6b9035e880c209e735cc03e075451edbcc42b86096aeccbe00028a09230c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.8.15
|
Release files / flink_mcp-0.2.6-py3-none-any.whl
| Download URL | flink_mcp-0.2.6-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64050d4c547f632ee087d4da3167e85884b03048285c935b2fa5141fe42a1634
|
|
BLAKE2b-256 checksum How to use checksums |
153c6ea053bdbcd55916b9617d8c29d8471a0332a03b68d22ff6abd720629b4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.8.15
|