# MCP Shared Library
Shared models and services for MCP (Model Context Protocol) components.
## Overview
This library provides common data models, services, and utilities used by:
- `mcp_local_repo_analyzer` - Git repository analysis tools
- `mcp_pr_recommender` - PR recommendation engine
## Installation
```bash
cd mcp_shared_lib
poetry install
```
## Usage
### Models
```python
from mcp_shared_lib.models import FileStatus, WorkingDirectoryChanges, RiskAssessment
# Create a file status
file_status = FileStatus(
path="src/main.py",
status_code="M",
lines_added=10,
lines_deleted=5
)
```
### Services
```python
from mcp_shared_lib.services import GitClient, ChangeDetector
from mcp_shared_lib.config import GitAnalyzerSettings
# Setup services
settings = GitAnalyzerSettings()
git_client = GitClient(settings)
change_detector = ChangeDetector(git_client)
# Use services
repo = LocalRepository(path=".", name="my-repo", current_branch="main", head_commit="abc123")
changes = await change_detector.detect_working_directory_changes(repo)
```
## Architecture
```
mcp_shared_lib/
├── models/ # Data models
│ ├── git/ # Git-related models
│ ├── analysis/ # Analysis models
│ ├── pr/ # PR models (Phase 2)
│ └── base/ # Base classes
├── services/ # Business logic services
│ ├── git/ # Git services
│ └── pr/ # PR services (Phase 2)
├── tools/ # Tool base classes
├── utils/ # Utility functions
└── config/ # Configuration management
```
## Development
### Running Tests
```bash
poetry run pytest
```
### Code Formatting
```bash
poetry run black .
poetry run isort .
```
### Type Checking
```bash
poetry run mypy .
```
## Migration Status
- ✅ Phase 1: Foundation setup (models from mcp_local_repo_analyzer)
- ⏳ Phase 2: PR models migration (from mcp_pr_recommender)
- ⏳ Phase 3: Service migration
- ⏳ Phase 4: Repository updates
- ⏳ Phase 5: Testing & cleanup
Raw data
{
"_id": null,
"home_page": "https://github.com/manavgup/mcp_shared_lib",
"name": "mcp-shared-lib",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "mcp, model-context-protocol, shared-library, transport, git",
"author": "Manav Gupta",
"author_email": "manavg@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/35/de/38478a512b6696f95093597deaef50ebdd91239924c4ddfa09814dfb8fd4/mcp_shared_lib-0.1.1.tar.gz",
"platform": null,
"description": "# MCP Shared Library\n\nShared models and services for MCP (Model Context Protocol) components.\n\n## Overview\n\nThis library provides common data models, services, and utilities used by:\n- `mcp_local_repo_analyzer` - Git repository analysis tools\n- `mcp_pr_recommender` - PR recommendation engine\n\n## Installation\n\n```bash\ncd mcp_shared_lib\npoetry install\n```\n\n## Usage\n\n### Models\n\n```python\nfrom mcp_shared_lib.models import FileStatus, WorkingDirectoryChanges, RiskAssessment\n\n# Create a file status\nfile_status = FileStatus(\n path=\"src/main.py\",\n status_code=\"M\",\n lines_added=10,\n lines_deleted=5\n)\n```\n\n### Services\n\n```python\nfrom mcp_shared_lib.services import GitClient, ChangeDetector\nfrom mcp_shared_lib.config import GitAnalyzerSettings\n\n# Setup services\nsettings = GitAnalyzerSettings()\ngit_client = GitClient(settings)\nchange_detector = ChangeDetector(git_client)\n\n# Use services\nrepo = LocalRepository(path=\".\", name=\"my-repo\", current_branch=\"main\", head_commit=\"abc123\")\nchanges = await change_detector.detect_working_directory_changes(repo)\n```\n\n## Architecture\n\n```\nmcp_shared_lib/\n\u251c\u2500\u2500 models/ # Data models\n\u2502 \u251c\u2500\u2500 git/ # Git-related models\n\u2502 \u251c\u2500\u2500 analysis/ # Analysis models\n\u2502 \u251c\u2500\u2500 pr/ # PR models (Phase 2)\n\u2502 \u2514\u2500\u2500 base/ # Base classes\n\u251c\u2500\u2500 services/ # Business logic services\n\u2502 \u251c\u2500\u2500 git/ # Git services\n\u2502 \u2514\u2500\u2500 pr/ # PR services (Phase 2)\n\u251c\u2500\u2500 tools/ # Tool base classes\n\u251c\u2500\u2500 utils/ # Utility functions\n\u2514\u2500\u2500 config/ # Configuration management\n```\n\n## Development\n\n### Running Tests\n\n```bash\npoetry run pytest\n```\n\n### Code Formatting\n\n```bash\npoetry run black .\npoetry run isort .\n```\n\n### Type Checking\n\n```bash\npoetry run mypy .\n```\n\n## Migration Status\n\n- \u2705 Phase 1: Foundation setup (models from mcp_local_repo_analyzer)\n- \u23f3 Phase 2: PR models migration (from mcp_pr_recommender)\n- \u23f3 Phase 3: Service migration\n- \u23f3 Phase 4: Repository updates\n- \u23f3 Phase 5: Testing & cleanup\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Shared library for MCP components providing common utilities, models, and tools",
"version": "0.1.1",
"project_urls": {
"Documentation": "https://github.com/manavgup/mcp_shared_lib#readme",
"Homepage": "https://github.com/manavgup/mcp_shared_lib",
"Repository": "https://github.com/manavgup/mcp_shared_lib"
},
"split_keywords": [
"mcp",
" model-context-protocol",
" shared-library",
" transport",
" git"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e4039a40a2f5ab4a82d26409c639b0e665dac68d0012081f81274a17ae32c3a2",
"md5": "278f3ee34073d51f6af63260da61c85a",
"sha256": "ee431aa55601e5adb8194e0301921be2172c969de686dc1e786fb3ec7bec05d0"
},
"downloads": -1,
"filename": "mcp_shared_lib-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "278f3ee34073d51f6af63260da61c85a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 65258,
"upload_time": "2025-08-16T14:24:36",
"upload_time_iso_8601": "2025-08-16T14:24:36.299758Z",
"url": "https://files.pythonhosted.org/packages/e4/03/9a40a2f5ab4a82d26409c639b0e665dac68d0012081f81274a17ae32c3a2/mcp_shared_lib-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "35de38478a512b6696f95093597deaef50ebdd91239924c4ddfa09814dfb8fd4",
"md5": "9fe7c55dfd2b8478b83a92ef391fa99a",
"sha256": "772778ecd44cb8908bcac32b28ecf3399b2d6751bef3cae9c600b435fc6df346"
},
"downloads": -1,
"filename": "mcp_shared_lib-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "9fe7c55dfd2b8478b83a92ef391fa99a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 47701,
"upload_time": "2025-08-16T14:24:37",
"upload_time_iso_8601": "2025-08-16T14:24:37.601343Z",
"url": "https://files.pythonhosted.org/packages/35/de/38478a512b6696f95093597deaef50ebdd91239924c4ddfa09814dfb8fd4/mcp_shared_lib-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-16 14:24:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "manavgup",
"github_project": "mcp_shared_lib",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mcp-shared-lib"
}