EVI Azure Authentication Extension

A Visual Studio Code extension that provides Azure authentication capabilities for MCP (Model Context Protocol) servers and development workflows. This extension simplifies Azure authentication by providing commands to log in to Azure, retrieve access tokens, and perform token-related operations.
Features
- Azure Authentication: Authenticate with Azure Credentials
- Token Management: Copy access tokens to clipboard for easy use
- MCP Server Integration: Send authentication tokens to MCP servers
- Configuration Flexibility: Support for both
.env files and VS Code settings
- Multi-scope Support: Configure custom Azure AD scopes
Requirements
- VS Code 1.105.0 or higher
- Node.js 22.x or higher
- Azure Active Directory application registration
Installation
From Source
Clone the repository:
git clone https://code.siemens.com/evi-in-internal/vscose-extension.git
cd vscose-extension
Install dependencies:
npm install
Build the extension:
npm run build
Configuration
Azure AD Application Setup
- Register an application in Azure AD
- Configure it as a public client application
- Note down the Client ID and Tenant ID
Extension Configuration
You can configure the extension using either a .env file:
Using .env file
Create a .env file in your workspace root:
CLIENT_ID=your-azure-client-id
TENANT_ID=your-azure-tenant-id
SCOPES=User.Read,api://your-api/scope
# Server to which the token need to be sent, usually the <Server-URL>/auth
SERVER_URL=https://<HOST>:<PORT>/auth
Usage
Available Commands
The extension provides the following commands accessible via the Command Palette (Ctrl+Shift+P):
Login to Azure and send token (extension.loginAndSendToken)
- Initiates Azure authentication flow
- Retrieves access token
- Sends token to configured MCP server
📋 Copy Access Token to Clipboard (extension.copyToken)
- Copies the current access token to clipboard
- Useful for manual token usage
Hello World: Send Greeting (Hello-world.greetings)
- Demo command for testing purposes
Authentication Flow
- Open Command Palette (
Ctrl+Shift+P)
- search of the commands shown in Acailable Commands which are
loginAndSendToken, copyToken and greetings
- The choice of commands will execute the Extension commands and will display the result.
Development
Project Structure
├── src/
│ ├── extension.ts # Main extension logic
│ └── test/
│ └── extension.test.ts # Test files
├── standalone-scripts/ # Authentication experiments (for research purposes)
│ ├── auth.ts # TypeScript authentication example
│ ├── auth.js # JavaScript authentication example
│ ├── auth-cs.py # Python authentication example (client secret)
│ └── auth-wcs.py # Python authentication example (without client secret)
├── versions/ # Authentication experiments (for research purposes)
│ └── Hello-world-ext-samp-0.1.0.vsix # Sample extension package
├── server.py # Sample HTTP server for testing
├── package.json # Extension manifest (command registration, extension metadata)
├── tsconfig.json # TypeScript configuration
├── .env.example # Example configuration for `.env`
├── .vscodeignore # Files to ignore during extension publishing
├── README.md # Project documentation
├── LICENSE.md # License information
├── CHANGELOG.md # Version history and changes
└── .vscode/ # VS Code workspace settings
├── launch.json # Debug configuration for F5 launch
└── tasks.json # Build and task configuration
Available Scripts
npm run compile - Compile TypeScript files
npm run build - Build the extension
npm run watch - Watch mode for development
npm run test - Run tests
npm run lint - Run ESLint
Running Tests
npm test
Development Workflow
- Make changes to the source code
- Press
F5 to open a new Extension Development Host window
- Test your changes in the development environment
- Run tests to ensure everything works correctly
Dependencies
Runtime Dependencies
@azure/msal-node (^3.8.1) - Microsoft Authentication Library for Node.js
dotenv (^17.2.3) - Environment variable loader
node-fetch (^3.3.2) - HTTP request library
Development Dependencies
typescript (^5.9.3) - TypeScript compiler
@types/vscode (^1.105.0) - VS Code API type definitions
eslint (^9.36.0) - Code linting
@vscode/test-* - VS Code testing utilities
Testing the Server Token Functionality
To test the functionality of sending the server token to the server, follow these steps:
Run the Server Script:
Execute the Extension Command:
- Open Visual Studio Code.
- Press
Ctrl+Shift+P to open the Command Palette.
- Search for and execute the command
Login to Azure and send token (extension.loginAndSendToken).
Verify the Server Response:
- Check the terminal where the
server.py script is running.
- You should see the token and user information received by the server.
Test the Generated Package
- Generate Package
vsce package
which already exists in version evi-azure-auth-0.1.0.vsix
- Install the Generated Package
- Got to Vs code Commands (
Ctrl + Shift + p) (cmd + Shift + p)
- search for install from vsix
- select your package
📝 Release Notes
0.1.0
- Initial release
- Azure authentication
- Token clipboard functionality
- MCP server integration
- Configuration support via .env and VS Code settings
How to Contribute to this project?
Please refer to the CONTRIBUTING.md file for guidelines on how to contribute to this project.
📄 License
This project is licensed under the Siemens Inner Source License v1.5 - see the LICENSE.md file for details.
Support
For support and questions:
- Create an issue in the repository
- Contact the development team at Siemens EVI-IN
Additional Resources