tfs-mcp-server
tfs-mcp-server
MCP server (stdio) for Microsoft TFS / Azure DevOps Server using REST API 6.0.
Gives an AI agent tools for work items, Git repository files and identity lookup.
Work items and repositories may live in different team projects: every tool accepts an
optional project argument that overrides the configured default.
Requirements
Node.js 20+
A TFS / Azure DevOps Server collection reachable over HTTPS
A Personal Access Token with scopes: Work Items (read & write), Code (read), Identity (read)
Install & build
npm install
npm run build # -> dist/index.js
npm test # vitest (all TFS calls are mocked)Configuration (environment variables)
Variable | Required | Description |
| yes | Collection URL, e.g. |
| yes | Personal access token (sent as Basic auth) |
| no | Project used when a call omits |
| no | Default |
| no | Parallelism for fan-out batch tools (default |
| no |
|
See .env.example.
Cursor (~/.cursor/mcp.json or .cursor/mcp.json)
{
"mcpServers": {
"tfs": {
"command": "node",
"args": ["/absolute/path/to/tfs-mcp-server/dist/index.js"],
"env": {
"TFS_BASE_URL": "https://tfs.corp.local/tfs/DefaultCollection",
"TFS_PAT": "<your PAT>",
"TFS_DEFAULT_PROJECT": "MyProject"
}
}
}
}Claude Desktop uses the same shape in claude_desktop_config.json.
Interactive testing
TFS_BASE_URL=... TFS_PAT=... npm run inspect # opens the MCP Inspector against dist/index.jsTools
All tools return a short text summary plus a JSON payload (structuredContent).
Errors are returned as tool errors with the TFS message, HTTP status and request URL.
Work items
Tool | Purpose |
| Metadata, rich-text content (Description / Repro Steps / Acceptance Criteria, HTML converted to text by default), relations, optional comments |
| Same for many ids in one call ( |
| Paged comments (ids needed for updates) |
| JSON-Patch update. |
| Same update applied to many ids via |
| Add a comment (plain text is wrapped into HTML) |
| Same comment on many work items (bounded-concurrency fan-out) |
| Replace the text of an existing comment |
| Saved query by GUID or path: WIQL, columns, type; folders list children |
| Execute a saved query; optional |
| Execute an arbitrary WIQL string as-is |
assignedTo accepts a display name, DOMAIN\user, an e-mail, Display Name <DOMAIN\user>, or "" to unassign.
Use get_current_identity / search_identities to obtain valid values.
Files (Git)
Tool | Purpose |
| Repositories of a project (or the whole collection) |
| File content at |
| Several files from one repo/version in one call ( |
| Entries under a directory (one level or recursive) with object ids, content type and latest commit |
Identity
Tool | Purpose |
| Who the PAT belongs to ( |
| Find users/groups by name, account or e-mail |
Example flows
get_current_identity -> assignedToValue = "Jane Doe <CORP\\jdoe>"
run_query { queryId: "Shared Queries/Team/Triage", extraWhere: "[System.Tags] CONTAINS 'hotfix'" }
update_work_items { ids: [...], state: "Active", assignedTo: "Jane Doe <CORP\\jdoe>" }
add_comment_to_work_items { ids: [...], text: "Picked up in sprint 12" }
get_files_content { project: "Infra", repository: "tools", branch: "develop", paths: ["/README.md", "/src/main.ts"] }Notes on TFS API versions
Work item, WIQL, Git and repository endpoints use
api-version=6.0.The work item comments API only exists as a preview in 6.0; the server uses
6.0-preview.3.connectionData(6.0-preview) andidentities(6.0-preview.1) are collection-scoped; the identities call is optional and failures are tolerated.wit/$batchis used for bulk updates; if a server rejects it (404/405/400) the tool transparently falls back to individual PATCH requests.If TFS answers with an HTML sign-in page or HTTP 203 instead of JSON, the PAT is invalid or the base URL does not point at a collection; the error message says so.
Project layout
src/
index.ts stdio entrypoint
server.ts McpServer factory + tool registration
config.ts env parsing, project resolution
client.ts REST client (Basic PAT auth, URL builder, TfsApiError)
services/ TFS API wrappers (workitems, git, identity)
tools/ MCP tool definitions (zod schemas)
util/ html->text, batch helpers, tool result helpers
tests/ vitest suites with a mocked fetchLatest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/K3roru/tfs-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server