MCP server gateway for task-specific AI rules and scripts stored in GitHub
Project description
policygate
Policygate is an MCP server gateway for task-specific AI rules and scripts stored in a GitHub repository.
Features
- Syncs repository content into a local cache at
~/.policygate/repo_data - Parses and validates
router.yaml - Exposes MCP tools:
sync_repositoryoutline_routerread_rulescopy_scripts
Detailed usage reference: docs/REFERENCE.md
Required repository structure
rules/
scripts/
router.yaml
router.yaml structure:
tasks:
task1:
description: "Short description of task 1"
rules:
- rule1
scripts:
- script1
rules:
rule1:
path: rules/rule1.md
description: "Short description of rule 1"
scripts:
script1:
path: scripts/script1.py
description: "Short description of script 1"
Configuration
Set environment variables:
POLICYGATE__GITHUB_REPOSITORY_URLPOLICYGATE__GITHUB_ACCESS_TOKENPOLICYGATE__LOCAL_REPO_DATA_DIR(optional, default~/.policygate/repo_data)POLICYGATE__REPOSITORY_REFRESH_INTERVAL_SECONDS(optional, default1800)
Run MCP server
Run with:
uv run policygate-mcp
VS Code workspace MCP config example (.vscode/mcp.json):
{
"inputs": [
{
"id": "POLICYGATE__GITHUB_REPOSITORY_URL",
"type": "promptString",
"description": "GitHub repository URL",
"password": false
},
{
"id": "POLICYGATE__GITHUB_ACCESS_TOKEN",
"type": "promptString",
"description": "GitHub access token",
"password": true
}
],
"servers": {
"policygate": {
"type": "stdio",
"command": "uvx",
"args": ["--from", "policygate:latest", "policygate-mcp"],
"env": {
"POLICYGATE__GITHUB_REPOSITORY_URL": "${input:POLICYGATE__GITHUB_REPOSITORY_URL}",
"POLICYGATE__GITHUB_ACCESS_TOKEN": "${input:POLICYGATE__GITHUB_ACCESS_TOKEN}"
},
}
}
}
For local testing from the current workspace (after uv sync --all-groups):
{
"inputs": [
{
"id": "POLICYGATE__GITHUB_REPOSITORY_URL",
"type": "promptString",
"description": "GitHub repository URL",
"password": false
},
{
"id": "POLICYGATE__GITHUB_ACCESS_TOKEN",
"type": "promptString",
"description": "GitHub access token",
"password": true
}
],
"servers": {
"policygate-local": {
"type": "stdio",
"command": "uv",
"args": ["run", "policygate-mcp"],
"env": {
"POLICYGATE__GITHUB_REPOSITORY_URL": "${input:POLICYGATE__GITHUB_REPOSITORY_URL}",
"POLICYGATE__GITHUB_ACCESS_TOKEN": "${input:POLICYGATE__GITHUB_ACCESS_TOKEN}"
},
"cwd": "${workspaceFolder}"
}
}
}
Testing
Run feature-organized end-to-end suites:
uv run pytest --maxfail=1 --tb=short
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file policygate-0.1.1.tar.gz.
File metadata
- Download URL: policygate-0.1.1.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e42168598e50d8538c9525c26b3f3f9841d5d80c6091b2f4d6a8b14a4ef83a97
|
|
| MD5 |
6725b80e6e8637cdf72ae3b67f9fd7ad
|
|
| BLAKE2b-256 |
04f6880edfaf9e49a0591dfcf899b59e3c146a3d2e0f2af0f92d94489ccb41ba
|
Provenance
The following attestation bundles were made for policygate-0.1.1.tar.gz:
Publisher:
publish-to-pypi.yml on l0kifs/policygate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
policygate-0.1.1.tar.gz -
Subject digest:
e42168598e50d8538c9525c26b3f3f9841d5d80c6091b2f4d6a8b14a4ef83a97 - Sigstore transparency entry: 982994686
- Sigstore integration time:
-
Permalink:
l0kifs/policygate@35aaca590d86c15bfb29e8091ac4210063ce00cc -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/l0kifs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@35aaca590d86c15bfb29e8091ac4210063ce00cc -
Trigger Event:
release
-
Statement type:
File details
Details for the file policygate-0.1.1-py3-none-any.whl.
File metadata
- Download URL: policygate-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02dda5bbf084d58ca5c26101e05a7ad6f9215a7cd61c6bb9e0cda85b034232a9
|
|
| MD5 |
ea51193a896634f8e7e3a206756d67f8
|
|
| BLAKE2b-256 |
b4dc86df1e09882ef8b1ffe708f586bd48105f3b14d180b30c8414cf1091d00b
|
Provenance
The following attestation bundles were made for policygate-0.1.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on l0kifs/policygate
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
policygate-0.1.1-py3-none-any.whl -
Subject digest:
02dda5bbf084d58ca5c26101e05a7ad6f9215a7cd61c6bb9e0cda85b034232a9 - Sigstore transparency entry: 982994716
- Sigstore integration time:
-
Permalink:
l0kifs/policygate@35aaca590d86c15bfb29e8091ac4210063ce00cc -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/l0kifs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@35aaca590d86c15bfb29e8091ac4210063ce00cc -
Trigger Event:
release
-
Statement type: