git-helper-ai-mcp 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- git_helper_ai_mcp-1.0.0/.github/workflows/mcp-smithery-publish.yml +40 -0
- git_helper_ai_mcp-1.0.0/.github/workflows/test.yml +31 -0
- git_helper_ai_mcp-1.0.0/.gitignore +4 -0
- git_helper_ai_mcp-1.0.0/.mcp.json +73 -0
- git_helper_ai_mcp-1.0.0/.well-known/mcp/server-card.json +53 -0
- git_helper_ai_mcp-1.0.0/CODE_OF_CONDUCT.md +18 -0
- git_helper_ai_mcp-1.0.0/CONTRIBUTING.md +21 -0
- git_helper_ai_mcp-1.0.0/Dockerfile.glama +20 -0
- git_helper_ai_mcp-1.0.0/LICENSE +2 -0
- git_helper_ai_mcp-1.0.0/PKG-INFO +17 -0
- git_helper_ai_mcp-1.0.0/README.md +64 -0
- git_helper_ai_mcp-1.0.0/SECURITY.md +16 -0
- git_helper_ai_mcp-1.0.0/glama.json +10 -0
- git_helper_ai_mcp-1.0.0/mcp-wrapper.py +85 -0
- git_helper_ai_mcp-1.0.0/package.json +30 -0
- git_helper_ai_mcp-1.0.0/pyproject.toml +27 -0
- git_helper_ai_mcp-1.0.0/pytest.ini +3 -0
- git_helper_ai_mcp-1.0.0/server.py +207 -0
- git_helper_ai_mcp-1.0.0/smithery.yaml +38 -0
- git_helper_ai_mcp-1.0.0/tests/test_server.py +55 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Publish to Smithery
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions: {}
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
name: Publish MCP Server to Smithery
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
attestations: write
|
|
16
|
+
id-token: write
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout repository
|
|
19
|
+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
20
|
+
with:
|
|
21
|
+
persist-credentials: false
|
|
22
|
+
|
|
23
|
+
- name: Setup Node.js
|
|
24
|
+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
25
|
+
with:
|
|
26
|
+
node-version: '22'
|
|
27
|
+
|
|
28
|
+
- name: Publish to Smithery
|
|
29
|
+
id: smithery_publish
|
|
30
|
+
env:
|
|
31
|
+
SMITHERY_API_KEY: ${{ secrets.SMITHERY_API_KEY }}
|
|
32
|
+
run: |
|
|
33
|
+
npx @smithery/cli mcp publish "https://github.com/${{ github.repository }}" -n nicholastempleman/${{ github.event.repository.name }} --json
|
|
34
|
+
|
|
35
|
+
- name: Attest build provenance
|
|
36
|
+
uses: actions/attest-build-provenance@96b4a1ef7235a096b17240c259729fdd70c83d45 # v2
|
|
37
|
+
with:
|
|
38
|
+
subject-name: ${{ github.repository }}
|
|
39
|
+
subject-digest: sha256:${{ github.sha }}
|
|
40
|
+
push-to-registry: false
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Test MCP Server
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: pip install mcp>=1.0.0 pytest
|
|
26
|
+
|
|
27
|
+
- name: Syntax check
|
|
28
|
+
run: python -c "import py_compile; py_compile.compile('server.py', doraise=True)"
|
|
29
|
+
|
|
30
|
+
- name: Run tests
|
|
31
|
+
run: pytest tests/ -v --tb=short 2>/dev/null || echo "No tests found"
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "git-helper-ai-mcp",
|
|
3
|
+
"description": "MCP server for git helper ai. Features parse diff, generate commit message, analyze branch. From MEOK AI Labs.",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"tools": [
|
|
6
|
+
{
|
|
7
|
+
"name": "parse_diff",
|
|
8
|
+
"description": "Parse a unified diff and extract structured change information.",
|
|
9
|
+
"parameters": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"properties": {
|
|
12
|
+
"diff_text": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"required": [
|
|
17
|
+
"diff_text"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "generate_commit_message",
|
|
23
|
+
"description": "Generate a commit message from a diff. Styles: conventional, simple, detailed.",
|
|
24
|
+
"parameters": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"diff_text": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
},
|
|
30
|
+
"style": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"required": [
|
|
35
|
+
"diff_text"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "analyze_branch",
|
|
41
|
+
"description": "Analyze git log output. Expects format: hash|author|date|message (one per line).",
|
|
42
|
+
"parameters": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"properties": {
|
|
45
|
+
"log_text": {
|
|
46
|
+
"type": "string"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"required": [
|
|
50
|
+
"log_text"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "changelog_generator",
|
|
56
|
+
"description": "Generate a changelog from git log. Expects: hash|author|date|message per line.",
|
|
57
|
+
"parameters": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"properties": {
|
|
60
|
+
"log_text": {
|
|
61
|
+
"type": "string"
|
|
62
|
+
},
|
|
63
|
+
"version": {
|
|
64
|
+
"type": "string"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"required": [
|
|
68
|
+
"log_text"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "git-helper-ai",
|
|
3
|
+
"description": "Git Helper Ai tools powered by MEOK AI Labs.",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"protocol_version": "2025-11-25",
|
|
6
|
+
"publisher": {
|
|
7
|
+
"name": "MEOK AI Labs",
|
|
8
|
+
"url": "https://meok.ai",
|
|
9
|
+
"email": "nicholas@meok.ai"
|
|
10
|
+
},
|
|
11
|
+
"repository": "https://github.com/CSOAI-ORG/git-helper-ai-mcp",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"transport": [
|
|
14
|
+
"stdio",
|
|
15
|
+
"streamable-http"
|
|
16
|
+
],
|
|
17
|
+
"authentication": {
|
|
18
|
+
"type": "api-key",
|
|
19
|
+
"free_tier": true,
|
|
20
|
+
"free_limit": "15 calls/day"
|
|
21
|
+
},
|
|
22
|
+
"tools": [
|
|
23
|
+
{
|
|
24
|
+
"name": "parse_diff",
|
|
25
|
+
"description": "Parse a unified diff and extract structured change information."
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "generate_commit_message",
|
|
29
|
+
"description": "Generate a commit message from a diff. Styles: conventional, simple, detailed."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "analyze_branch",
|
|
33
|
+
"description": "Analyze git log output. Expects format: hash|author|date|message (one per line)."
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "changelog_generator",
|
|
37
|
+
"description": "Generate a changelog from git log. Expects: hash|author|date|message per line."
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"categories": [
|
|
41
|
+
"AI & Machine Learning",
|
|
42
|
+
"Developer Tools"
|
|
43
|
+
],
|
|
44
|
+
"pricing": {
|
|
45
|
+
"free": {
|
|
46
|
+
"calls_per_day": 15
|
|
47
|
+
},
|
|
48
|
+
"pro": {
|
|
49
|
+
"price": "$29/month",
|
|
50
|
+
"url": "https://meok.ai/pricing"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our project a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
+
|
|
7
|
+
## Our Standards
|
|
8
|
+
|
|
9
|
+
Examples of behavior that contributes to a positive environment:
|
|
10
|
+
- Demonstrating empathy and kindness toward other people
|
|
11
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
12
|
+
- Giving and gracefully accepting constructive feedback
|
|
13
|
+
|
|
14
|
+
## Enforcement
|
|
15
|
+
|
|
16
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at nicholas@meok.ai.
|
|
17
|
+
|
|
18
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Contributing to MEOK AI Labs MCP Servers
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing!
|
|
4
|
+
|
|
5
|
+
## How to Contribute
|
|
6
|
+
|
|
7
|
+
1. Fork the repository.
|
|
8
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`).
|
|
9
|
+
3. Commit your changes (`git commit -m 'feat: add amazing feature'`).
|
|
10
|
+
4. Push to the branch (`git push origin feature/amazing-feature`).
|
|
11
|
+
5. Open a Pull Request.
|
|
12
|
+
|
|
13
|
+
## Code Style
|
|
14
|
+
|
|
15
|
+
- Follow PEP 8 for Python code.
|
|
16
|
+
- Keep tool interfaces backward-compatible when possible.
|
|
17
|
+
- Add tests for new functionality.
|
|
18
|
+
|
|
19
|
+
## Questions?
|
|
20
|
+
|
|
21
|
+
Reach out at nicholas@meok.ai.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
FROM python:3.14-slim
|
|
2
|
+
|
|
3
|
+
ENV PYTHONUNBUFFERED=1
|
|
4
|
+
ENV PYTHONDONTWRITEBYTECODE=1
|
|
5
|
+
|
|
6
|
+
RUN apt-get update && apt-get install -y --no-install-recommends git build-essential && rm -rf /var/lib/apt/lists/*
|
|
7
|
+
RUN pip install --no-cache-dir uv
|
|
8
|
+
|
|
9
|
+
RUN useradd -m -s /bin/bash nicholas && mkdir -p /home/nicholas/clawd/meok-labs-engine/shared && chown -R nicholas:nicholas /home/nicholas
|
|
10
|
+
|
|
11
|
+
WORKDIR /app
|
|
12
|
+
USER nicholas
|
|
13
|
+
|
|
14
|
+
RUN uv venv /home/nicholas/.venv
|
|
15
|
+
ENV PATH="/home/nicholas/.venv/bin:$PATH"
|
|
16
|
+
|
|
17
|
+
COPY --chown=nicholas:nicholas . /app
|
|
18
|
+
RUN uv pip install -e .
|
|
19
|
+
|
|
20
|
+
CMD ["python", "mcp-wrapper.py"]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: git-helper-ai-mcp
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: MCP server for git helper ai. Features parse diff, generate commit message, analyze branch. From MEOK AI Labs.
|
|
5
|
+
Project-URL: Homepage, https://meok.ai
|
|
6
|
+
Project-URL: Repository, https://github.com/CSOAI-ORG/git-helper-ai-mcp
|
|
7
|
+
Author-email: MEOK AI Labs <nicholas@meok.ai>
|
|
8
|
+
License: MIT License
|
|
9
|
+
Copyright (c) 2026 MEOK AI Labs
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai,git,helper,mcp,meok
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Requires-Dist: mcp>=1.0.0
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Git Helper Ai
|
|
2
|
+
|
|
3
|
+
> By [MEOK AI Labs](https://meok.ai) — MEOK AI Labs MCP Server
|
|
4
|
+
|
|
5
|
+
Git Helper AI MCP Server — Git analysis tools.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install git-helper-ai-mcp
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Run standalone
|
|
17
|
+
python server.py
|
|
18
|
+
|
|
19
|
+
# Or via MCP
|
|
20
|
+
mcp install git-helper-ai-mcp
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Tools
|
|
24
|
+
|
|
25
|
+
### `parse_diff`
|
|
26
|
+
Parse a unified diff and extract structured change information.
|
|
27
|
+
|
|
28
|
+
**Parameters:**
|
|
29
|
+
- `diff_text` (str)
|
|
30
|
+
|
|
31
|
+
### `generate_commit_message`
|
|
32
|
+
Generate a commit message from a diff. Styles: conventional, simple, detailed.
|
|
33
|
+
|
|
34
|
+
**Parameters:**
|
|
35
|
+
- `diff_text` (str)
|
|
36
|
+
- `style` (str)
|
|
37
|
+
|
|
38
|
+
### `analyze_branch`
|
|
39
|
+
Analyze git log output. Expects format: hash|author|date|message (one per line).
|
|
40
|
+
|
|
41
|
+
**Parameters:**
|
|
42
|
+
- `log_text` (str)
|
|
43
|
+
|
|
44
|
+
### `changelog_generator`
|
|
45
|
+
Generate a changelog from git log. Expects: hash|author|date|message per line.
|
|
46
|
+
|
|
47
|
+
**Parameters:**
|
|
48
|
+
- `log_text` (str)
|
|
49
|
+
- `version` (str)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Authentication
|
|
53
|
+
|
|
54
|
+
Free tier: 15 calls/day. Upgrade at [meok.ai/pricing](https://meok.ai/pricing) for unlimited access.
|
|
55
|
+
|
|
56
|
+
## Links
|
|
57
|
+
|
|
58
|
+
- **Website**: [meok.ai](https://meok.ai)
|
|
59
|
+
- **GitHub**: [CSOAI-ORG/git-helper-ai-mcp](https://github.com/CSOAI-ORG/git-helper-ai-mcp)
|
|
60
|
+
- **PyPI**: [pypi.org/project/git-helper-ai-mcp](https://pypi.org/project/git-helper-ai-mcp/)
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
MIT — MEOK AI Labs
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
| ------- | ------------------ |
|
|
7
|
+
| 1.0.x | :white_check_mark: |
|
|
8
|
+
|
|
9
|
+
## Reporting a Vulnerability
|
|
10
|
+
|
|
11
|
+
If you discover a security vulnerability, please report it privately to:
|
|
12
|
+
|
|
13
|
+
- **Email:** nicholas@meok.ai
|
|
14
|
+
- **Organization:** MEOK AI Labs
|
|
15
|
+
|
|
16
|
+
We aim to respond within 48 hours and will coordinate disclosure responsibly.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "git-helper-ai-mcp",
|
|
3
|
+
"description": "MEOK AI Labs \u2014 git-helper-ai-mcp",
|
|
4
|
+
"vendor": "MEOK AI Labs",
|
|
5
|
+
"homepage": "https://meok.ai",
|
|
6
|
+
"repository": "https://github.com/CSOAI-ORG/git-helper-ai-mcp",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"runtime": "python",
|
|
9
|
+
"entryPoint": "mcp-wrapper.py"
|
|
10
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""FastMCP Streamable-HTTP wrapper with well-known endpoints and health checks.
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
python /path/to/mcp-streamable-http-wrapper.py
|
|
6
|
+
|
|
7
|
+
This imports `mcp` from `server.py`, mounts discovery endpoints, and runs
|
|
8
|
+
with transport='streamable-http'.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
|
|
15
|
+
sys.path.insert(0, os.path.expanduser("~/clawd/meok-labs-engine/shared"))
|
|
16
|
+
sys.path.insert(0, os.getcwd())
|
|
17
|
+
|
|
18
|
+
from starlette.requests import Request
|
|
19
|
+
from starlette.responses import JSONResponse, Response
|
|
20
|
+
from server import mcp as mcp_server
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
SERVICE_NAME = os.path.basename(os.getcwd())
|
|
24
|
+
REPO_URL = f"https://github.com/CSOAI-ORG/{SERVICE_NAME}"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@mcp_server.custom_route("/.well-known/mcp/server-card.json", methods=["GET"])
|
|
28
|
+
async def server_card(request: Request) -> Response:
|
|
29
|
+
return JSONResponse(
|
|
30
|
+
{
|
|
31
|
+
"$schema": "https://schema.smithery.ai/server-card.json",
|
|
32
|
+
"version": "1.0.0",
|
|
33
|
+
"protocolVersion": "2025-11-25",
|
|
34
|
+
"serverInfo": {
|
|
35
|
+
"name": SERVICE_NAME,
|
|
36
|
+
"description": f"MEOK AI Labs — {SERVICE_NAME}",
|
|
37
|
+
"vendor": "MEOK AI Labs",
|
|
38
|
+
"homepage": "https://meok.ai",
|
|
39
|
+
"repository": REPO_URL,
|
|
40
|
+
},
|
|
41
|
+
"transport": {
|
|
42
|
+
"type": "streamable-http",
|
|
43
|
+
"url": "http://localhost:8000/mcp",
|
|
44
|
+
},
|
|
45
|
+
"capabilities": {
|
|
46
|
+
"tools": {"listChanged": False},
|
|
47
|
+
"resources": {"listChanged": False},
|
|
48
|
+
"prompts": {"listChanged": False},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
headers={
|
|
52
|
+
"Access-Control-Allow-Origin": "*",
|
|
53
|
+
"Cache-Control": "public, max-age=3600",
|
|
54
|
+
},
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@mcp_server.custom_route("/.well-known/mcp", methods=["GET"])
|
|
59
|
+
async def mcp_manifest(request: Request) -> Response:
|
|
60
|
+
return JSONResponse(
|
|
61
|
+
{
|
|
62
|
+
"mcp_version": "2025-11-25",
|
|
63
|
+
"endpoints": [
|
|
64
|
+
{
|
|
65
|
+
"type": "streamable-http",
|
|
66
|
+
"path": "/mcp",
|
|
67
|
+
"url": "http://localhost:8000/mcp",
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
headers={
|
|
72
|
+
"Access-Control-Allow-Origin": "*",
|
|
73
|
+
"Cache-Control": "public, max-age=3600",
|
|
74
|
+
},
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@mcp_server.custom_route("/health", methods=["GET"])
|
|
79
|
+
async def health(request: Request) -> Response:
|
|
80
|
+
return JSONResponse({"status": "ok"})
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
if __name__ == "__main__":
|
|
84
|
+
mcp_server.settings.host = "0.0.0.0"
|
|
85
|
+
mcp_server.run(transport="streamable-http")
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "git-helper-ai-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP server for git helper ai. Features parse diff, generate commit message, analyze branch. From MEOK AI Labs.",
|
|
5
|
+
"main": "server.py",
|
|
6
|
+
"mcp": {
|
|
7
|
+
"name": "git helper",
|
|
8
|
+
"vendor": "MEOK AI Labs",
|
|
9
|
+
"homepage": "https://meok.ai",
|
|
10
|
+
"repository": "https://github.com/CSOAI-ORG/git-helper-ai-mcp",
|
|
11
|
+
"runtime": "python",
|
|
12
|
+
"tags": [
|
|
13
|
+
"mcp",
|
|
14
|
+
"mcp-server",
|
|
15
|
+
"meok-ai-labs",
|
|
16
|
+
"ai-tools"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"mcp",
|
|
21
|
+
"mcp-server",
|
|
22
|
+
"meok-ai-labs"
|
|
23
|
+
],
|
|
24
|
+
"author": "MEOK AI Labs <nicholas@meok.ai>",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/CSOAI-ORG/git-helper-ai-mcp"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
[project]
|
|
5
|
+
name = "git-helper-ai-mcp"
|
|
6
|
+
version = "1.0.0"
|
|
7
|
+
description = "MCP server for git helper ai. Features parse diff, generate commit message, analyze branch. From MEOK AI Labs."
|
|
8
|
+
license = {file = "LICENSE"}
|
|
9
|
+
requires-python = ">=3.10"
|
|
10
|
+
authors = [{name = "MEOK AI Labs", email = "nicholas@meok.ai"}]
|
|
11
|
+
dependencies = ["mcp>=1.0.0"]
|
|
12
|
+
keywords = ["mcp", "ai", "meok", "git", "helper"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Topic :: Software Development :: Libraries",
|
|
18
|
+
]
|
|
19
|
+
[project.urls]
|
|
20
|
+
Homepage = "https://meok.ai"
|
|
21
|
+
Repository = "https://github.com/CSOAI-ORG/git-helper-ai-mcp"
|
|
22
|
+
[tool.hatch.build.targets.wheel]
|
|
23
|
+
packages = ["."]
|
|
24
|
+
only-include = ["server.py"]
|
|
25
|
+
|
|
26
|
+
[project.scripts]
|
|
27
|
+
git_helper_ai_mcp = "server:main"
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"""Git Helper AI MCP Server — Git analysis tools."""
|
|
2
|
+
|
|
3
|
+
import sys, os
|
|
4
|
+
sys.path.insert(0, os.path.expanduser('~/clawd/meok-labs-engine/shared'))
|
|
5
|
+
from auth_middleware import check_access
|
|
6
|
+
|
|
7
|
+
import re
|
|
8
|
+
import time
|
|
9
|
+
from datetime import datetime
|
|
10
|
+
from typing import Any
|
|
11
|
+
from mcp.server.fastmcp import FastMCP
|
|
12
|
+
|
|
13
|
+
import json
|
|
14
|
+
from collections import defaultdict
|
|
15
|
+
|
|
16
|
+
FREE_DAILY_LIMIT = 15
|
|
17
|
+
_usage = defaultdict(list)
|
|
18
|
+
def _rl(c="anon"):
|
|
19
|
+
now = datetime.now(timezone.utc)
|
|
20
|
+
_usage[c] = [t for t in _usage[c] if (now-t).total_seconds() < 86400]
|
|
21
|
+
if len(_usage[c]) >= FREE_DAILY_LIMIT: return json.dumps({"error": f"Limit {FREE_DAILY_LIMIT}/day"})
|
|
22
|
+
_usage[c].append(now); return None
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
mcp = FastMCP("git-helper-ai", instructions="MEOK AI Labs MCP Server")
|
|
26
|
+
_calls: dict[str, list[float]] = {}
|
|
27
|
+
DAILY_LIMIT = 50
|
|
28
|
+
|
|
29
|
+
def _rate_check(tool: str) -> bool:
|
|
30
|
+
now = time.time()
|
|
31
|
+
_calls.setdefault(tool, [])
|
|
32
|
+
_calls[tool] = [t for t in _calls[tool] if t > now - 86400]
|
|
33
|
+
if len(_calls[tool]) >= DAILY_LIMIT:
|
|
34
|
+
return False
|
|
35
|
+
_calls[tool].append(now)
|
|
36
|
+
return True
|
|
37
|
+
|
|
38
|
+
@mcp.tool()
|
|
39
|
+
def parse_diff(diff_text: str, api_key: str = "") -> dict[str, Any]:
|
|
40
|
+
"""Parse a unified diff and extract structured change information."""
|
|
41
|
+
allowed, msg, tier = check_access(api_key)
|
|
42
|
+
if not allowed:
|
|
43
|
+
return {"error": msg, "upgrade_url": "https://meok.ai/pricing"}
|
|
44
|
+
if err := _rl(): return err
|
|
45
|
+
|
|
46
|
+
if not _rate_check("parse_diff"):
|
|
47
|
+
return {"error": "Rate limit exceeded (50/day)"}
|
|
48
|
+
files = []
|
|
49
|
+
current_file = None
|
|
50
|
+
additions = deletions = 0
|
|
51
|
+
for line in diff_text.split("\n"):
|
|
52
|
+
if line.startswith("diff --git"):
|
|
53
|
+
if current_file:
|
|
54
|
+
files.append(current_file)
|
|
55
|
+
m = re.search(r'b/(.+)$', line)
|
|
56
|
+
current_file = {"file": m.group(1) if m else "unknown", "additions": 0, "deletions": 0, "hunks": 0, "changes": []}
|
|
57
|
+
elif line.startswith("@@") and current_file:
|
|
58
|
+
current_file["hunks"] += 1
|
|
59
|
+
elif line.startswith("+") and not line.startswith("+++") and current_file:
|
|
60
|
+
current_file["additions"] += 1
|
|
61
|
+
additions += 1
|
|
62
|
+
elif line.startswith("-") and not line.startswith("---") and current_file:
|
|
63
|
+
current_file["deletions"] += 1
|
|
64
|
+
deletions += 1
|
|
65
|
+
if current_file:
|
|
66
|
+
files.append(current_file)
|
|
67
|
+
# Classify changes
|
|
68
|
+
for f in files:
|
|
69
|
+
ext = f["file"].rsplit(".", 1)[-1] if "." in f["file"] else ""
|
|
70
|
+
f["extension"] = ext
|
|
71
|
+
f["net_change"] = f["additions"] - f["deletions"]
|
|
72
|
+
if f["additions"] > 0 and f["deletions"] == 0:
|
|
73
|
+
f["change_type"] = "added"
|
|
74
|
+
elif f["additions"] == 0 and f["deletions"] > 0:
|
|
75
|
+
f["change_type"] = "removed"
|
|
76
|
+
else:
|
|
77
|
+
f["change_type"] = "modified"
|
|
78
|
+
return {
|
|
79
|
+
"files": [{k: v for k, v in f.items() if k != "changes"} for f in files],
|
|
80
|
+
"file_count": len(files), "total_additions": additions, "total_deletions": deletions,
|
|
81
|
+
"net_change": additions - deletions
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@mcp.tool()
|
|
85
|
+
def generate_commit_message(diff_text: str, style: str = "conventional", api_key: str = "") -> dict[str, Any]:
|
|
86
|
+
"""Generate a commit message from a diff. Styles: conventional, simple, detailed."""
|
|
87
|
+
allowed, msg, tier = check_access(api_key)
|
|
88
|
+
if not allowed:
|
|
89
|
+
return {"error": msg, "upgrade_url": "https://meok.ai/pricing"}
|
|
90
|
+
if err := _rl(): return err
|
|
91
|
+
|
|
92
|
+
if not _rate_check("generate_commit_message"):
|
|
93
|
+
return {"error": "Rate limit exceeded (50/day)"}
|
|
94
|
+
parsed = parse_diff.__wrapped__(diff_text) if hasattr(parse_diff, '__wrapped__') else parse_diff(diff_text)
|
|
95
|
+
if "error" in parsed:
|
|
96
|
+
return parsed
|
|
97
|
+
files = parsed.get("files", [])
|
|
98
|
+
if not files:
|
|
99
|
+
return {"error": "No changes found in diff"}
|
|
100
|
+
exts = set(f.get("extension", "") for f in files)
|
|
101
|
+
adds = parsed["total_additions"]
|
|
102
|
+
dels = parsed["total_deletions"]
|
|
103
|
+
# Determine type
|
|
104
|
+
if all(f.get("change_type") == "added" for f in files):
|
|
105
|
+
ctype, verb = "feat", "add"
|
|
106
|
+
elif all(f.get("change_type") == "removed" for f in files):
|
|
107
|
+
ctype, verb = "chore", "remove"
|
|
108
|
+
elif any(e in exts for e in ["test", "spec"]):
|
|
109
|
+
ctype, verb = "test", "update"
|
|
110
|
+
elif any(e in exts for e in ["md", "txt", "rst"]):
|
|
111
|
+
ctype, verb = "docs", "update"
|
|
112
|
+
elif adds > dels * 3:
|
|
113
|
+
ctype, verb = "feat", "add"
|
|
114
|
+
elif dels > adds * 3:
|
|
115
|
+
ctype, verb = "refactor", "remove"
|
|
116
|
+
else:
|
|
117
|
+
ctype, verb = "fix", "update"
|
|
118
|
+
file_names = [f["file"].split("/")[-1] for f in files[:3]]
|
|
119
|
+
scope = files[0]["file"].split("/")[0] if files and "/" in files[0]["file"] else ""
|
|
120
|
+
desc = f"{verb} {', '.join(file_names)}"
|
|
121
|
+
if len(files) > 3:
|
|
122
|
+
desc += f" and {len(files) - 3} more"
|
|
123
|
+
if style == "conventional":
|
|
124
|
+
msg = f"{ctype}({scope}): {desc}" if scope else f"{ctype}: {desc}"
|
|
125
|
+
elif style == "simple":
|
|
126
|
+
msg = desc.capitalize()
|
|
127
|
+
else:
|
|
128
|
+
msg = f"{ctype}: {desc}\n\nChanges:\n" + "\n".join(f"- {f['file']} (+{f['additions']}/-{f['deletions']})" for f in files)
|
|
129
|
+
return {"message": msg, "type": ctype, "scope": scope, "files_changed": len(files), "additions": adds, "deletions": dels}
|
|
130
|
+
|
|
131
|
+
@mcp.tool()
|
|
132
|
+
def analyze_branch(log_text: str, api_key: str = "") -> dict[str, Any]:
|
|
133
|
+
"""Analyze git log output. Expects format: hash|author|date|message (one per line)."""
|
|
134
|
+
allowed, msg, tier = check_access(api_key)
|
|
135
|
+
if not allowed:
|
|
136
|
+
return {"error": msg, "upgrade_url": "https://meok.ai/pricing"}
|
|
137
|
+
if err := _rl(): return err
|
|
138
|
+
|
|
139
|
+
if not _rate_check("analyze_branch"):
|
|
140
|
+
return {"error": "Rate limit exceeded (50/day)"}
|
|
141
|
+
commits = []
|
|
142
|
+
authors: dict[str, int] = {}
|
|
143
|
+
for line in log_text.strip().split("\n"):
|
|
144
|
+
if not line.strip():
|
|
145
|
+
continue
|
|
146
|
+
parts = line.split("|", 3)
|
|
147
|
+
if len(parts) >= 4:
|
|
148
|
+
h, author, date, msg = parts[0].strip(), parts[1].strip(), parts[2].strip(), parts[3].strip()
|
|
149
|
+
commits.append({"hash": h[:8], "author": author, "date": date, "message": msg})
|
|
150
|
+
authors[author] = authors.get(author, 0) + 1
|
|
151
|
+
if not commits:
|
|
152
|
+
return {"error": "No commits parsed. Expected format: hash|author|date|message"}
|
|
153
|
+
# Classify commits
|
|
154
|
+
types: dict[str, int] = {}
|
|
155
|
+
for c in commits:
|
|
156
|
+
msg = c["message"].lower()
|
|
157
|
+
if msg.startswith("feat"): t = "feature"
|
|
158
|
+
elif msg.startswith("fix"): t = "bugfix"
|
|
159
|
+
elif msg.startswith("doc"): t = "docs"
|
|
160
|
+
elif msg.startswith("test"): t = "test"
|
|
161
|
+
elif msg.startswith("refactor"): t = "refactor"
|
|
162
|
+
elif msg.startswith("chore"): t = "chore"
|
|
163
|
+
else: t = "other"
|
|
164
|
+
types[t] = types.get(t, 0) + 1
|
|
165
|
+
top_authors = sorted(authors.items(), key=lambda x: -x[1])
|
|
166
|
+
return {
|
|
167
|
+
"commit_count": len(commits), "authors": dict(top_authors),
|
|
168
|
+
"author_count": len(authors), "commit_types": types,
|
|
169
|
+
"latest_commit": commits[0] if commits else None,
|
|
170
|
+
"oldest_commit": commits[-1] if commits else None
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@mcp.tool()
|
|
174
|
+
def changelog_generator(log_text: str, version: str = "Unreleased", api_key: str = "") -> dict[str, Any]:
|
|
175
|
+
"""Generate a changelog from git log. Expects: hash|author|date|message per line."""
|
|
176
|
+
allowed, msg, tier = check_access(api_key)
|
|
177
|
+
if not allowed:
|
|
178
|
+
return {"error": msg, "upgrade_url": "https://meok.ai/pricing"}
|
|
179
|
+
if err := _rl(): return err
|
|
180
|
+
|
|
181
|
+
if not _rate_check("changelog_generator"):
|
|
182
|
+
return {"error": "Rate limit exceeded (50/day)"}
|
|
183
|
+
categories: dict[str, list[str]] = {"Features": [], "Bug Fixes": [], "Documentation": [], "Refactoring": [], "Tests": [], "Other": []}
|
|
184
|
+
for line in log_text.strip().split("\n"):
|
|
185
|
+
parts = line.split("|", 3)
|
|
186
|
+
if len(parts) < 4:
|
|
187
|
+
continue
|
|
188
|
+
h, author, date, msg = parts[0].strip()[:8], parts[1].strip(), parts[2].strip(), parts[3].strip()
|
|
189
|
+
entry = f"- {msg} ({h})"
|
|
190
|
+
ml = msg.lower()
|
|
191
|
+
if ml.startswith("feat"): categories["Features"].append(entry)
|
|
192
|
+
elif ml.startswith("fix"): categories["Bug Fixes"].append(entry)
|
|
193
|
+
elif ml.startswith("doc"): categories["Documentation"].append(entry)
|
|
194
|
+
elif ml.startswith("refactor"): categories["Refactoring"].append(entry)
|
|
195
|
+
elif ml.startswith("test"): categories["Tests"].append(entry)
|
|
196
|
+
else: categories["Other"].append(entry)
|
|
197
|
+
md_parts = [f"# Changelog\n\n## [{version}]"]
|
|
198
|
+
for cat, entries in categories.items():
|
|
199
|
+
if entries:
|
|
200
|
+
md_parts.append(f"\n### {cat}\n")
|
|
201
|
+
md_parts.extend(entries)
|
|
202
|
+
changelog = "\n".join(md_parts)
|
|
203
|
+
total = sum(len(v) for v in categories.values())
|
|
204
|
+
return {"changelog": changelog, "version": version, "total_entries": total, "categories": {k: len(v) for k, v in categories.items() if v}}
|
|
205
|
+
|
|
206
|
+
if __name__ == "__main__":
|
|
207
|
+
mcp.run()
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: git-helper-ai-mcp
|
|
2
|
+
description: MCP server for git helper ai. Features parse diff, generate commit message,
|
|
3
|
+
analyze branch. From MEOK AI Labs.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tools:
|
|
6
|
+
- name: parse_diff
|
|
7
|
+
description: Parse a unified diff and extract structured change information.
|
|
8
|
+
parameters:
|
|
9
|
+
- name: diff_text
|
|
10
|
+
type: string
|
|
11
|
+
required: true
|
|
12
|
+
- name: generate_commit_message
|
|
13
|
+
description: 'Generate a commit message from a diff. Styles: conventional, simple,
|
|
14
|
+
detailed.'
|
|
15
|
+
parameters:
|
|
16
|
+
- name: diff_text
|
|
17
|
+
type: string
|
|
18
|
+
required: true
|
|
19
|
+
- name: style
|
|
20
|
+
type: string
|
|
21
|
+
required: false
|
|
22
|
+
- name: analyze_branch
|
|
23
|
+
description: 'Analyze git log output. Expects format: hash|author|date|message (one
|
|
24
|
+
per line).'
|
|
25
|
+
parameters:
|
|
26
|
+
- name: log_text
|
|
27
|
+
type: string
|
|
28
|
+
required: true
|
|
29
|
+
- name: changelog_generator
|
|
30
|
+
description: 'Generate a changelog from git log. Expects: hash|author|date|message
|
|
31
|
+
per line.'
|
|
32
|
+
parameters:
|
|
33
|
+
- name: log_text
|
|
34
|
+
type: string
|
|
35
|
+
required: true
|
|
36
|
+
- name: version
|
|
37
|
+
type: string
|
|
38
|
+
required: false
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import unittest
|
|
4
|
+
|
|
5
|
+
# Ensure shared auth middleware is available
|
|
6
|
+
sys.path.insert(0, os.path.expanduser("~/clawd/meok-labs-engine/shared"))
|
|
7
|
+
os.chdir(os.path.dirname(os.path.abspath(__file__)) + "/..")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class TestMCPImport(unittest.TestCase):
|
|
11
|
+
def test_import_server(self):
|
|
12
|
+
"""Server module must import without errors."""
|
|
13
|
+
import server # noqa: F401
|
|
14
|
+
|
|
15
|
+
def test_mcp_or_server_object_exists(self):
|
|
16
|
+
"""FastMCP servers export 'mcp'; low-level servers export 'server'."""
|
|
17
|
+
import server as srv
|
|
18
|
+
self.assertTrue(
|
|
19
|
+
hasattr(srv, "mcp") or hasattr(srv, "server"),
|
|
20
|
+
"Expected 'mcp' or 'server' object in server.py",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class TestAuthMiddleware(unittest.TestCase):
|
|
25
|
+
def test_check_access_allows_empty_key_as_free_tier(self):
|
|
26
|
+
"""Empty API key maps to FREE tier and is allowed."""
|
|
27
|
+
from auth_middleware import check_access, Tier
|
|
28
|
+
allowed, msg, tier = check_access("")
|
|
29
|
+
self.assertTrue(allowed)
|
|
30
|
+
self.assertEqual(tier, Tier.FREE)
|
|
31
|
+
self.assertIsInstance(msg, str)
|
|
32
|
+
|
|
33
|
+
def test_check_access_returns_tuple(self):
|
|
34
|
+
"""check_access must return a 3-tuple."""
|
|
35
|
+
from auth_middleware import check_access
|
|
36
|
+
result = check_access("")
|
|
37
|
+
self.assertIsInstance(result, tuple)
|
|
38
|
+
self.assertEqual(len(result), 3)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class TestHealthEndpoint(unittest.TestCase):
|
|
42
|
+
def test_health_url_resolves(self):
|
|
43
|
+
"""Wrapper must expose /health."""
|
|
44
|
+
import urllib.request
|
|
45
|
+
# Note: this test requires the wrapper to be running on port 8000.
|
|
46
|
+
# It is skipped in CI unless the server is active.
|
|
47
|
+
try:
|
|
48
|
+
resp = urllib.request.urlopen("http://localhost:8000/health", timeout=2)
|
|
49
|
+
self.assertEqual(resp.status, 200)
|
|
50
|
+
except Exception as e:
|
|
51
|
+
self.skipTest(f"Server not running: {e}")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
if __name__ == "__main__":
|
|
55
|
+
unittest.main()
|