-
Notifications
You must be signed in to change notification settings - Fork 202
feat: add MCP server "domains" #421
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
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
a1fcd31
feat: add domains input and loading logic
Novaes e59b552
test: add tools.test.ts to test domains load logic
Novaes 5501105
refactor: update files to match domain names
Novaes 636a39e
refactor: rename target_domains to domains
Novaes fb19526
Merge branch 'main' of github.com:microsoft/azure-devops-mcp into useβ¦
Novaes 9762dd3
chore: remove tools.test.ts
Novaes e3e8216
2.0.0
Novaes fa431c6
fix: removes pickManyString not support
Novaes 3dcff4c
test: fix test
Novaes 3f8a0fe
test: removes tools.test.ts
Novaes 4facd49
Merge branch 'main' into users/mnovaes/add-domains
Novaes b4b97d2
chore: format
Novaes a0ac933
Update src/index.ts
Novaes b643eaa
Update src/index.ts
Novaes 36dc38c
chore: remove domains from default mcp.json file
Novaes cecfa76
Merge branch 'main' of github.com:microsoft/azure-devops-mcp into useβ¦
Novaes 37c29b5
Merge branch 'users/mnovaes/add-domains' of github.com:microsoft/azurβ¦
Novaes 6504ff7
chore: add domains to usage
Novaes fe0dc1f
fix: removes unused file
Novaes c0e0a53
chore: add logging
Novaes 5974a96
chore: extra logging and update intTest mcp.json
Novaes 6e1080e
fix: format / mcp.json
Novaes c9df143
fix: revert package.json
Novaes e55894f
Merge branch 'main' of github.com:microsoft/azure-devops-mcp into useβ¦
Novaes 9e4de14
chore: update domains spec mcp.json for integration test
Novaes 6993c73
chore: use binary alias
Novaes a05a44d
chore: update comment on intTest/domains/mcp.json
Novaes 4be8e63
fix: removes console.log due conflict on stdio on Claude
Novaes 2a8b99f
chore: revert positional args
Novaes ea58092
chore: remove logs from tools.ts
Novaes dba8569
test: update tests for console chnges
Novaes 87a0ae0
test: update stderr log message
Novaes acc94b5
misc: npm audit fix
Novaes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"servers": { | ||
"ado": { | ||
"type": "stdio", | ||
"command": "mcp-server-azuredevops", | ||
"args": [ | ||
"${input:ado_org}", | ||
"-d", | ||
"core", | ||
"work", | ||
"workitems" | ||
// ... any other domain to enable, you can also use 'all' (which is already the default) | ||
] | ||
} | ||
}, | ||
"inputs": [ | ||
{ | ||
"id": "ado_org", | ||
"type": "promptString", | ||
"description": "Azure DevOps organization name (e.g. 'contoso')" | ||
} | ||
] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
/** | ||
* Available Azure DevOps MCP domains | ||
*/ | ||
export enum Domain { | ||
ADVANCED_SECURITY = "advanced-security", | ||
BUILDS = "builds", | ||
CORE = "core", | ||
RELEASES = "releases", | ||
REPOSITORIES = "repositories", | ||
SEARCH = "search", | ||
TEST_PLANS = "test-plans", | ||
WIKI = "wiki", | ||
WORK = "work", | ||
WORK_ITEMS = "work-items", | ||
} | ||
Novaes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export const ALL_DOMAINS = "all"; | ||
|
||
/** | ||
* Manages domain parsing and validation for Azure DevOps MCP server tools | ||
*/ | ||
export class DomainsManager { | ||
private static readonly AVAILABLE_DOMAINS = Object.values(Domain); | ||
|
||
private readonly enabledDomains: Set<string>; | ||
|
||
constructor(domainsInput?: string | string[]) { | ||
this.enabledDomains = new Set(); | ||
const normalizedInput = DomainsManager.parseDomainsInput(domainsInput); | ||
this.parseDomains(normalizedInput); | ||
} | ||
|
||
/** | ||
* Parse and validate domains from input | ||
* @param domainsInput - Either "all", single domain name, array of domain names, or undefined (defaults to "all") | ||
*/ | ||
private parseDomains(domainsInput?: string | string[]): void { | ||
if (!domainsInput) { | ||
this.enableAllDomains(); | ||
return; | ||
} | ||
|
||
if (Array.isArray(domainsInput)) { | ||
this.handleArrayInput(domainsInput); | ||
return; | ||
} | ||
|
||
this.handleStringInput(domainsInput); | ||
} | ||
|
||
private handleArrayInput(domainsInput: string[]): void { | ||
if (domainsInput.length === 0 || domainsInput.includes(ALL_DOMAINS)) { | ||
this.enableAllDomains(); | ||
return; | ||
} | ||
|
||
if (domainsInput.length === 1 && domainsInput[0] === ALL_DOMAINS) { | ||
this.enableAllDomains(); | ||
return; | ||
} | ||
|
||
const domains = domainsInput.map((d) => d.trim().toLowerCase()); | ||
this.validateAndAddDomains(domains); | ||
} | ||
|
||
private handleStringInput(domainsInput: string): void { | ||
if (domainsInput === ALL_DOMAINS) { | ||
this.enableAllDomains(); | ||
return; | ||
} | ||
|
||
const domains = [domainsInput.trim().toLowerCase()]; | ||
this.validateAndAddDomains(domains); | ||
} | ||
|
||
private validateAndAddDomains(domains: string[]): void { | ||
const availableDomainsAsStringArray = Object.values(Domain) as string[]; | ||
domains.forEach((domain) => { | ||
if (availableDomainsAsStringArray.includes(domain)) { | ||
this.enabledDomains.add(domain); | ||
} else if (domain === ALL_DOMAINS) { | ||
this.enableAllDomains(); | ||
} else { | ||
console.error(`Error: Specified invalid domain '${domain}'. Please specify exactly as available domains: ${Object.values(Domain).join(", ")}`); | ||
} | ||
}); | ||
|
||
if (this.enabledDomains.size === 0) { | ||
this.enableAllDomains(); | ||
} | ||
} | ||
|
||
private enableAllDomains(): void { | ||
Object.values(Domain).forEach((domain) => this.enabledDomains.add(domain)); | ||
} | ||
|
||
/** | ||
* Check if a specific domain is enabled | ||
* @param domain - Domain name to check | ||
* @returns true if domain is enabled | ||
*/ | ||
public isDomainEnabled(domain: string): boolean { | ||
return this.enabledDomains.has(domain); | ||
} | ||
|
||
/** | ||
* Get all enabled domains | ||
* @returns Set of enabled domain names | ||
*/ | ||
public getEnabledDomains(): Set<string> { | ||
return new Set(this.enabledDomains); | ||
} | ||
|
||
/** | ||
* Get list of all available domains | ||
* @returns Array of available domain names | ||
*/ | ||
public static getAvailableDomains(): string[] { | ||
return Object.values(Domain); | ||
} | ||
|
||
/** | ||
* Parse domains input from string or array to a normalized array of strings | ||
* @param domainsInput - Domains input to parse | ||
* @returns Normalized array of domain strings | ||
*/ | ||
public static parseDomainsInput(domainsInput?: string | string[]): string[] { | ||
if (!domainsInput) { | ||
return []; | ||
} | ||
|
||
if (typeof domainsInput === "string") { | ||
return domainsInput.split(",").map((d) => d.trim().toLowerCase()); | ||
} | ||
|
||
return domainsInput.map((d) => d.trim().toLowerCase()); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const packageVersion = "1.3.1"; | ||
export const packageVersion = "2.0.0"; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.