sbley/foss-mcp-server
If you are the rightful owner of foss-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This tool uses Model Context Protocol (MCP) to check files for proper headers according to Open Source policies.
FOSS MCP Server
This tool uses Model Context Protocol (MCP) to check files for proper headers according to Open Source policies. Currently, it checks for SPDX copyright and licensing information headers.
Project Structure
mcp_server.py
- The main MCP server implementationmodel_setup.py
- Model configuration and initializationlicense_verifier.py
- Functions for verifying license headersrun_server.ps1
- PowerShell script to run the server on Windowsrun_server.sh
- Bash script to run the server on Linux/macOS
Setup
-
Create a virtual environment:
python -m venv .venv
-
Activate the virtual environment:
Windows (PowerShell):
.\.venv\Scripts\Activate.ps1
Linux/macOS/Git Bash:
source .venv/bin/activate
-
Install requirements:
pip install -r requirements.txt
-
Configure Azure OpenAI settings:
The following environment variables are required for the Azure OpenAI client:
AZURE_OPENAI_ENDPOINT
- Your Azure OpenAI endpoint URLAZURE_OPENAI_API_VERSION
- API version to use (e.g., '2024-09-01-preview')AZURE_OPENAI_DEPLOYMENT
- The Azure OpenAI deployment nameAZURE_OPENAI_API_KEY
- Your Azure OpenAI API key
These can be configured in the environment or provided by the agent/application that calls the MCP server.
Running the server
You need an Azure OpenAI API key to use this tool. There are two ways to provide it:
Option 1: Using the helper script (Recommended)
Windows (PowerShell):
.\run_server.ps1 "your-api-key-here"
Linux/macOS/Git Bash:
bash run_server.sh "your-api-key-here"
Or run without arguments and you'll be prompted to enter the API key:
Windows (PowerShell):
.\run_server.ps1
Linux/macOS/Git Bash:
bash run_server.sh
Option 2: Manual setup
-
Activate the virtual environment:
Windows (PowerShell):
.\.venv\Scripts\Activate.ps1
Linux/macOS/Git Bash:
source .venv/bin/activate
-
Set the environment variables:
Windows (PowerShell):
$env:AZURE_OPENAI_API_KEY = "your-api-key-here" $env:AZURE_OPENAI_ENDPOINT = "your-azure-endpoint" $env:AZURE_OPENAI_API_VERSION = "your-api-version" $env:AZURE_OPENAI_DEPLOYMENT = "your-deployment-name"
Linux/macOS/Git Bash:
export AZURE_OPENAI_API_KEY="your-api-key-here" export AZURE_OPENAI_ENDPOINT="your-azure-endpoint" export AZURE_OPENAI_API_VERSION="your-api-version" export AZURE_OPENAI_DEPLOYMENT="your-deployment-name"
-
Run the server:
python mcp_server.py
How it works
The server provides an MCP tool that checks code files for:
- SPDX license identifier
- Copyright notice
- Proper placement of headers at the top of the file
When these elements are missing, the tool suggests appropriate headers to add to your files.