Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Integration Tests

on:
push:
pull_request:

jobs:
integration-tests:
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip

- name: Install test dependencies
run: |
python -m pip install --upgrade pip
pip install -r mcp-local/tests/requirements.txt

- name: Build MCP Docker image
run: docker buildx build -f mcp-local/Dockerfile -t arm-mcp .

- name: Run integration tests
env:
MCP_IMAGE: arm-mcp:latest
run: pytest -v mcp-local/tests/test_mcp.py
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Virtual environments
venv/
.venv/
env/
.env/
embedding-generation/venv/
embedding-generation/yaml_data
embedding-generation/info

# Python
__pycache__/
*.py[cod]
*.egg-info/
dist/
build/
.eggs/
*.egg

# IDE
.idea/
.vscode/
*.swp
*.swo

# OS
.DS_Store
Thumbs.db
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ If you would prefer to use a pre-built, multi-arch image, the official image can
From the root of this repository:

```bash
docker buildx build --platform linux/arm64,linux/amd64 -f mcp-local/Dockerfile -t arm-mcp mcp-local
docker buildx build --platform linux/arm64,linux/amd64 -f mcp-local/Dockerfile -t arm-mcp .
```

For a single-platform build (faster):

```bash
docker buildx build -f mcp-local/Dockerfile -t arm-mcp mcp-local
docker buildx build -f mcp-local/Dockerfile -t arm-mcp .
```

### 2. Configure Your MCP Client
Expand Down Expand Up @@ -119,6 +119,19 @@ After updating the configuration, restart your MCP client to load the Arm MCP se
- `Dockerfile`: Multi-stage Docker build
- **`embedding-generation/`**: Scripts for regenerating the knowledge base from source documents

## Integration Testing

### Pre-requisites

- Build the mcp server docker image
- Install the required test packages using - `pip install -r tests/requirements.txt` within the `mcp_local` directory.

### Testing Steps

- Run the test script - `python -m pytest -s tests/test_mcp.py`
- Check if following 2 docker containers have started - **mcp server** & **testcontainer**
- All tests should pass without any errors. Warnings can be ignored.

## Troubleshooting

### Accessing the Container Shell
Expand Down
28 changes: 20 additions & 8 deletions embedding-generation/generate-chunks.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,17 +424,29 @@ def createLearningPathChunks():
learn_url = "https://learn.arm.com/"
response = http_session.get(learn_url, timeout=60)
soup = BeautifulSoup(response.text, 'html.parser')
for card in soup.find_all(class_='main-topic-card'):
if 'tool-install' == card.get('id'):
ig_rel_path = card.get('link')
processLearningPath(ig_rel_path,"Install Guide")

# Process Install Guides separately (directly from /install-guides page)
processLearningPath("/install-guides", "Install Guide")

# Find category links - main-topic-card elements are now wrapped in <a> tags
# Look for <a> tags that contain main-topic-card divs
for a_tag in soup.find_all('a', href=True):
card = a_tag.find(class_='main-topic-card')
if card:
cat_rel_path = a_tag.get('href')
if cat_rel_path is None or cat_rel_path.startswith('http'):
continue
# Skip non-learning-path links (like /tag/ml/ or install guides button)
if not cat_rel_path.startswith('/learning-paths/'):
continue

else:
cat_rel_path = card.get('link')
cat_response = http_session.get(learn_url+cat_rel_path, timeout=60)
cat_response = http_session.get(learn_url.rstrip('/') + cat_rel_path, timeout=60)
cat_soup = BeautifulSoup(cat_response.text, 'html.parser')
for lp_card in cat_soup.find_all(class_="path-card"):
lp_url = learn_url + lp_card.get('link')
lp_link = lp_card.get('link')
if lp_link is None:
continue
lp_url = learn_url.rstrip('/') + lp_link
# Chunking step
processLearningPath(lp_url, "Learning Path")

Expand Down
19 changes: 12 additions & 7 deletions mcp-local/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@ RUN rm -f /usr/local/bin/aperf \
/opt/arm-migration-tools/processwatch \
/opt/arm-migration-tools/papi

COPY embedding-generation/generate-chunks.py /tmp/embedding-generation/generate-chunks.py
COPY embedding-generation/local_vectorstore_creation.py /tmp/embedding-generation/local_vectorstore_creation.py
COPY embedding-generation/requirements.txt /tmp/embedding-generation/requirements.txt
COPY embedding-generation/urls-to-chunk.csv /tmp/embedding-generation/urls-to-chunk.csv

# Copy embedding data and scripts from the embedding base image
COPY --from=joestech324/mcp-embedding-base:latest /embedding-data /tmp/embedding-data
COPY --from=joestech324/mcp-embedding-base:latest /embedding-data/intrinsic_chunks /tmp/embedding-generation/intrinsic_chunks

# Install dependencies for vector database generation
WORKDIR /tmp/embedding-data
WORKDIR /tmp/embedding-generation
RUN pip3 install --no-cache-dir --break-system-packages -r requirements.txt

# Generate vector database
Expand All @@ -61,16 +66,16 @@ ENV VIRTUAL_ENV=/app/.venv \

RUN python3 -m venv "$VIRTUAL_ENV" && pip install --upgrade pip

COPY requirements.txt .
COPY mcp-local/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy generated vector database files
RUN mkdir -p ./data
RUN cp /tmp/embedding-data/metadata.json ./data/ && \
cp /tmp/embedding-data/usearch_index.bin ./data/
RUN cp /tmp/embedding-generation/metadata.json ./data/ && \
cp /tmp/embedding-generation/usearch_index.bin ./data/

COPY utils/ ./utils/
COPY server.py .
COPY mcp-local/utils/ ./utils/
COPY mcp-local/server.py .

FROM ubuntu:24.04 AS runtime

Expand Down
Loading