Skip to content

Commit 0edf732

Browse files
authored
Generate improvements (#2)
This pull request introduces several significant changes to the project, focusing on Docker integration, environment configuration, and enhancements to the frontend application. Below is a summary of the most important changes: ### Docker and Environment Configuration * [`.dockerignore`](diffhunk://#diff-2f754321d62f08ba8392b9b168b83e24ea2852bb5d815d63e767f6c3d23c6ac5R1-R20): Added to exclude unnecessary files and directories from the Docker build context, improving build efficiency. * [`Dockerfile`](diffhunk://#diff-dd2c0eb6ea5cfc6c4bd4eac30934e2d5746747af48fef6da689e85b752f39557R1-R15): Created a multi-stage Dockerfile to build and serve the application using Nginx, ensuring a production-ready deployment. * [`.github/workflows/docker-build.yml`](diffhunk://#diff-3414847e2ad632333f775cabb810f0dc0df61a570365df34750a08b00912fe82R1-R57): Added a GitHub Actions workflow to automate Docker image builds and pushes to the container registry on specific triggers. * `.env.example` and `.env.production`: Added environment variable for backend API endpoint configuration. [[1]](diffhunk://#diff-a3046da0d15a27e89f2afe639b25748a7ad4d9290af3e7b1b6c1a5533c8f0a8cR1) [[2]](diffhunk://#diff-48f73ea2653e45c41f31afc2d42dfde14d8caf26d8dd24d3d2a81a52604f4cb6R1) ### Frontend Enhancements * [`README.md`](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L3-R134): Updated with detailed project information, installation instructions, and usage guidelines, including Docker usage. * [`src/App.tsx`](diffhunk://#diff-26ad4b834941d9b19ebf9db8082bd202aaf72ea0ddea85f5a8a0cb3c729cc6f2R148): Improved the header layout by adding a container for the toggle button and application name. [[1]](diffhunk://#diff-26ad4b834941d9b19ebf9db8082bd202aaf72ea0ddea85f5a8a0cb3c729cc6f2R148) [[2]](diffhunk://#diff-26ad4b834941d9b19ebf9db8082bd202aaf72ea0ddea85f5a8a0cb3c729cc6f2R166-R170) [[3]](diffhunk://#diff-26ad4b834941d9b19ebf9db8082bd202aaf72ea0ddea85f5a8a0cb3c729cc6f2L177) * [`src/api/index.ts`](diffhunk://#diff-764761d79ed791ea154187526b088322dba3bebe94f9d38ab22120554aba77c7L3-R3): Updated API endpoint to use environment variable for backend API URL. * [`src/components/ModelControls.tsx`](diffhunk://#diff-384fa59c0993a3d8d538bbc9c802bba21991efc510e449ffd4b8337764f46580R2): Integrated Auth0 for authentication, restricting access to model controls based on user authentication status. [[1]](diffhunk://#diff-384fa59c0993a3d8d538bbc9c802bba21991efc510e449ffd4b8337764f46580R2) [[2]](diffhunk://#diff-384fa59c0993a3d8d538bbc9c802bba21991efc510e449ffd4b8337764f46580L28-R31) [[3]](diffhunk://#diff-384fa59c0993a3d8d538bbc9c802bba21991efc510e449ffd4b8337764f46580L44) [[4]](diffhunk://#diff-384fa59c0993a3d8d538bbc9c802bba21991efc510e449ffd4b8337764f46580R61-R62) [[5]](diffhunk://#diff-384fa59c0993a3d8d538bbc9c802bba21991efc510e449ffd4b8337764f46580L97-R100) [[6]](diffhunk://#diff-384fa59c0993a3d8d538bbc9c802bba21991efc510e449ffd4b8337764f46580L113-R116) [[7]](diffhunk://#diff-384fa59c0993a3d8d538bbc9c802bba21991efc510e449ffd4b8337764f46580L134-R144) ### Dependency Updates * [`package.json`](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R13-R23): Added new dependencies for `@auth0/auth0-react`, `@primer/octicons-react`, and `react-icons` to enhance the application with authentication and additional UI icons. ### Licensing and Metadata * [`LICENSE`](diffhunk://#diff-c693279643b8cd5d248172d9c22cb7cf4ed163a3c98c8a3f69c2717edd3eacb7R1-R21): Added MIT License to the project, ensuring open-source compliance. These changes collectively enhance the project's deployment process, improve frontend capabilities, and ensure proper licensing and documentation.This pull request includes several changes to the `Dockerfile`, `package.json`, and various components in the `src` directory to enhance the application's build process, dependency management, and user interface. ### Build Process Improvements: * Created a multi-stage build in the `Dockerfile` to optimize the image size and build process. This includes a build stage using `node:20-alpine`, installing dependencies, and building the application, followed by a production stage that uses the built assets and serves the application on port 3000. ### Dependency Management: * Added new dependencies to `package.json` for improved functionality and UI components, including `@auth0/auth0-react`, `@primer/octicons-react`, and `react-icons`. ### User Interface Enhancements: * Updated `src/App.tsx` to include a new container for the toggle and app name in the header, and added the application name "MCP Kit". [[1]](diffhunk://#diff-26ad4b834941d9b19ebf9db8082bd202aaf72ea0ddea85f5a8a0cb3c729cc6f2R148) [[2]](diffhunk://#diff-26ad4b834941d9b19ebf9db8082bd202aaf72ea0ddea85f5a8a0cb3c729cc6f2R166-R170) * Modified `src/components/ModelControls.tsx` to integrate authentication checks using `@auth0/auth0-react`. This ensures that certain controls are only accessible to authenticated users. [[1]](diffhunk://#diff-384fa59c0993a3d8d538bbc9c802bba21991efc510e449ffd4b8337764f46580R2) [[2]](diffhunk://#diff-384fa59c0993a3d8d538bbc9c802bba21991efc510e449ffd4b8337764f46580L28-R31) [[3]](diffhunk://#diff-384fa59c0993a3d8d538bbc9c802bba21991efc510e449ffd4b8337764f46580R61-R62) [[4]](diffhunk://#diff-384fa59c0993a3d8d538bbc9c802bba21991efc510e449ffd4b8337764f46580L134-R144) * Updated `src/components/Sidebar.tsx` to open the GitHub repository for help and support when the help button is clicked. * Refined `src/components/sidebar/SidebarFooter.tsx` to replace the help icon with a GitHub icon and update the button titles for clarity. [[1]](diffhunk://#diff-22a4dba86635dcba92d0b4732b2f736618b42ebdb1d3478523b91ace9d2a6b4bL4-R7) [[2]](diffhunk://#diff-22a4dba86635dcba92d0b4732b2f736618b42ebdb1d3478523b91ace9d2a6b4bL56-R65) ### Configuration Cleanup: * Removed unnecessary build configuration from `vite.config.ts` to streamline the build process.
1 parent 184754e commit 0edf732

18 files changed

+429
-116
lines changed

.dockerignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Versioning and metadata
2+
.git
3+
.gitignore
4+
.dockerignore
5+
6+
# Build dependencies
7+
dist
8+
build
9+
node_modules
10+
coverage
11+
12+
# Environment (contains sensitive data)
13+
.env
14+
15+
# Files not required for production
16+
.editorconfig
17+
Dockerfile
18+
README.md
19+
tslint.json
20+
nodemon.json

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_MCP_BACKEND_API_ENDPOINT=http://localhost:8081

.env.production

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_MCP_BACKEND_API_ENDPOINT=VITE_MCP_BACKEND_API_ENDPOINT

.github/workflows/docker-build.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Docker Build and Push
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*' # This will trigger on version tags like v1.0.0
9+
pull_request:
10+
branches:
11+
- main
12+
13+
env:
14+
REGISTRY: ghcr.io
15+
IMAGE_NAME: ${{ github.repository }}
16+
17+
jobs:
18+
build-and-push:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Log in to the Container registry
29+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@v3
38+
39+
- name: Extract metadata (tags, labels) for Docker
40+
id: meta
41+
uses: docker/metadata-action@v5
42+
with:
43+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+
tags: |
45+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
46+
type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
47+
type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
48+
49+
- name: Build and push Docker image
50+
uses: docker/build-push-action@v5
51+
with:
52+
context: .
53+
push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ dist-ssr
2222
*.njsproj
2323
*.sln
2424
*.sw?
25+
26+
.env

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Stage 1: Build Image
2+
FROM node:20-alpine as build
3+
RUN apk add git
4+
WORKDIR /app
5+
COPY package*.json ./
6+
RUN npm install
7+
COPY . .
8+
RUN npm run build
9+
10+
# Stage 2, use the compiled app, ready for production with Nginx
11+
FROM nginx:1.21.6-alpine
12+
COPY --from=build /app/dist /usr/share/nginx/html
13+
COPY /nginx-custom.conf /etc/nginx/conf.d/default.conf
14+
COPY env.sh /docker-entrypoint.d/env.sh
15+
RUN chmod +x /docker-entrypoint.d/env.sh

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Shaharia Lab OÜ
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 119 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,134 @@
11
# MCP (Model Context Protocol) Frontend
22

3-
This repository is part of [mcp-kit](https://github.com/shaharia-lab/mcp-kit).
4-
It is the frontend part of the MCP (Model Context Protocol) Kit written in Golang.
5-
This frontend is a single page application built with Vite, React, Typescript.
3+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
64

7-
# Demo
5+
A frontend application for the Model Context Protocol (MCP) Kit that enables enhanced interactions with Large Language Models through tool-based capabilities.
86

9-
Let's chat with LLM by providing additional capabilities (tools) coming from MCP server.
7+
This repository is part of [mcp-kit](https://github.com/shaharia-lab/mcp-kit) and serves as the user interface layer built with modern web technologies.
8+
9+
## 🚀 Features
10+
11+
- Single Page Application architecture
12+
- Real-time chat interface with LLMs
13+
- Tool-based interaction capabilities
14+
- Integration with MCP backend server
15+
- Modern, responsive UI built with React and TypeScript
16+
17+
## 🎥 Demo
18+
19+
Experience MCP Kit in action - chat with LLMs while leveraging additional capabilities provided by the MCP server:
1020

1121
<video src="https://github.com/user-attachments/assets/81804a29-e896-4f65-a929-05ac6a6aa92a" controls title="MCP Kit in action"></video>
1222

13-
## Installation
23+
## 🛠️ Prerequisites
24+
25+
- Node.js 20.x
26+
- NPM 7.x
27+
28+
## 📦 Installation
29+
30+
### Standard Installation
31+
32+
1. Clone the repository:
33+
```shell
34+
git clone https://github.com/shaharia-lab/mcp-frontend.git
35+
cd mcp-frontend
36+
```
37+
38+
[Rest of standard installation steps...]
39+
40+
### 🐳 Docker Installation
41+
42+
You can run MCP Frontend using our official Docker image:
43+
44+
```shell
45+
docker pull ghcr.io/shaharia-lab/mcp-frontend:<version>
46+
```
47+
48+
Replace `<version>` with the specific version you want to use (e.g., `latest`, `1.0.0`).
49+
50+
#### Running with Docker
51+
52+
docker run \
53+
-p 3000:3000 \
54+
-e VITE_MCP_BACKEND_API_ENDPOINT=http://localhost:8081 \
55+
ghcr.io/shaharia-lab/mcp-frontend:<version>
56+
57+
#### Environment Variables
58+
59+
The following environment variables are required to run MCP Frontend:
60+
61+
##### Production Environment Variables (Running with Docker)
1462

63+
| env_key | Default | Required | Description |
64+
|---------------------------------|---------|----------|---------------------------------------|
65+
| `VITE_MCP_BACKEND_API_ENDPOINT` | - | Yes | The base URL for the MCP backend API. |
66+
67+
Simply copy the `.env.example` file to `.env` and update the values as needed.
68+
69+
## 🚀 Usage
70+
71+
### Development
72+
73+
Run the development server:
1574
```shell
16-
nvm use 20
17-
npm install
1875
npm run dev
1976
```
2077

21-
## MCP-Kit Backend
78+
### Production
79+
80+
Build for production:
81+
82+
```shell
83+
npm run build
84+
```
85+
86+
For detailed configuration options, refer to the [Vite documentation](https://vite.dev/guide/).
87+
88+
## 🏗️ Architecture
89+
90+
MCP Frontend is built with:
91+
- [Vite](https://vite.dev/) - Build tool and development server
92+
- [React](https://reactjs.org/) - UI framework
93+
- [TypeScript](https://www.typescriptlang.org/) - Type-safe JavaScript
94+
- [Tailwind CSS](https://tailwindcss.com/) - Utility-first CSS framework
95+
96+
## 🤝 Contributing
97+
98+
We welcome contributions! Here's how you can help:
99+
100+
1. Fork the repository
101+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
102+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
103+
4. Push to the branch (`git push origin feature/amazing-feature`)
104+
5. Open a Pull Request
105+
106+
Please ensure your PRs follow our coding standards and include appropriate tests.
107+
108+
## 🔍 Related Projects
109+
110+
- [MCP-Kit Backend](https://github.com/shaharia-lab/mcp-kit) - The main backend server
111+
- [Documentation](https://github.com/shaharia-lab/mcp-kit) - Full project documentation
112+
113+
## ⚠️ Current Status
114+
115+
This project is under active development. While functional, it's not yet recommended for production use. We're working on:
116+
- Enhanced error handling
117+
- Improved performance
118+
- Additional tool integrations
119+
- Comprehensive testing suite
120+
121+
## 📝 License
122+
123+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
124+
125+
## 🤔 Support
22126

23-
Feel free to checkout the main backend [here](https://github.com/shaharia-lab/mcp-kit).
127+
- 📧 Email: [hello@shaharialab.com](mailto:hello@shaharialab.com)
128+
- 🐛 [Issue Tracker](https://github.com/shaharia-lab/mcp-frontend/issues)
129+
- 💬 [Discord invite: Community Chat](https://discord.gg/XMDMQ2u7)
24130

25-
## Disclaimer
131+
## 🙏 Acknowledgments
26132

27-
We are actively improving this frontend. Not recommended for production-use yet.
133+
- The MCP Kit community
134+
- All our contributors and supporters

env.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
# Generate sed script file
3+
sed_script="/tmp/sed_script.sed"
4+
> "$sed_script"
5+
6+
# Ensure the sed script file is cleaned up on exit
7+
trap 'rm -f "$sed_script"' EXIT
8+
9+
# Extract VITE_MCP_ environment variables and build the sed expression
10+
env | grep '^VITE_MCP_' | while IFS='=' read -r key value; do
11+
# Escape slashes and other special characters in key and value
12+
escaped_key=$(printf '%s' "$key" | sed 's/[\/&]/\\&/g')
13+
escaped_value=$(printf '%s' "$value" | sed 's/[\/&]/\\&/g')
14+
# Append to sed script file
15+
echo "s|${escaped_key}|${escaped_value}|g;" >> "$sed_script"
16+
done
17+
18+
# Check if the sed script file was created and is not empty
19+
if [ ! -s "$sed_script" ]; then
20+
echo "No VITE_MCP_ environment variables found. Exiting with error."
21+
exit 1
22+
fi
23+
24+
# sed All files
25+
find /usr/share/nginx/html -type f -exec sed -i -f "$sed_script" '{}' +
26+
27+
# sed JS and CSS only
28+
# find /usr/share/nginx/html -type f \( -name '*.js' -o -name '*.css' \) -exec sed -i -f "$sed_script" '{}' +

nginx-custom.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
server {
2+
listen 80;
3+
location / {
4+
root /usr/share/nginx/html;
5+
index index.html index.htm;
6+
try_files $uri $uri/ /index.html =404;
7+
}
8+
}

package-lock.json

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)