Skip to content

Commit 790829f

Browse files
Create pipeline to build and publish Azure SDK Python MCP to devops feed (#41471)
* Create pipeline to build and publish Azure SDK Python MCP to devops feed
1 parent 15c1585 commit 790829f

File tree

9 files changed

+182
-21
lines changed

9 files changed

+182
-21
lines changed

.vscode/mcp.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
"azure-sdk-python-mcp": {
44
"command": "uv",
55
"args": [
6-
"--directory",
7-
"${workspaceFolder}/tools/mcp/azure-sdk-python-mcp/",
86
"run",
9-
"main.py"
7+
"--index-url",
8+
"https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/",
9+
"--with",
10+
"azure-sdk-python-mcp",
11+
"azure-sdk-python-mcp"
1012
],
1113
}
1214
}

eng/ci_tools.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ typing-extensions==4.12.2
1515
pyproject-api==1.8.0
1616
cibuildwheel==2.16.5
1717
importlib-metadata==8.5.0
18+
build==1.2.2
1819

1920
# requirements leveraged for testing
2021
pytest==8.3.5
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# This template is used to build and publish python SDK tools to DevOps feed.
2+
# This release stage MUST NOT be used for sdk packages, and should not be relied upon by any language team members (dataplane / mgmt both)
3+
# This template supports only tool package that uses pyproject.toml to build the package.
4+
parameters:
5+
- name: PythonVersion
6+
type: string
7+
default: '3.13'
8+
- name: PackagePath
9+
type: string
10+
default: ''
11+
- name: FeedName
12+
type: string
13+
default: ''
14+
- name: ArtifactName
15+
type: string
16+
default: ''
17+
- name: PackageName
18+
type: string
19+
default: ''
20+
- name: TestSteps
21+
type: object
22+
default: []
23+
24+
extends:
25+
template: /eng/pipelines/templates/stages/1es-redirect.yml
26+
parameters:
27+
stages:
28+
- stage: 'Build'
29+
variables:
30+
- template: /eng/pipelines/templates/variables/globals.yml
31+
- template: /eng/pipelines/templates/variables/image.yml
32+
jobs:
33+
- job: 'Build'
34+
35+
pool:
36+
name: $(LINUXPOOL)
37+
image: $(LINUXNEXTVMIMAGE)
38+
os: linux
39+
40+
steps:
41+
- template: /eng/pipelines/templates/steps/use-python-version.yml
42+
parameters:
43+
versionSpec: '${{ parameters.PythonVersion }}'
44+
45+
- pwsh: |
46+
python -m pip install -r eng/ci_tools.txt
47+
displayName: 'Install Python Tools'
48+
condition: succeededOrFailed()
49+
50+
- pwsh: |
51+
Write-Host "Building python tool artifacts using pyproject.toml"
52+
python -m build --outdir $(Build.ArtifactStagingDirectory)
53+
displayName: 'Build ${{ parameters.PackageName }}'
54+
workingDirectory: $(Build.SourcesDirectory)/${{ parameters.PackagePath }}
55+
56+
- task: 1ES.PublishPipelineArtifact@1
57+
inputs:
58+
targetPath: '$(Build.ArtifactStagingDirectory)'
59+
artifactName: ${{ parameters.ArtifactName }}
60+
61+
- ${{ if not(eq(length(parameters.TestSteps), 0)) }}:
62+
- job: 'Test'
63+
64+
dependsOn:
65+
- 'Build'
66+
67+
pool:
68+
name: $(LINUXPOOL)
69+
image: $(LINUXNEXTVMIMAGE)
70+
os: linux
71+
72+
steps:
73+
- template: /eng/pipelines/templates/steps/use-python-version.yml
74+
parameters:
75+
versionSpec: '${{ parameters.PythonVersion }}'
76+
77+
- ${{ parameters.TestSteps }}
78+
79+
- ${{if and(eq(variables['Build.Reason'], 'Manual'), eq(variables['System.TeamProject'], 'internal'))}}:
80+
- stage: 'Release'
81+
dependsOn: Build
82+
condition: Succeeded()
83+
variables:
84+
- template: /eng/pipelines/templates/variables/globals.yml
85+
- template: /eng/pipelines/templates/variables/image.yml
86+
jobs:
87+
- job: PublishPackage
88+
displayName: 'Publish ${{ parameters.PackageName }} package to devops feed'
89+
pool:
90+
name: $(LINUXPOOL)
91+
image: $(LINUXNEXTVMIMAGE)
92+
os: linux
93+
steps:
94+
- checkout: none
95+
- download: current
96+
- task: UsePythonVersion@0
97+
98+
- script: |
99+
set -e
100+
python -m pip install twine
101+
displayName: Install Twine
102+
103+
- task: TwineAuthenticate@0
104+
displayName: 'Twine Authenticate to feed'
105+
inputs:
106+
artifactFeeds: ${{ parameters.FeedName }}
107+
108+
- task: PipAuthenticate@1
109+
displayName: 'Pip Authenticate to feed'
110+
inputs:
111+
artifactFeeds: ${{ parameters.FeedName }}
112+
onlyAddExtraIndex: false
113+
114+
- pwsh: |
115+
twine upload --repository ${{ parameters.FeedName }} --config-file $(PYPIRC_PATH) $(Pipeline.Workspace)/${{ parameters.ArtifactName }}/*.whl
116+
echo "Uploaded whl to devops feed ${{ parameters.FeedName }}"
117+
displayName: 'Publish ${{ parameters.PackageName }} to DevOps feed'
File renamed without changes.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file.
2+
trigger:
3+
branches:
4+
include:
5+
- main
6+
- feature/*
7+
- release/*
8+
- hotfix/*
9+
paths:
10+
include:
11+
- eng/tools/mcp/azure-sdk-python-mcp
12+
13+
pr:
14+
branches:
15+
include:
16+
- main
17+
- feature/*
18+
- release/*
19+
- hotfix/*
20+
paths:
21+
include:
22+
- eng/tools/mcp/azure-sdk-python-mcp
23+
24+
extends:
25+
template: /eng/pipelines/templates/stages/archetype-sdk-tool-python.yml
26+
parameters:
27+
PythonVersion: '3.13'
28+
PackagePath: 'eng/tools/mcp/azure-sdk-python-mcp'
29+
FeedName: 'public/azure-sdk-for-python'
30+
ArtifactName: 'azure-sdk-python-mcp'
31+
PackageName: 'Azure SDK Python MCP'

tools/mcp/azure-sdk-python-mcp/main.py renamed to eng/tools/mcp/azure-sdk-python-mcp/main.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,5 +292,8 @@ def check_library_health(library_name: str) -> Dict[str, Any]:
292292

293293

294294
# Run the MCP server
295-
if __name__ == "__main__":
295+
def main():
296296
mcp.run(transport='stdio')
297+
298+
if __name__ == "__main__":
299+
main()
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[project]
2+
name = "azure-sdk-python-mcp"
3+
version = "0.1.2"
4+
description = "MCP server for Azure SDK for Python"
5+
readme = "README.md"
6+
requires-python = ">=3.10"
7+
dependencies = [
8+
"azure-core>=1.34.0",
9+
"mcp[cli]>=1.9.2",
10+
"mypy>=1.16.0",
11+
"pip>=25.1.1",
12+
"pygithub>=2.6.1",
13+
"pylint>=3.3.7",
14+
"tox>=4.26.0",
15+
"httpx>=0.24.0",
16+
]
17+
18+
[project.scripts]
19+
azure-sdk-python-mcp = "main:main"
20+
21+
[[tool.uv.index]]
22+
name = "azure-sdk-python-mcp"
23+
url = "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/"
24+
publish-url = "https://pkgs.dev.azure.com/azure-sdk/public/_artifacts/feed/azure-sdk-for-python/pypi/upload/"
File renamed without changes.

tools/mcp/azure-sdk-python-mcp/pyproject.toml

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)