The TeamCity MCP Server bridges AI coding assistants (Claude Code, Cursor, Windsurf) with JetBrains TeamCity CI/CD, enabling natural language interaction with your CI/CD infrastructure through comprehensive tools:
Build Management - Trigger and monitor builds with optional branch/comment parameters, check real-time status with test summaries and problems, fetch logs with pagination and tailing, list/search builds by project/status/locators, cancel queued builds, and retrieve detailed results including tests, artifacts, VCS changes, dependencies, and statistics.
Project & Configuration Management - List and view project details with hierarchy exploration, list and examine build configurations with filtering, view parameters, and check parent-child project relationships.
Testing & Quality Analysis - List test failures with detailed information, analyze build problems and their occurrences across builds, view muted tests, and track open investigations with assignees.
Version Control - List and examine VCS roots with properties/settings, browse VCS changes filtered by build or project, and view available branches for projects or build configurations.
Agent Management - List build agents with custom filtering, check agent compatibility with build types or queued builds, count compatible agents, retrieve enabled/disabled status with comments, and list agent pools.
Server Administration - Check connectivity and readiness, get server version/build number/state, monitor health and critical issues, list users with group filtering, view roles and permissions, and get versioned settings status.
Advanced Features - Pagination support (pageSize, maxPages, all parameters), field projection for optimized responses, locator filtering using TeamCity syntax, two operational modes (Dev mode for safe operations and Full mode for complete infrastructure management including creating/cloning build configurations, managing build steps/triggers, and configuring VCS roots/agents), token-based authentication with sensitive value redaction, input validation with structured error handling, and performance-optimized architecture with fast startup and minimal overhead.
Enables natural language control of JetBrains TeamCity CI/CD server, allowing users to trigger builds, monitor build status, fetch logs, analyze test failures, create build configurations, manage build steps and triggers, and configure VCS roots and agents.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TeamCity MCP Servertrigger a build for the main project and show me the status"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TeamCity MCP Server
A Model Control Protocol (MCP) server that bridges AI coding assistants with JetBrains TeamCity CI/CD server, exposing TeamCity operations as MCP tools.
Overview
The TeamCity MCP Server allows developers using AI-powered coding assistants (Claude Code, Cursor, Windsurf) to interact with TeamCity directly from their development environment via MCP tools.
Features
π Two Operational Modes
Dev Mode (default): Safe CI/CD operations
Trigger builds
Monitor build status and progress
Fetch build logs
Investigate test failures
List projects and configurations
Full Mode: Complete infrastructure management
All Dev mode features, plus:
Create and clone build configurations
Manage build steps and triggers
Configure VCS roots and agents
Set up new projects
Modify infrastructure settings
See the Tools Mode Matrix for the complete list of 77 tools and their availability by mode.
π― Key Capabilities
Trigger and monitor builds, fetch logs, and inspect test failures
Token-based authentication to TeamCity; sensitive values redacted in logs
Modern architecture: simple, direct implementation with a singleton client
Performance-conscious: fast startup with minimal overhead
Clean codebase with clear module boundaries
Installation
Prerequisites
Node.js >= 20.10.0
TeamCity Server 2020.1+ with REST API access
TeamCity authentication token
Quick Start
npm Package
Run the MCP server via npx (requires Node 20.x). Set your TeamCity environment variables inline or via a .env in the working directory.
Claude Code
Add the MCP:
claude mcp add [-s user] teamcity -- npx -y @daghis/teamcity-mcp
With env vars (if not using .env):
claude mcp add [-s user] teamcity -- env TEAMCITY_URL="https://teamcity.example.com" TEAMCITY_TOKEN="tc_<your_token>" MCP_MODE=dev npx -y @daghis/teamcity-mcp
With CLI arguments (recommended for Windows):
claude mcp add [-s user] teamcity -- npx -y @daghis/teamcity-mcp --url "https://teamcity.example.com" --token "tc_<your_token>" --mode dev
Context usage (Opus 4.1, estimates):
Dev (default): ~14k tokens for MCP tools
Full (
MCP_MODE=full): ~26k tokens for MCP tools
Windows Users
On Windows, Claude Code's MCP configuration may not properly merge environment variables. Use CLI arguments as a workaround:
Or use a config file for better security (token not visible in process list):
Configuration
Environment is validated centrally with Zod. Supported variables and defaults:
These values are normalized in src/config/index.ts and consumed by src/teamcity/config.ts via helper getters.
Usage Examples
Once integrated with your AI coding assistant:
Tool Responses and Pagination
Responses: Tools now return consistent MCP content. For list/get operations, the
content[0].textcontains a JSON string. Example shape:{ "items": [...], "pagination": { "page": 1, "pageSize": 100 } }or{ "items": [...], "pagination": { "mode": "all", "pageSize": 100, "fetched": 250 } }.Pagination: Most list_* tools accept
pageSize,maxPages, andall:pageSizecontrols items per page.all: truefetches multiple pages up tomaxPages.Legacy
countonlist_buildsis kept for compatibility butpageSizeis preferred.
Validation and Errors
Input validation: Tool inputs are validated with Zod schemas; invalid input returns a structured error payload in the response content (JSON string) with
success: falseanderror.code = VALIDATION_ERROR.Error shaping: Errors are formatted consistently via a global handler. In production, messages may be sanitized; sensitive values (e.g., tokens) are redacted in logs.
API Usage
Note: The legacy helpers exported from
src/teamcity/index.tsremain only for compatibility and include placeholder implementations. Prefer the MCP tools (see the reference linked above) or theTeamCityAPIshown here when automating workflows.
Development
Bundle analysis in CI
The CI workflow runs npm run build:bundle and uploads the generated coverage/bundles JSON using codecov/codecov-action with the javascript-bundle plugin.
Project Structure
API Documentation
The MCP server exposes tools for TeamCity operations. Each tool corresponds to specific TeamCity REST API endpoints:
Build Management
TriggerBuild- Queue a new buildGetBuildStatus- Check build progressFetchBuildLog- Retrieve build logsListBuilds- Search builds by criteria
Test Analysis
ListTestFailures- Get failing testsGetTestDetails- Detailed test informationAnalyzeBuildProblems- Identify failure reasons
Configuration (Full Mode Only)
create_build_config- Create new TeamCity build configurations with full support for:VCS roots (Git, SVN, Perforce) with authentication
Build steps (script, Maven, Gradle, npm, Docker, PowerShell)
Triggers (VCS, schedule, finish-build, maven-snapshot)
Parameters and template-based configurations
See the MCP Tool Reference for argument details and additional options.
clone_build_config- Duplicate existing configurations into any project, preserving steps, triggers, and parameters.update_build_config- Adjust names, descriptions, artifact rules, and pause state for a configuration.manage_build_steps- Add, update, remove, or reorder build steps through a single tool surface.manage_build_triggers- Add or delete build triggers with full property support.create_vcs_root&add_vcs_root_to_build- Define VCS roots and attach them to build configurations.
See also: docs/TEAMCITY_MCP_TOOLS_GUIDE.md for expanded workflows and examples that align with the current MCP implementation.
Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
Security
Token Management
Configure
TEAMCITY_TOKENvia environment variable or config file (see.env.example); never commit real tokensUse a token with minimal required permissions; read-only tokens work for most Dev mode operations
Token-based authentication only; the MCP server does not support username/password
Logs redact sensitive values including tokens
Mode Selection
Prefer Dev mode unless Full mode is explicitly neededβthis limits the blast radius of any misconfiguration or prompt injection
Full mode enables destructive operations (project deletion, agent management) that cannot be easily undone
Network Security
Always use HTTPS for TeamCity connections; the server does not enforce this but strongly recommends it
The MCP server connects only to the configured TeamCity URL; no other network calls are made
AI Assistant Considerations
AI assistants could be manipulated via prompt injection in build logs, test output, or other TeamCity data
Dev mode's limited tool set reduces the impact of such attacks
All actions appear in TeamCity's audit log under the token's associated user
Build logs and test failure details may contain sensitive information (secrets, paths, internal URLs) that become visible to the AI assistant
Repository Security
This repository has GitHub secret scanning and push protection enabled. See SECURITY.md for vulnerability reporting.
Support
GitHub Issues: Report bugs or request features
Documentation: See the
docs/folder in this repository
Acknowledgments
JetBrains TeamCity for the excellent CI/CD platform
Anthropic for the Model Control Protocol specification
The open-source community for continuous support
See THIRD_PARTY_NOTICES.md for third-party licenses
Built with β€οΈ for developers who love efficient CI/CD workflows