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)POLICYGATE__LOG_LEVEL(optional, defaultINFO)POLICYGATE__LOG_FILE_PATH(optional, default~/.policygate/policygate.log)
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
Metadata
Release files for policygate 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| policygate-0.1.3.tar.gz | 10.6 kB | With provenance | Details for policygate-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| policygate-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for policygate-0.1.3-py3-none-any.whl |
Total release size: 26.3 kB
Release files / policygate-0.1.3.tar.gz
| Download URL | policygate-0.1.3.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0d14d834d960bef609e8d974a1cbc7333f71e5a837dc44bc0799cf7b1d3fe13a
|
|
BLAKE2b-256 checksum How to use checksums |
a0b8d1a737ac1abd023075446de1d0281567e788cb1c61b98b57dd41bd6d9352
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 1, 2026.
Transparency logRelease files / policygate-0.1.3-py3-none-any.whl
| Download URL | policygate-0.1.3-py3-none-any.whl |
|---|---|
| Size | 15.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d18a4eb86773749645f92aafe36e9572f862685726394014faeccdac7a46703c
|
|
BLAKE2b-256 checksum How to use checksums |
6c2d0afae9add626618c1aa7363ee3a8cedeba56ba3a1c364080409ea9b50a5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 1, 2026.
Transparency logSecurity for policygate 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for policygate-0.1.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.