Skip to content

Commit e208bf9

Browse files
authored
Merge pull request #8 from Kode-Rex/mcp
added in docker changes
2 parents 93201f3 + 2b32a26 commit e208bf9

24 files changed

+1022
-25
lines changed

.github/workflows/docker_mcp.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build and publish MCP Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docker/**'
9+
- '.github/workflows/docker_mcp.yml'
10+
workflow_dispatch:
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Login to Docker Hub
23+
uses: docker/login-action@v3
24+
with:
25+
username: ${{ secrets.DOCKERHUB_USERNAME }}
26+
password: ${{ secrets.DOCKERHUB_TOKEN }}
27+
28+
- name: Build and push
29+
uses: docker/build-push-action@v5
30+
with:
31+
context: .
32+
file: ./docker/Dockerfile
33+
push: true
34+
tags: |
35+
webcat/mcp:latest
36+
webcat/mcp:${{ github.sha }}
37+
cache-from: type=registry,ref=webcat/mcp:buildcache
38+
cache-to: type=registry,ref=webcat/mcp:buildcache,mode=max

.github/workflows/main_webcatgpt.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ on:
44
push:
55
branches:
66
- main
7+
paths:
8+
- 'customgpt/**' # Only trigger when files in customgpt directory change
79
workflow_dispatch:
810

911
env:
10-
AZURE_FUNCTIONAPP_PACKAGE_PATH: 'src' # set this to the path to your web app project, defaults to the repository root
12+
AZURE_FUNCTIONAPP_PACKAGE_PATH: 'customgpt' # updated to the new path
1113
PYTHON_VERSION: '3.11' # set this to the python version to use
1214

1315
jobs:
@@ -35,8 +37,8 @@ jobs:
3537
3638
- name: Run tests
3739
run: |
38-
# Set Python path to include src directory
39-
PYTHONPATH=$PYTHONPATH:$(pwd)/${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} pytest -v tests/
40+
# Set Python path to include customgpt directory
41+
PYTHONPATH=$PYTHONPATH:$(pwd)/${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }} pytest -v customgpt/tests/
4042
4143
build:
4244
needs: test # Only run build if tests pass

README.md

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,50 @@
22

33
## Introduction
44

5-
Web Cat is a serverless Python-based API hosted on Azure Functions, designed to scrape and process website content responsibly. Leveraging the readability library and BeautifulSoup, `Web Cat` extracts the main body of text and related images from web pages, making it easy to integrate website content ChatGPT through the use of Custom GPTs.
5+
Web Cat is a collection of Python-based APIs designed to enhance AI models with web search and content extraction capabilities. The project includes:
66

7-
Using the `@Web Cat` GPT enhances ideation by seamlessly integrating web content into conversations, eliminating the need for manual copy-pasting or suffering through out dated data issues.
7+
1. A serverless Python-based API hosted on Azure Functions
8+
2. A Model Context Protocol (MCP) server that provides web search capabilities for AI models
9+
10+
Both implementations are designed to responsibly scrape and process website content, making it easy to integrate web content into AI applications like ChatGPT through Custom GPTs.
11+
12+
## Components
13+
14+
### Azure Functions API
15+
16+
The Azure Functions API leverages the readability library and BeautifulSoup to extract the main body of text and related images from web pages.
17+
18+
### MCP Server
19+
20+
The Model Context Protocol (MCP) server is a FastAPI-based implementation that provides web search capabilities with enhanced content extraction. It follows the MCP specification for standardized AI model interactions.
821

922
## Features
10-
- **Content Extraction**: Utilizes the readability library for clean text extraction.
11-
- **Text Processing**: Further processes extracted content for improved usability.
12-
- **Search Functionality**: Integrates with Serper.dev to provide web search capabilities.
23+
- **Content Extraction**: Utilizes the readability library for clean text extraction
24+
- **Text Processing**: Further processes extracted content for improved usability
25+
- **Search Functionality**: Integrates with Serper.dev to provide web search capabilities
26+
- **MCP Compliance**: Follows standardized Model Context Protocol specifications
27+
- **Rate Limiting**: Protects the API from abuse with configurable rate limits
28+
- **API Versioning**: Ensures backward compatibility as the API evolves
1329

1430
## Getting Started
1531

16-
### Prerequisites
32+
For the Azure Functions API:
33+
- See the `customgpt` directory for specific documentation
1734

18-
- Azure Functions Core Tools
19-
- Python 3.11
20-
- An Azure account and subscription
35+
For the MCP Server:
36+
- See the `docker` directory for build and deployment instructions
2137

22-
## Local Development
38+
## Limitations and Considerations
39+
- **Text-Based Content**: The APIs are optimized for text and image content and may not accurately represent other multimedia or dynamic web content.
40+
- **API Keys**: A Serper API key is required for search functionality
2341

24-
Prepare your local environment by running:
42+
## Contributing
2543

26-
```bash
27-
cd src
28-
pip install -r requirements.txt
29-
func start
30-
```
44+
Contributions are welcome! Please feel free to submit a Pull Request.
3145

32-
## Limitations and Considerations
33-
- **Text-Based Content**: The API is optimized for text and image content and may not accurately represent other multimedia or dynamic web content.
46+
## License
47+
48+
This project is licensed under the terms of the license included in the repository.
3449

3550
## Usage
3651

File renamed without changes.
File renamed without changes.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import sys
88
import pytest
99

10-
# Add the src directory to the path so tests can import function_app
11-
sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "src"))
10+
# Update path to import from current directory structure
11+
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
1212

1313
def main():
1414
"""Run all tests in the tests directory."""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import os
55
from unittest.mock import patch, MagicMock, mock_open
66

7-
# Add the src directory to the path so we can import the function_app
7+
# Update the import path to use the current directory structure
88
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
99

1010
import function_app

0 commit comments

Comments
 (0)