Skip to content

Commit 7e5267f

Browse files
MCP (#1108)
* mcp mvp * precommit fix * docker added, thanks dwij * Add GitHub Actions workflow for building and pushing MCP Docker image --------- Co-authored-by: Dwij Patel <[email protected]>
1 parent b5b22cd commit 7e5267f

File tree

11 files changed

+1246
-47
lines changed

11 files changed

+1246
-47
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build and Push MCP Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
- 'mcp-v*'
10+
paths:
11+
- 'mcp/**'
12+
- '.github/workflows/docker-mcp-publish.yml'
13+
workflow_dispatch:
14+
15+
jobs:
16+
build-and-push:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v3
25+
26+
- name: Log in to DockerHub
27+
uses: docker/login-action@v3
28+
with:
29+
username: ${{ secrets.DOCKERHUB_USERNAME }}
30+
password: ${{ secrets.DOCKERHUB_TOKEN }}
31+
32+
- name: Extract metadata
33+
id: meta
34+
uses: docker/metadata-action@v5
35+
with:
36+
images: |
37+
${{ secrets.DOCKERHUB_USERNAME }}/agentops-mcp
38+
tags: |
39+
type=ref,event=branch
40+
type=semver,pattern={{version}}
41+
type=semver,pattern={{major}}.{{minor}}
42+
type=raw,value=latest,enable={{is_default_branch}}
43+
44+
- name: Build and push Docker image
45+
uses: docker/build-push-action@v5
46+
with:
47+
context: ./mcp
48+
file: ./mcp/Dockerfile
49+
push: true
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: ${{ steps.meta.outputs.labels }}
52+
cache-from: type=gha
53+
cache-to: type=gha,mode=max

mcp/.dockerignore

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Version control
2+
.git
3+
.gitignore
4+
5+
# Documentation (but keep README.md for build)
6+
*.md
7+
!README.md
8+
docs/
9+
LICENSE
10+
11+
# Development files
12+
.env
13+
.env.*
14+
*.log
15+
*.pyc
16+
__pycache__/
17+
.pytest_cache/
18+
.coverage
19+
.mypy_cache/
20+
.ruff_cache/
21+
22+
# IDE files
23+
.vscode/
24+
.idea/
25+
*.swp
26+
*.swo
27+
*~
28+
29+
# OS files
30+
.DS_Store
31+
Thumbs.db
32+
33+
# Build artifacts
34+
build/
35+
dist/
36+
*.egg-info/
37+
.eggs/
38+
39+
# Testing
40+
tests/
41+
test_*.py
42+
*_test.py
43+
44+
# CI/CD
45+
.github/
46+
Dockerfile
47+
docker-compose*.yml
48+
49+
# Example configurations
50+
*example*
51+
*sample*
52+
53+
# Temporary files
54+
tmp/
55+
temp/
56+
*.tmp
57+
*.bak

mcp/.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# AgentOps API Key - Required for authentication
2+
AGENTOPS_API_KEY="your-agentops-api-key-here"
3+
4+
# Optional: Override the default API host (defaults to https://api.agentops.ai)
5+
# HOST="https://api.agentops.ai"

mcp/.gitignore

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[codz]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py.cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# UV
98+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
#uv.lock
102+
103+
# poetry
104+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105+
# This is especially recommended for binary packages to ensure reproducibility, and is more
106+
# commonly ignored for libraries.
107+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108+
#poetry.lock
109+
#poetry.toml
110+
111+
# pdm
112+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113+
#pdm.lock
114+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
115+
# in version control.
116+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
117+
.pdm.toml
118+
.pdm-python
119+
.pdm-build/
120+
121+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
122+
__pypackages__/
123+
124+
# Celery stuff
125+
celerybeat-schedule
126+
celerybeat.pid
127+
128+
# SageMath parsed files
129+
*.sage.py
130+
131+
# Environments
132+
.env
133+
.envrc
134+
.venv
135+
env/
136+
venv/
137+
ENV/
138+
env.bak/
139+
venv.bak/
140+
141+
# Spyder project settings
142+
.spyderproject
143+
.spyproject
144+
145+
# Rope project settings
146+
.ropeproject
147+
148+
# mkdocs documentation
149+
/site
150+
151+
# mypy
152+
.mypy_cache/
153+
.dmypy.json
154+
dmypy.json
155+
156+
# Pyre type checker
157+
.pyre/
158+
159+
# pytype static type analyzer
160+
.pytype/
161+
162+
# Cython debug symbols
163+
cython_debug/
164+
165+
# PyCharm
166+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
167+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
168+
# and can be added to the global gitignore or merged into this file. For a more nuclear
169+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
170+
#.idea/
171+
172+
# Abstra
173+
# Abstra is an AI-powered process automation framework.
174+
# Ignore directories containing user credentials, local state, and settings.
175+
# Learn more at https://abstra.io/docs
176+
.abstra/
177+
178+
# Visual Studio Code
179+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
180+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
181+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
182+
# you could uncomment the following to ignore the entire vscode folder
183+
# .vscode/
184+
185+
# Ruff stuff:
186+
.ruff_cache/
187+
188+
# PyPI configuration file
189+
.pypirc
190+
191+
# Cursor
192+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
193+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
194+
# refer to https://docs.cursor.com/context/ignore-files
195+
.cursorignore
196+
.cursorindexingignore
197+
198+
# Marimo
199+
marimo/_static/
200+
marimo/_lsp/
201+
__marimo__/

mcp/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM python:3.12-slim
2+
3+
# Install uv package manager
4+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
5+
6+
# Set working directory
7+
WORKDIR /app
8+
9+
# Copy project files
10+
COPY pyproject.toml README.md ./
11+
COPY server.py ./
12+
13+
# Create and activate virtual environment, then install dependencies
14+
RUN uv venv && \
15+
. .venv/bin/activate && \
16+
uv pip install -e .
17+
18+
# Set environment variables
19+
ENV PYTHONUNBUFFERED=1
20+
ENV HOST=https://api.agentops.ai
21+
22+
# Run the MCP server using the virtual environment
23+
CMD [".venv/bin/python", "server.py"]

0 commit comments

Comments
 (0)