You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by fa...@apache.org on 2025/08/17 12:25:38 UTC
(gravitino) 02/03: mcp server
This is an automated email from the ASF dual-hosted git repository.
fanng pushed a commit to branch mcp_docker
in repository https://gitbox.apache.org/repos/asf/gravitino.git
commit eee51afde1ed916e06517f4727092af21e408b59
Author: fanng <xi...@datastrato.com>
AuthorDate: Sun Aug 17 20:05:04 2025 +0800
mcp server
---
dev/docker/mcp-server/Dockerfile | 37 ++++++++++++++++++++++
dev/docker/mcp-server/mcp-server-dependency.sh | 44 ++++++++++++++++++++++++++
dev/docker/mcp-server/start-mcp-server.sh | 23 ++++++++++++++
3 files changed, 104 insertions(+)
diff --git a/dev/docker/mcp-server/Dockerfile b/dev/docker/mcp-server/Dockerfile
new file mode 100644
index 0000000000..5826f1c085
--- /dev/null
+++ b/dev/docker/mcp-server/Dockerfile
@@ -0,0 +1,37 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+FROM python:3.10
+
+LABEL maintainer="dev@gravitino.apache.org"
+
+WORKDIR /root/mcp-server
+
+COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
+
+COPY packages/mcp-server /root/mcp-server
+
+COPY start-mcp-server.sh /root/mcp-server
+
+RUN uv venv
+
+RUN uv sync
+
+RUN uv pip install -e .
+
+ENTRYPOINT ["/bin/bash", "start-mcp-server.sh"]
diff --git a/dev/docker/mcp-server/mcp-server-dependency.sh b/dev/docker/mcp-server/mcp-server-dependency.sh
new file mode 100755
index 0000000000..dc88d5d44f
--- /dev/null
+++ b/dev/docker/mcp-server/mcp-server-dependency.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+set -ex
+mcp_server_dir="$(dirname "${BASH_SOURCE-$0}")"
+mcp_server_dir="$(cd "${mcp_server_dir}">/dev/null; pwd)"
+gravitino_home="$(cd "${mcp_server_dir}/../../..">/dev/null; pwd)"
+
+# Prepare the Iceberg REST server packages
+cd ${gravitino_home}
+./gradlew :mcp-server:clean
+
+# Removed old packages
+rm -rf "${mcp_server_dir}/packages"
+mkdir -p "${mcp_server_dir}/packages"
+
+cp -r ${gravitino_home}/mcp-server ${mcp_server_dir}/packages/mcp-server
+
+#cd ${gravitino_home}
+
+#cp start-mcp-server.sh ${mcp_server_dir}/packages/start_mcp_server.sh
+
+# Keeping the container running at all times
+#cat <<EOF >> "${mcp_server_dir}/packages/gravitino-iceberg-rest-server/bin/gravitino-iceberg-rest-server.sh"
+
+# Keeping a process running in the background
+#tail -f /dev/null
+#EOF
diff --git a/dev/docker/mcp-server/start-mcp-server.sh b/dev/docker/mcp-server/start-mcp-server.sh
new file mode 100644
index 0000000000..da368e2cc6
--- /dev/null
+++ b/dev/docker/mcp-server/start-mcp-server.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+cd /root/mcp-server
+
+uv run mcp_server --transport=http $@