[CLI as MCP] Initialize Local MCP Server
This is a very initial idea of a Local MCP server, which I name it "CLI as MCP".
Azure CLI could provide a command az mcp up to serve as a local MCP server through stdio.
Through this way, Azure CLI could integrate with VSCode Copilot Chat and other MCP client.
How to Install
Build the mcp server and install it as an Azure CLI extension.
azdev extension build mcp-server
az extension add --source azure-cli-extensions\src\mcp-server\dist\mcp_server-1.0.0b1-py3-none-any.whl
Enable MCP Server in VSCode
In VSCode, click the tools icon in Copilot Chat.
Select
Add More Tools
Select
Add MCP Server...
Select the
Command(stdio) type
Input
az mcp up to start the Local MCP Server
Enable MCP Server in VSCode (Alternative)
Add a new file named mcp.json in .vscode folder. Add the following config in this file:
{
"servers": {
"AzureLocalMcpServer": {
"type": "stdio",
"command": "az",
"args": [
"mcp",
"up"
]
}
},
"inputs": []
}
How to use
After adding the Server, you should see two new tools in your toolset.
You can now use it in the Agent Mode!
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
az mcp up
General Guidelines
- [ ] Have you run
azdev style <YOUR_EXT>locally? (pip install azdevrequired) - [ ] Have you run
python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required) - [ ] My extension version conforms to the Extension version schema
For new extensions:
- [ ] My extension description/summary conforms to the Extension Summary Guidelines.
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.
Validation for Breaking Change Starting...
Thanks for your contribution!
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.
Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). After that please run the following commands to enable git hooks:
pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
Thank you for your contribution! We will review the pull request and get back to you soon.
- For more info about extension versioning, please refer to Extension version schema
Can boost this work, AWS has released something similar
https://github.com/awslabs/mcp/tree/main/src/aws-api-mcp-server