Skip to content

[MCP] Async -> Sync Execution for server commands. #28133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jul 7, 2025

Conversation

notyashhh
Copy link
Member

@notyashhh notyashhh commented Jul 4, 2025

Description

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

@Copilot Copilot AI review requested due to automatic review settings July 4, 2025 05:07
Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

@notyashhh notyashhh changed the base branch from main to dev/mcp-server July 4, 2025 05:07
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new Model Context Protocol (MCP) server under tools/Mcp to support synchronous execution of server commands for Azure PowerShell code generation using AutoRest.

  • Sets up the TypeScript project (tsconfig.json, package.json) and adds necessary dependencies.
  • Implements the core MCP server (CodegenServer.ts, index.ts) with tool registration based on JSON specs.
  • Adds utility functions (utils.ts), tool service handlers (toolServices.ts), and tool specifications/responses (specs.json, responses.json).

Reviewed Changes

Copilot reviewed 11 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/Mcp/tsconfig.json Configures compiler options for the TypeScript project.
tools/Mcp/package.json Defines project metadata, dependencies, and build scripts.
tools/Mcp/src/CodegenServer.ts Implements MCP server initialization and tool registration.
tools/Mcp/src/index.ts Entry point that starts and connects the MCP server.
tools/Mcp/src/services/utils.ts Provides file, YAML, and HTTP utilities for tool operations.
tools/Mcp/src/services/toolServices.ts Contains implementations of MCP tool handlers.
tools/Mcp/src/specs/specs.json Defines tool schemas and callback names used by the server.
tools/Mcp/src/specs/responses.json Provides response templates for each tool.
tools/Mcp/src/types.ts Declares TypeScript types for schemas and directives.
tools/Mcp/README.md Documents installation, usage, and features of the MCP server.
Files not reviewed (1)
  • tools/Mcp/package-lock.json: Language not supported
Comments suppressed due to low confidence (7)

tools/Mcp/src/services/utils.ts:7

  • [nitpick] The parameter name path shadows the imported path module. Consider renaming it to directory or cwd to avoid confusion.
const _pwshCD = (path: string): string => { return `pwsh -Command "$path = resolve-path ${path} | Set-Location"` }

tools/Mcp/src/specs/responses.json:24

  • Spelling error: "Fulfil" should be "Fulfill".
        "type": "tool",

tools/Mcp/src/services/utils.ts:24

  • There's an extraneous trailing double quote at the end of the command string, which will break execution. Remove the final ".
    const genBuildCommand = `${_pwshCD(workingDirectory)}; ${_autorest}; ${_pwshBuild};"`;

tools/Mcp/src/services/utils.ts:11

  • The testYaml function appears to be a leftover utility and is not used elsewhere. Consider removing it or moving it to a dedicated test file.
function testYaml() {

tools/Mcp/src/services/utils.ts:197

  • The testCase function is hardcoded to a local path and unused. Remove it or refactor it into a proper test suite.
export async function testCase() {

tools/Mcp/src/services/toolServices.ts:5

  • The get import from 'http' is unused. Consider removing this import.
import { get } from 'http';

tools/Mcp/src/CodegenServer.ts:106

  • Typo in the description: "such a formal" should read "such as formal" for clarity.
            { name: z.string().describe("Name of the person to greet"), style: z.string().describe("The style of greeting, such a formal, excited, or casual. If not specified casual will be used")}, 

@notyashhh notyashhh self-assigned this Jul 4, 2025
@notyashhh notyashhh requested a review from VeryEarly July 4, 2025 05:13
@notyashhh notyashhh requested a review from VeryEarly July 6, 2025 02:27
@notyashhh notyashhh merged commit 8f104f5 into dev/mcp-server Jul 7, 2025
1 of 6 checks passed
notyashhh added a commit that referenced this pull request Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants