mcp-lightcast 0.1.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.
Files changed (44) hide show
  1. mcp_lightcast-0.1.0/.env.example +49 -0
  2. mcp_lightcast-0.1.0/.github/workflows/ci.yml +230 -0
  3. mcp_lightcast-0.1.0/.github/workflows/release.yml +182 -0
  4. mcp_lightcast-0.1.0/.gitignore +478 -0
  5. mcp_lightcast-0.1.0/Dockerfile +81 -0
  6. mcp_lightcast-0.1.0/Dockerfile.dev +67 -0
  7. mcp_lightcast-0.1.0/LICENSE +21 -0
  8. mcp_lightcast-0.1.0/MANIFEST.in +11 -0
  9. mcp_lightcast-0.1.0/PKG-INFO +747 -0
  10. mcp_lightcast-0.1.0/PUBLISHING.md +154 -0
  11. mcp_lightcast-0.1.0/README.md +715 -0
  12. mcp_lightcast-0.1.0/config/settings.py +45 -0
  13. mcp_lightcast-0.1.0/docker-compose.yml +78 -0
  14. mcp_lightcast-0.1.0/examples/version_usage.py +60 -0
  15. mcp_lightcast-0.1.0/pyproject.toml +110 -0
  16. mcp_lightcast-0.1.0/run_server.py +118 -0
  17. mcp_lightcast-0.1.0/scripts/publish-release.sh +55 -0
  18. mcp_lightcast-0.1.0/src/mcp_lightcast/__init__.py +191 -0
  19. mcp_lightcast-0.1.0/src/mcp_lightcast/__main__.py +7 -0
  20. mcp_lightcast-0.1.0/src/mcp_lightcast/apis/__init__.py +1 -0
  21. mcp_lightcast-0.1.0/src/mcp_lightcast/apis/base.py +152 -0
  22. mcp_lightcast-0.1.0/src/mcp_lightcast/apis/classification.py +86 -0
  23. mcp_lightcast-0.1.0/src/mcp_lightcast/apis/similarity.py +151 -0
  24. mcp_lightcast-0.1.0/src/mcp_lightcast/apis/skills.py +165 -0
  25. mcp_lightcast-0.1.0/src/mcp_lightcast/apis/titles.py +125 -0
  26. mcp_lightcast-0.1.0/src/mcp_lightcast/auth/__init__.py +1 -0
  27. mcp_lightcast-0.1.0/src/mcp_lightcast/auth/oauth.py +116 -0
  28. mcp_lightcast-0.1.0/src/mcp_lightcast/server.py +104 -0
  29. mcp_lightcast-0.1.0/src/mcp_lightcast/tools/__init__.py +1 -0
  30. mcp_lightcast-0.1.0/src/mcp_lightcast/tools/normalize_title_get_skills.py +187 -0
  31. mcp_lightcast-0.1.0/src/mcp_lightcast/tools/skills_tools.py +279 -0
  32. mcp_lightcast-0.1.0/src/mcp_lightcast/tools/titles_tools.py +189 -0
  33. mcp_lightcast-0.1.0/src/mcp_lightcast/tools/workflow_tools.py +178 -0
  34. mcp_lightcast-0.1.0/src/mcp_lightcast/utils/__init__.py +5 -0
  35. mcp_lightcast-0.1.0/src/mcp_lightcast/utils/version_manager.py +73 -0
  36. mcp_lightcast-0.1.0/tests/__init__.py +1 -0
  37. mcp_lightcast-0.1.0/tests/conftest.py +205 -0
  38. mcp_lightcast-0.1.0/tests/integration/__init__.py +1 -0
  39. mcp_lightcast-0.1.0/tests/integration/test_server_integration.py +307 -0
  40. mcp_lightcast-0.1.0/tests/unit/__init__.py +1 -0
  41. mcp_lightcast-0.1.0/tests/unit/test_auth.py +200 -0
  42. mcp_lightcast-0.1.0/tests/unit/test_titles_api.py +227 -0
  43. mcp_lightcast-0.1.0/tests/unit/test_workflow.py +311 -0
  44. mcp_lightcast-0.1.0/uv.lock +1569 -0
@@ -0,0 +1,49 @@
1
+ # ======================================
2
+ # MCP Lightcast Server Configuration
3
+ # ======================================
4
+
5
+ # REQUIRED: Lightcast API Credentials
6
+ # Get these from your Lightcast developer account
7
+ # Contact https://docs.lightcast.dev/contact for API access
8
+ LIGHTCAST_CLIENT_ID=your_client_id_here
9
+ LIGHTCAST_CLIENT_SECRET=your_client_secret_here
10
+
11
+ # OPTIONAL: Lightcast API Configuration (defaults provided)
12
+ LIGHTCAST_BASE_URL=https://api.lightcast.io
13
+ LIGHTCAST_OAUTH_URL=https://auth.emsicloud.com/connect/token
14
+ LIGHTCAST_OAUTH_SCOPE=emsi_open
15
+ LIGHTCAST_RATE_LIMIT=1000
16
+
17
+ # OPTIONAL: MCP Server Configuration (defaults provided)
18
+ MCP_SERVER_NAME=lightcast-mcp-server
19
+ LOG_LEVEL=INFO
20
+ MASK_ERROR_DETAILS=true
21
+
22
+ # OPTIONAL: PyPI Publishing Tokens (for package maintainers)
23
+ # Get TestPyPI token: https://test.pypi.org/manage/account/
24
+ # Get PyPI token: https://pypi.org/manage/account/
25
+ TEST_PYPI_TOKEN=pypi-your-testpypi-token-here
26
+ PYPI_TOKEN=pypi-your-production-token-here
27
+ # Alternative format (also supported):
28
+ # TWINE_USERNAME=__token__
29
+ # TWINE_PASSWORD=pypi-your-token-here
30
+
31
+ # ======================================
32
+ # Usage Instructions:
33
+ #
34
+ # 1. Copy this file to .env:
35
+ # cp .env.example .env
36
+ #
37
+ # 2. Edit .env with your real Lightcast API credentials
38
+ #
39
+ # 3. Test your configuration:
40
+ # make validate-config
41
+ #
42
+ # 4. Run the server:
43
+ # make run
44
+ #
45
+ # 5. For package publishing (maintainers only):
46
+ # Add your PyPI tokens above, then run:
47
+ # make publish-test # Test PyPI first
48
+ # make publish-pypi # Production PyPI
49
+ # ======================================
@@ -0,0 +1,230 @@
1
+ name: CI/CD Pipeline
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, develop ]
6
+ pull_request:
7
+ branches: [ main ]
8
+ release:
9
+ types: [ published ]
10
+
11
+ env:
12
+ PYTHON_VERSION: '3.12'
13
+
14
+ jobs:
15
+ test:
16
+ name: Test Python ${{ matrix.python-version }}
17
+ runs-on: ubuntu-latest
18
+ strategy:
19
+ matrix:
20
+ python-version: ['3.10', '3.11', '3.12']
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ with:
25
+ fetch-depth: 0 # For dynamic versioning
26
+
27
+ - name: Set up uv
28
+ uses: astral-sh/setup-uv@v3
29
+ with:
30
+ enable-cache: true
31
+ cache-dependency-glob: "uv.lock"
32
+
33
+ - name: Set up Python ${{ matrix.python-version }}
34
+ uses: actions/setup-python@v5
35
+ with:
36
+ python-version: ${{ matrix.python-version }}
37
+
38
+ - name: Install dependencies
39
+ run: |
40
+ uv sync --all-groups --frozen
41
+
42
+ - name: Lint with ruff
43
+ run: |
44
+ uv run ruff check src/ tests/
45
+ uv run ruff format --check src/ tests/
46
+
47
+ - name: Type check with mypy
48
+ run: |
49
+ uv run mypy src/
50
+
51
+ - name: Test with pytest
52
+ run: |
53
+ uv run pytest --cov=src --cov-report=xml --cov-report=term
54
+ env:
55
+ # Mock environment variables for testing
56
+ LIGHTCAST_CLIENT_ID: "test_client_id"
57
+ LIGHTCAST_CLIENT_SECRET: "test_client_secret"
58
+
59
+ - name: Upload coverage to Codecov
60
+ if: matrix.python-version == '3.12'
61
+ uses: codecov/codecov-action@v4
62
+ with:
63
+ file: ./coverage.xml
64
+ flags: unittests
65
+ name: codecov-umbrella
66
+
67
+ test-basic-functionality:
68
+ name: Test Basic Functionality
69
+ runs-on: ubuntu-latest
70
+ steps:
71
+ - uses: actions/checkout@v4
72
+
73
+ - name: Set up uv
74
+ uses: astral-sh/setup-uv@v3
75
+
76
+ - name: Set up Python
77
+ uses: actions/setup-python@v5
78
+ with:
79
+ python-version: ${{ env.PYTHON_VERSION }}
80
+
81
+ - name: Install dependencies
82
+ run: uv sync --frozen
83
+
84
+ - name: Run basic functionality test
85
+ run: |
86
+ uv run python test_basic_functionality.py
87
+
88
+ docker-build:
89
+ name: Docker Build and Test
90
+ runs-on: ubuntu-latest
91
+ needs: [test]
92
+
93
+ steps:
94
+ - uses: actions/checkout@v4
95
+
96
+ - name: Set up Docker Buildx
97
+ uses: docker/setup-buildx-action@v3
98
+
99
+ - name: Build production image
100
+ uses: docker/build-push-action@v5
101
+ with:
102
+ context: .
103
+ file: ./Dockerfile
104
+ target: production
105
+ tags: mcp-lightcast:test
106
+ load: true
107
+ cache-from: type=gha
108
+ cache-to: type=gha,mode=max
109
+
110
+ - name: Test Docker image
111
+ run: |
112
+ # Test image can start and validate config
113
+ docker run --rm \
114
+ -e LIGHTCAST_CLIENT_ID=test_id \
115
+ -e LIGHTCAST_CLIENT_SECRET=test_secret \
116
+ mcp-lightcast:test --validate-config --quiet || echo "Expected to fail without real credentials"
117
+
118
+ - name: Build development image
119
+ uses: docker/build-push-action@v5
120
+ with:
121
+ context: .
122
+ file: ./Dockerfile.dev
123
+ target: development
124
+ tags: mcp-lightcast:dev-test
125
+ load: true
126
+
127
+ security-scan:
128
+ name: Security Scan
129
+ runs-on: ubuntu-latest
130
+
131
+ steps:
132
+ - uses: actions/checkout@v4
133
+
134
+ - name: Set up uv
135
+ uses: astral-sh/setup-uv@v3
136
+
137
+ - name: Set up Python
138
+ uses: actions/setup-python@v5
139
+ with:
140
+ python-version: ${{ env.PYTHON_VERSION }}
141
+
142
+ - name: Install dependencies
143
+ run: uv sync --frozen
144
+
145
+ - name: Run safety check
146
+ run: |
147
+ uv add --dev safety
148
+ uv run safety check --json || true
149
+
150
+ - name: Run bandit security linter
151
+ run: |
152
+ uv add --dev bandit[toml]
153
+ uv run bandit -r src/ -f json || true
154
+
155
+ publish-docker:
156
+ name: Publish Docker Images
157
+ runs-on: ubuntu-latest
158
+ needs: [test, docker-build]
159
+ if: github.event_name == 'release' && github.event.action == 'published'
160
+
161
+ steps:
162
+ - uses: actions/checkout@v4
163
+
164
+ - name: Set up Docker Buildx
165
+ uses: docker/setup-buildx-action@v3
166
+
167
+ - name: Login to GitHub Container Registry
168
+ uses: docker/login-action@v3
169
+ with:
170
+ registry: ghcr.io
171
+ username: ${{ github.actor }}
172
+ password: ${{ secrets.GITHUB_TOKEN }}
173
+
174
+ - name: Extract metadata
175
+ id: meta
176
+ uses: docker/metadata-action@v5
177
+ with:
178
+ images: ghcr.io/${{ github.repository }}
179
+ tags: |
180
+ type=ref,event=branch
181
+ type=ref,event=pr
182
+ type=semver,pattern={{version}}
183
+ type=semver,pattern={{major}}.{{minor}}
184
+ type=semver,pattern={{major}}
185
+ type=raw,value=latest,enable={{is_default_branch}}
186
+
187
+ - name: Build and push production image
188
+ uses: docker/build-push-action@v5
189
+ with:
190
+ context: .
191
+ file: ./Dockerfile
192
+ target: production
193
+ push: true
194
+ tags: ${{ steps.meta.outputs.tags }}
195
+ labels: ${{ steps.meta.outputs.labels }}
196
+ cache-from: type=gha
197
+ cache-to: type=gha,mode=max
198
+
199
+ publish-pypi:
200
+ name: Publish to PyPI
201
+ runs-on: ubuntu-latest
202
+ needs: [test, security-scan]
203
+ if: github.event_name == 'release' && github.event.action == 'published'
204
+ environment:
205
+ name: pypi
206
+ url: https://pypi.org/p/mcp-lightcast
207
+ permissions:
208
+ id-token: write # For trusted publishing
209
+
210
+ steps:
211
+ - uses: actions/checkout@v4
212
+ with:
213
+ fetch-depth: 0 # For dynamic versioning
214
+
215
+ - name: Set up uv
216
+ uses: astral-sh/setup-uv@v3
217
+
218
+ - name: Set up Python
219
+ uses: actions/setup-python@v5
220
+ with:
221
+ python-version: ${{ env.PYTHON_VERSION }}
222
+
223
+ - name: Build package
224
+ run: |
225
+ uv build
226
+
227
+ - name: Publish to PyPI
228
+ uses: pypa/gh-action-pypi-publish@release/v1
229
+ with:
230
+ verbose: true
@@ -0,0 +1,182 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*'
7
+ workflow_dispatch:
8
+ inputs:
9
+ version:
10
+ description: 'Version to release (e.g., v0.1.0)'
11
+ required: true
12
+ type: string
13
+
14
+ permissions:
15
+ contents: write
16
+ id-token: write
17
+
18
+ jobs:
19
+ build:
20
+ name: Build distribution
21
+ runs-on: ubuntu-latest
22
+
23
+ steps:
24
+ - uses: actions/checkout@v5
25
+ with:
26
+ fetch-depth: 0
27
+
28
+ - name: Set up Python
29
+ uses: actions/setup-python@v5
30
+ with:
31
+ python-version: '3.12'
32
+
33
+ - name: Install uv
34
+ uses: astral-sh/setup-uv@v6
35
+ with:
36
+ enable-cache: true
37
+ cache-dependency-glob: "uv.lock"
38
+
39
+ - name: Install dependencies
40
+ run: uv sync --all-extras --dev
41
+
42
+ - name: Run tests
43
+ run: uv run pytest tests/ -v
44
+
45
+ - name: Run linting
46
+ run: |
47
+ uv run ruff check .
48
+ uv run ruff format --check .
49
+
50
+ - name: Run type checking
51
+ run: uv run mypy src/
52
+
53
+ - name: Build package
54
+ run: uv build
55
+
56
+ - name: Check distribution
57
+ run: |
58
+ uv run twine check dist/*
59
+
60
+ - name: Upload artifacts
61
+ uses: actions/upload-artifact@v4
62
+ with:
63
+ name: dist
64
+ path: dist/
65
+
66
+ publish-pypi:
67
+ name: Publish to PyPI
68
+ needs: build
69
+ runs-on: ubuntu-latest
70
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
71
+ environment:
72
+ name: pypi
73
+ url: https://pypi.org/p/mcp-lightcast
74
+
75
+ steps:
76
+ - name: Download artifacts
77
+ uses: actions/download-artifact@v4
78
+ with:
79
+ name: dist
80
+ path: dist/
81
+
82
+ - name: Publish to PyPI
83
+ uses: pypa/gh-action-pypi-publish@release/v1
84
+ with:
85
+ attestations: true
86
+
87
+ publish-testpypi:
88
+ name: Publish to TestPyPI
89
+ needs: build
90
+ runs-on: ubuntu-latest
91
+ if: github.event_name == 'workflow_dispatch'
92
+ environment:
93
+ name: testpypi
94
+ url: https://test.pypi.org/p/mcp-lightcast
95
+
96
+ steps:
97
+ - name: Download artifacts
98
+ uses: actions/download-artifact@v4
99
+ with:
100
+ name: dist
101
+ path: dist/
102
+
103
+ - name: Publish to TestPyPI
104
+ uses: pypa/gh-action-pypi-publish@release/v1
105
+ with:
106
+ repository-url: https://test.pypi.org/legacy/
107
+ attestations: true
108
+
109
+ github-release:
110
+ name: Create GitHub Release
111
+ needs: build
112
+ runs-on: ubuntu-latest
113
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
114
+
115
+ steps:
116
+ - uses: actions/checkout@v5
117
+
118
+ - name: Download artifacts
119
+ uses: actions/download-artifact@v4
120
+ with:
121
+ name: dist
122
+ path: dist/
123
+
124
+ - name: Extract version from tag
125
+ id: version
126
+ run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
127
+
128
+ - name: Generate release notes
129
+ id: release_notes
130
+ run: |
131
+ cat > release_notes.md << 'EOF'
132
+ ## MCP Lightcast v${{ steps.version.outputs.version }}
133
+
134
+ ### 🚀 Features
135
+ - Complete Skills API integration with 6/10 endpoints working
136
+ - Complete Titles API integration with 5/8 endpoints working
137
+ - Skills extraction from text with high accuracy
138
+ - Bulk operations for efficient data retrieval
139
+ - Modern OAuth2 authentication with Lightcast APIs
140
+ - FastMCP-based server with streamable-HTTP transport
141
+ - uv package management with lock files
142
+ - Docker deployment support
143
+ - Comprehensive CLI interface
144
+
145
+ ### 📊 API Coverage
146
+ - **Skills API**: search, individual retrieval, bulk operations, text extraction, metadata
147
+ - **Titles API**: search, individual retrieval, bulk operations, metadata
148
+ - **Version Support**: Uses "latest" keyword with backward compatibility
149
+ - **Authentication**: OAuth2 with emsi_open scope
150
+
151
+ ### 🛠️ Installation
152
+ ```bash
153
+ # Using uv (recommended)
154
+ uvx --from mcp-lightcast mcp-lightcast
155
+
156
+ # Using pip
157
+ pip install mcp-lightcast
158
+
159
+ # Using Docker
160
+ docker run -e LIGHTCAST_CLIENT_ID=your_id -e LIGHTCAST_CLIENT_SECRET=your_secret ghcr.io/your-username/mcp-lightcast
161
+ ```
162
+
163
+ ### 📚 Documentation
164
+ See the [README](https://github.com/${{ github.repository }}/blob/main/README.md) for complete setup and usage instructions.
165
+
166
+ ### 🔗 Links
167
+ - [PyPI Package](https://pypi.org/project/mcp-lightcast/)
168
+ - [Docker Image](https://github.com/${{ github.repository }}/pkgs/container/mcp-lightcast)
169
+ - [Testing Summary](https://github.com/${{ github.repository }}/blob/main/TESTING_SUMMARY.md)
170
+ EOF
171
+
172
+ - name: Create Release
173
+ uses: softprops/action-gh-release@v2
174
+ with:
175
+ name: "MCP Lightcast v${{ steps.version.outputs.version }}"
176
+ body_path: release_notes.md
177
+ files: |
178
+ dist/*.tar.gz
179
+ dist/*.whl
180
+ draft: false
181
+ prerelease: false
182
+ generate_release_notes: true