sitewide-mcp-server

paritosh476/sitewide-mcp-server

3.2

If you are the rightful owner of sitewide-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The Sitewide MCP Server is a Model Context Protocol server designed to provide seamless access to Microsoft Power Portal and Admin Center APIs, with a focus on geo-specific URL configuration and secure authentication.

Tools
3
Resources
0
Prompts
0

Sitewide MCP Server

A Model Context Protocol (MCP) server that provides access to Microsoft Power Portal and Admin Center APIs with geo-specific URL configuration.

Features

  • Geo-specific API routing - Support for multiple geographic regions (TIP, PROD, etc.)
  • Secure authentication - Token-based authentication with automatic masking
  • 125+ API tools - Comprehensive access to PowerPortal and AdminCenter APIs
  • Rich error handling - Detailed error responses with request metadata
  • VS Code integration - Works seamlessly with VS Code's MCP support

Quick Start

Prerequisites

  • Python 3.8 or higher
  • Valid authentication token for the Sitewide API

Installation

  1. Clone the repository:
git clone https://github.com/paritosh476/sitewide-mcp-server.git
cd sitewide-mcp-server
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up authentication:
# Copy the example file
cp auth_token.txt.example auth_token.txt
# Edit auth_token.txt with your actual token

Running the Server

With VS Code (Recommended)

The server is pre-configured for VS Code. Simply:

  1. Open the project in VS Code
  2. The MCP server will be available automatically through Copilot Chat
  3. Use @workspace or mention tools to interact with portal APIs

Configuration is in .vscode/mcp.json:

{
  "mcpServers": {
    "my-mcp-server": {
      "type": "stdio",
      "command": "python",
      "args": ["d:\\repos\\sitewide-mcp-server\\mcp_server\\server.py"]
    }
  }
}
Standalone
python mcp_server/server.py

Project Structure

sitewide-mcp-server/
 mcp_server/
    server.py               # Main MCP server implementation
 schema_converters/          # Schema conversion utilities
    README.md               # Schema converter documentation
    swagger_converter.py    # Swagger/OpenAPI to MCP converter
    swagger_generator.py    # Swagger generation utilities
    generate_controller_schemas.py
 schemas/                    # API schema definitions
    mcp_schema.json         # Combined schema (all APIs)
    admincenter/            # AdminCenter APIs only
       mcp_schema.json
    powerportal/            # PowerPortal APIs only
        mcp_schema.json
 geo_config.py               # Geographic URL configuration
 auth_token.txt              # Your auth token (gitignored)
 auth_token.txt.example      # Example auth token file
 requirements.txt            # Python dependencies
 README.md                   # This file
 .vscode/
     mcp.json                # VS Code MCP configuration

Usage Examples

Check Portal Status

# Via MCP tools in VS Code Copilot
"Check the status of portal 7989e2c3-4d44-4145-b01d-225ada1ff3af"

List Portals in Organization

"List all portals in organization 902d4265-1670-ef11-a66e-6045bd02c4a1"

Enable Azure Front Door

"Enable AFD for portal 7989e2c3-4d44-4145-b01d-225ada1ff3af"

Check Domain Availability

"Is the subdomain 'muhahahaha' available?"

Configuration

Geographic Regions

The server supports multiple geographic regions. Default configuration in geo_config.py:

GEO_URLS = {
    "TIP": "https://portalsitewide-tip.portal-infra.dynamics.com/",
    "PROD": "https://portalsitewide-prod.portal-infra.dynamics.com/",
}

Default geo: TIP

To change the default geo, modify DEFAULT_GEO in geo_config.py.

Authentication

Create uth_token.txt in the project root with your authentication token:

your-token-here

The token is automatically loaded by the server and masked in all logs for security.

Available Tools

The server provides 125+ tools across two controllers:

PowerPortal (~125 tools)

  • Portal provisioning and management
  • Portal status and configuration
  • Azure Front Door (AFD) management
  • Web Application Firewall (WAF) configuration
  • Site visibility and security settings
  • Bot management
  • Package installation and upgrades
  • And much more...

AdminCenter

  • Administrative operations
  • Tenant management
  • Certificate management

See individual controller schemas in schemas/ for complete tool listings.

Schema Converters

Need to generate or update API schemas? See for:

  • Converting Swagger/OpenAPI to MCP schemas
  • Generating controller-specific schemas
  • Schema validation and testing

Development

Running Tests

# Test the MCP server
python test_server.py

Generating Schemas

# Generate all controller schemas from Swagger
cd schema_converters
python generate_controller_schemas.py

Using Specific Controller Schemas

Edit mcp_server/server.py to load specific schemas:

# PowerPortal APIs only
server = ApiMcpServer('schemas/powerportal/mcp_schema.json')

# AdminCenter APIs only
server = ApiMcpServer('schemas/admincenter/mcp_schema.json')

# All APIs (default)
server = ApiMcpServer('schemas/mcp_schema.json')

Security

  • Auth tokens are automatically masked in logs
  • uth_token.txt is gitignored and should never be committed
  • Use the example file as a template
  • Store tokens securely outside the repository for production use

Troubleshooting

"0 tools discovered" in VS Code

Ensure:

  1. ServerCapabilities(tools={}) is set in mcp_server/server.py
  2. MCP server is properly configured in .vscode/mcp.json
  3. Python path in config is absolute and correct
  4. Restart VS Code after config changes

Authentication Errors

  • Verify uth_token.txt exists and contains your token
  • Check token hasn't expired
  • Ensure proper permissions for the target APIs
  • Verify token format (no extra spaces or newlines)

Schema Validation Errors

  • Regenerate schemas: python schema_converters/generate_controller_schemas.py
  • Check for missing items property in array parameters
  • Validate JSON syntax in schema files

API Call Failures

  • Check the geo configuration matches your environment
  • Verify network connectivity to the API endpoints
  • Review error messages in the response for specific issues

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

[Your License Here]

Contact

For questions or support, please open an issue on GitHub.

Changelog

Recent Updates

  • Reorganized project structure (src/ schema_converters/)
  • Added controller-specific schemas (PowerPortal, AdminCenter)
  • Enhanced schema converter with array validation
  • Fixed VS Code tool discovery with proper ServerCapabilities
  • Added comprehensive documentation
  • Improved geo configuration system