Skip to content

feat: Add experimental CLI for Learn MCP - #117

Merged
Tianqi Zhang (TianqiZhang) merged 5 commits into
MicrosoftDocs:mainfrom
TianqiZhang:feature/mslearn-cli
Mar 10, 2026
Merged

feat: Add experimental CLI for Learn MCP#117
Tianqi Zhang (TianqiZhang) merged 5 commits into
MicrosoftDocs:mainfrom
TianqiZhang:feature/mslearn-cli

Conversation

@TianqiZhang

Copy link
Copy Markdown
Contributor

Summary

Add an in-repo mslearn companion CLI for the Microsoft Learn MCP server, plus docs, tests, and validation wiring.

What’s included

  • adds cli/ TypeScript package with search, fetch, code-search, and doctor
  • supports dynamic Learn MCP tool discovery, cached session/tool metadata, and a direct cached tools/call fast path
  • simplifies command output to mostly pass through raw Learn MCP results
  • updates repo docs and validation/CI to build and test the CLI

Validation

  • cd cli && npm run build && npm test

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 10, 2026 08:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds an in-repo, experimental TypeScript companion CLI (mslearn) that acts as a thin MCP client for the public Microsoft Learn MCP endpoint, plus repository wiring to validate/build/test it.

Changes:

  • Introduces the cli/ Node/TypeScript package implementing search, fetch, code-search, and doctor.
  • Adds MCP client logic for tool discovery and session/tool caching, plus unit tests.
  • Updates repository docs and CI/validation to include the new CLI package.

Reviewed changes

Copilot reviewed 26 out of 28 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scripts/validate-repo.ps1 Adds repository validation for the new cli/ package structure.
cli_spec.md Documents the v0.1 CLI goals, commands, and architecture contract.
cli/tsconfig.json TypeScript compilation settings for the CLI package.
cli/test/unit/tool-discovery.test.ts Unit tests for mapping/discovering Learn MCP tools.
cli/test/unit/markdown.test.ts Unit tests for markdown section extraction and truncation.
cli/test/unit/cli.test.ts CLI contract tests for help, output, exit codes, and options.
cli/test/unit/cache.test.ts Unit tests for persistent cache behavior and direct-call fallback paths.
cli/src/utils/text.ts Text formatting helpers (doctor text output, newline normalization).
cli/src/utils/options.ts CLI option parsing and endpoint/URL normalization.
cli/src/utils/markdown.ts Markdown section extraction and output truncation helpers.
cli/src/utils/errors.ts CLI error types with exit-code semantics.
cli/src/utils/contracts.ts Shared constants/types for CLI behavior (formats, doctor report shape).
cli/src/mcp/tool-discovery.ts Logic for mapping discovered tools to CLI capabilities.
cli/src/mcp/client.ts MCP client wrapper with caching, tool calls, and recovery behavior.
cli/src/mcp/cache.ts Persistent file-backed session/tool cache implementation.
cli/src/index.ts CLI entrypoint wiring commander commands and error handling.
cli/src/context.ts Dependency-injection context for IO/fetch/client creation.
cli/src/commands/search.ts Implements mslearn search.
cli/src/commands/fetch.ts Implements mslearn fetch with section/max-chars options.
cli/src/commands/doctor.ts Implements mslearn doctor diagnostics and reporting.
cli/src/commands/code-search.ts Implements mslearn code-search.
cli/package.json Defines the CLI npm package metadata, dependencies, and scripts.
cli/package-lock.json Locks CLI dependency graph for reproducible installs in CI.
cli/README.md CLI usage and development instructions.
cli/.gitignore Ignores CLI build output and dependencies.
README.md Documents the presence of the companion CLI and how to run it.
.gitignore Adds ignores relevant to Node/CLI and local Claude settings.
.github/workflows/validate.yml Updates CI to install/build/test the CLI before repo validation.
Files not reviewed (1)
  • cli/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/validate-repo.ps1
Comment thread cli/src/mcp/client.ts
Comment thread cli/src/commands/doctor.ts
Comment thread cli/src/mcp/client.ts
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 28 changed files in this pull request and generated 5 comments.

Files not reviewed (1)
  • cli/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cli_spec.md Outdated
Comment thread cli/src/mcp/client.ts Outdated
Comment thread .github/workflows/validate.yml
Comment thread scripts/validate-repo.ps1 Outdated
Comment thread cli_spec.md Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 28 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • cli/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cli/package.json
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@TianqiZhang
Tianqi Zhang (TianqiZhang) merged commit 890032c into MicrosoftDocs:main Mar 10, 2026
2 checks passed
@TianqiZhang
Tianqi Zhang (TianqiZhang) deleted the feature/mslearn-cli branch March 10, 2026 09:38
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.

3 participants