{
  "markdown": "# TeamCity MCP Server\n\n[![CI](https://github.com/Daghis/teamcity-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/Daghis/teamcity-mcp/actions/workflows/ci.yml)\n[![CodeQL](https://github.com/Daghis/teamcity-mcp/actions/workflows/codeql.yml/badge.svg)](https://github.com/Daghis/teamcity-mcp/actions/workflows/codeql.yml)\n[![codecov](https://codecov.io/gh/Daghis/teamcity-mcp/branch/main/graph/badge.svg)](https://codecov.io/gh/Daghis/teamcity-mcp)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\nA Model Control Protocol (MCP) server that bridges AI coding assistants with JetBrains TeamCity CI/CD server, exposing TeamCity operations as MCP tools.\n\n<a href=\"https://glama.ai/mcp/servers/@Daghis/teamcity-mcp\">\n  <img width=\"380\" height=\"200\" src=\"https://glama.ai/mcp/servers/@Daghis/teamcity-mcp/badge\" alt=\"TeamCity Server MCP server\" />\n</a>\n\n> [!NOTE]\n> **Project status (June 2026): stable, low-key maintenance.** This does what it set out to do and is no longer under active development. It still works and stays installable; issues and PRs may get slow or no response, and security fixes are best-effort.\n>\n> JetBrains now ships official AI integration for TeamCity — a built-in MCP and the [TeamCity CLI](https://github.com/JetBrains/teamcity-cli) with an installable agent skill — which is the better default for most workflows. See [_How this compares to JetBrains' official tooling_](#how-this-compares-to-jetbrains-official-tooling) below before adopting.\n\n## Overview\n\nThe 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.\n\n> **Upgrading from 1.x?** Version 2.0.0 moved 15 tools from Dev to Full mode, including queue management, agent compatibility checks, and server health monitoring. If you relied on these tools in Dev mode, switch to `MCP_MODE=full` or use runtime mode switching (v2.1.0+). See [CHANGELOG.md](CHANGELOG.md) for details.\n\n## Features\n\n### 🚀 Two Operational Modes\n\n- **Dev Mode** (default): Safe CI/CD operations (31 tools, ~14k context tokens)\n  - Trigger builds and monitor status\n  - Fetch build logs and inspect test failures\n  - List projects, configurations, and queue\n  - Read parameters and investigate problems\n\n- **Full Mode**: Complete infrastructure management (87 tools, ~26k context tokens)\n  - All Dev mode features, plus:\n  - Create and clone build configurations\n  - Manage build steps, triggers, and dependencies\n  - Configure VCS roots and agents\n  - Full CRUD for parameters (build config, project, and output parameters)\n  - Queue management and server administration\n\n**Runtime Mode Switching (v2.1.0+):** Switch between modes at runtime using the `get_mcp_mode` and `set_mcp_mode` tools—no restart required. MCP clients that support notifications will see the tool list update automatically.\n\nSee the [Tools Mode Matrix](docs/mcp-tools-mode-matrix.md) for the complete list of 87 tools and their availability by mode.\n\n### 🎯 Key Capabilities\n\n- Trigger and monitor builds, fetch logs, and inspect test failures\n- Token-based authentication to TeamCity; sensitive values redacted in logs\n- Modern architecture: simple, direct implementation with a singleton client\n- Performance-conscious: fast startup with minimal overhead\n- Clean codebase with clear module boundaries\n\n## How this compares to JetBrains' official tooling\n\n**As of June 2026,** JetBrains ships first-party AI integration for TeamCity: a built-in MCP endpoint and the [TeamCity CLI](https://github.com/JetBrains/teamcity-cli), which includes an installable agent skill. Together these are JetBrains' recommended path and cover the common AI workflows — reading logs, diagnosing failures, and rerunning builds — with no install and official support.\n\nteamcity-mcp predates that tooling and overlaps with it. Broadly, the official tooling is the better default today; teamcity-mcp's remaining edge is a broader set of write and management operations exposed as an MCP server. That gap is real but narrowing, and JetBrains' tooling is evolving quickly — so rather than pin down a feature-by-feature comparison here (it would go stale fast), check the current docs and pick what fits:\n\n- [TeamCity 2026.1 announcement](https://blog.jetbrains.com/teamcity/2026/05/teamcity-20261/) — overview of the official AI integration\n- [AI agent integration docs](https://www.jetbrains.com/help/teamcity/ai-agent-integration.html) — the built-in MCP\n- [TeamCity CLI](https://github.com/JetBrains/teamcity-cli) — the terminal + agent-skill path\n\nIf you're comfortable with JetBrains' CLI, you may not need this project at all. It stays MIT-licensed and installable for whatever the built-ins don't yet reach — fork it if you want to take it further yourself.\n\n## Installation\n\n### Prerequisites\n\n- Node.js >= 20.10.0 (LTS versions 20, 22, 24 tested in CI)\n- TeamCity Server 2020.1+ with REST API access\n- TeamCity authentication token\n\n### Quick Start\n\n```bash\n# Clone the repository\ngit clone https://github.com/Daghis/teamcity-mcp.git\ncd teamcity-mcp\n\n# Install dependencies\nnpm install\n\n# Configure environment\ncp .env.example .env\n# Edit .env with your TeamCity URL and token\n\n# Run in development mode\nnpm run dev\n```\n\n### npm Package\n\nRun the MCP server via npx (requires Node 20.x). Set your TeamCity environment variables inline or via a `.env` in the working directory.\n\n```bash\n# One-off run (inline envs)\nTEAMCITY_URL=\"https://teamcity.example.com\" \\\nTEAMCITY_TOKEN=\"<your_token>\" \\\nMCP_MODE=dev \\\nnpx -y @daghis/teamcity-mcp\n\n# Or rely on .env in the current directory\nnpx -y @daghis/teamcity-mcp\n```\n\n## Claude Code\n\n- Add the MCP (relying on `.env` for configuration):\n  - `claude mcp add teamcity -- npx -y @daghis/teamcity-mcp`\n- With env vars (if not using .env):\n  - `claude mcp add teamcity -e TEAMCITY_URL=\"https://teamcity.example.com\" -e TEAMCITY_TOKEN=\"tc_<your_token>\" -- npx -y @daghis/teamcity-mcp`\n- With CLI arguments (recommended for Windows):\n  - `claude mcp add teamcity -- npx -y @daghis/teamcity-mcp --url \"https://teamcity.example.com\" --token \"tc_<your_token>\" --mode dev`\n- Add `-s user` to install user-wide instead of project-scoped (default)\n- Context usage (Opus 4.1, estimates):\n  - Dev (default): ~14k tokens for MCP tools\n  - Full (`MCP_MODE=full`): ~26k tokens for MCP tools\n\n### Windows Users\n\nOn Windows, Claude Code's MCP configuration [may not properly merge environment variables](https://github.com/anthropics/claude-code/issues/1254). Use CLI arguments as a workaround:\n\n```json\n{\n  \"mcpServers\": {\n    \"teamcity\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"-y\",\n        \"@daghis/teamcity-mcp\",\n        \"--url\",\n        \"https://teamcity.example.com\",\n        \"--token\",\n        \"YOUR_TOKEN\"\n      ]\n    }\n  }\n}\n```\n\nOr use a config file for better security (token not visible in process list):\n\n```json\n{\n  \"mcpServers\": {\n    \"teamcity\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@daghis/teamcity-mcp\", \"--config\", \"C:\\\\path\\\\to\\\\teamcity.env\"]\n    }\n  }\n}\n```\n\n## Configuration\n\nEnvironment is validated centrally with Zod. Supported variables and defaults:\n\n```env\n# Server Configuration\nPORT=3000\nNODE_ENV=development\nLOG_LEVEL=info\n\n# TeamCity Configuration (aliases supported)\nTEAMCITY_URL=https://teamcity.example.com\nTEAMCITY_TOKEN=your-auth-token\n# Optional aliases:\n# TEAMCITY_SERVER_URL=...\n# TEAMCITY_API_TOKEN=...\n\n# MCP Mode (dev or full)\nMCP_MODE=dev\n\n# Optional advanced TeamCity options (defaults shown)\n# Connection\n# TEAMCITY_TIMEOUT=30000\n# TEAMCITY_MAX_CONCURRENT=10\n# TEAMCITY_KEEP_ALIVE=true\n# TEAMCITY_COMPRESSION=true\n\n# Extra headers attached to every TeamCity request — useful when TeamCity\n# sits behind a reverse proxy that gates access on custom headers (e.g.\n# Cloudflare Zero Trust service tokens). One env var per header; the part\n# after `TEAMCITY_HEADER_` is used verbatim as the HTTP header name.\n# Example (note the literal hyphens — most shells need quoting):\n# TEAMCITY_HEADER_CF-Access-Client-Id=<id>\n# TEAMCITY_HEADER_CF-Access-Client-Secret=<secret>\n\n# Retry\n# TEAMCITY_RETRY_ENABLED=true\n# TEAMCITY_MAX_RETRIES=3\n# TEAMCITY_RETRY_DELAY=1000\n# TEAMCITY_MAX_RETRY_DELAY=30000\n\n# Pagination\n# TEAMCITY_PAGE_SIZE=100\n# TEAMCITY_MAX_PAGE_SIZE=1000\n# TEAMCITY_AUTO_FETCH_ALL=false\n\n# Circuit Breaker\n# TEAMCITY_CIRCUIT_BREAKER=true\n# TEAMCITY_CB_FAILURE_THRESHOLD=5\n# TEAMCITY_CB_RESET_TIMEOUT=60000\n# TEAMCITY_CB_SUCCESS_THRESHOLD=2\n```\n\nThese values are normalized in `src/config/index.ts` and consumed by `src/teamcity/config.ts` via helper getters.\n\n## Usage Examples\n\nOnce integrated with your AI coding assistant:\n\n```\n\"Build the frontend on feature branch\"\n\"Why did last night's tests fail?\"\n\"Deploy staging with the latest build\"\n\"Create a new build config for the mobile app\"\n```\n\n### Tool Responses and Pagination\n\n- Responses: Tools now return consistent MCP content. For list/get operations, the `content[0].text` contains a JSON string. Example shape:\n  `{ \"items\": [...], \"pagination\": { \"page\": 1, \"pageSize\": 100 } }` or `{ \"items\": [...], \"pagination\": { \"mode\": \"all\", \"pageSize\": 100, \"fetched\": 250 } }`.\n- Pagination: Most list\\_\\* tools accept `pageSize`, `maxPages`, and `all`:\n  - `pageSize` controls items per page.\n  - `all: true` fetches multiple pages up to `maxPages`.\n  - Legacy `count` on `list_builds` is kept for compatibility but `pageSize` is preferred.\n\n### Validation and Errors\n\n- Input validation: Tool inputs are validated with Zod schemas; invalid input returns a structured error payload in the response content (JSON string) with `success: false` and `error.code = VALIDATION_ERROR`.\n- 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.\n\n### API Usage\n\n```typescript\nimport { TeamCityAPI } from '@/api-client';\n\n// Get the API client instance\nconst api = TeamCityAPI.getInstance();\n\n// List projects\nconst projects = await api.listProjects();\n\n// Get build status\nconst build = await api.getBuild('BuildId123');\n\n// Trigger a new build\nconst newBuild = await api.triggerBuild('BuildConfigId', {\n  branchName: 'main',\n});\n```\n\n> **Note:** The legacy helpers exported from `src/teamcity/index.ts` remain only for compatibility and include placeholder implementations. Prefer the MCP tools (see the reference linked above) or the `TeamCityAPI` shown here when automating workflows.\n\n## Development\n\n```bash\n# Run tests\nnpm test\n\n# Run tests with coverage\nnpm run test:coverage\n\n# Lint code\nnpm run lint\n\n# Format code\nnpm run format\n\n# Type check\nnpm run typecheck\n\n# Build for production\nnpm run build\n\n# Analyze bundle for Codecov\nnpm run build:bundle\n```\n\n### Bundle analysis in CI\n\nThe CI workflow runs `npm run build:bundle` and uploads the generated `coverage/bundles` JSON using `codecov/codecov-action` with the `javascript-bundle` plugin.\n\n## Project Structure\n\n```\nteamcity-mcp/\n├── src/                    # Source code\n│   ├── tools.ts           # All 87 MCP tool definitions\n│   ├── server.ts          # MCP server setup\n│   ├── api-client.ts      # TeamCity API singleton\n│   ├── config/            # Configuration with Zod validation\n│   ├── teamcity/          # Domain logic (build, agent, config managers)\n│   ├── teamcity-client/   # Auto-generated OpenAPI client\n│   ├── types/             # TypeScript type definitions\n│   └── utils/             # Logger, MCP helpers, pagination\n├── tests/                  # Unit and integration tests\n├── docs/                   # Documentation\n└── scripts/                # Build and maintenance scripts\n```\n\n## API Documentation\n\nThe MCP server exposes tools for TeamCity operations. Each tool corresponds to specific TeamCity REST API endpoints:\n\n### Build Management\n\n- `TriggerBuild` - Queue a new build\n- `GetBuildStatus` - Check build progress\n- `FetchBuildLog` - Retrieve build logs\n- `ListBuilds` - Search builds by criteria\n\n### Test Analysis\n\n- `ListTestFailures` - Get failing tests\n- `GetTestDetails` - Detailed test information\n- `AnalyzeBuildProblems` - Identify failure reasons\n\n### Configuration (Full Mode Only)\n\n- `create_build_config` - Create new TeamCity build configurations with full support for:\n  - VCS roots (Git, SVN, Perforce) with authentication\n  - Build steps (script, Maven, Gradle, npm, Docker, PowerShell)\n  - Triggers (VCS, schedule, finish-build, maven-snapshot)\n  - Parameters and template-based configurations\n  - See the [MCP Tool Reference](docs/mcp-tools-reference.md) for argument details and additional options.\n- `clone_build_config` - Duplicate existing configurations into any project, preserving steps, triggers, and parameters.\n- `update_build_config` - Adjust names, descriptions, artifact rules, and pause state for a configuration.\n- `manage_build_steps` - Add, update, remove, or reorder build steps through a single tool surface.\n- `manage_build_triggers` - Add or delete build triggers with full property support.\n- `create_vcs_root` & `add_vcs_root_to_build` - Define VCS roots and attach them to build configurations.\n\nSee also: [`docs/TEAMCITY_MCP_TOOLS_GUIDE.md`](docs/TEAMCITY_MCP_TOOLS_GUIDE.md) for expanded workflows and examples that align with the current MCP implementation.\n\n## Contributing\n\nWe welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.\n\n## Security\n\n### Token Management\n\n- Configure `TEAMCITY_TOKEN` via environment variable or config file (see `.env.example`); never commit real tokens\n- Use a token with minimal required permissions; read-only tokens work for most Dev mode operations\n- Token-based authentication only; the MCP server does not support username/password\n- Logs redact sensitive values including tokens\n\n### Mode Selection\n\n- Prefer **Dev mode** unless Full mode is explicitly needed—this limits the blast radius of any misconfiguration or prompt injection\n- Full mode enables destructive operations (project deletion, agent management) that cannot be easily undone\n\n### Network Security\n\n- Always use HTTPS for TeamCity connections; the server does not enforce this but strongly recommends it\n- The MCP server connects only to the configured TeamCity URL; no other network calls are made\n\n### AI Assistant Considerations\n\n- AI assistants could be manipulated via prompt injection in build logs, test output, or other TeamCity data\n- Dev mode's limited tool set reduces the impact of such attacks\n- All actions appear in TeamCity's audit log under the token's associated user\n- Build logs and test failure details may contain sensitive information (secrets, paths, internal URLs) that become visible to the AI assistant\n\n### Repository Security\n\nThis repository has GitHub secret scanning and push protection enabled. See [SECURITY.md](SECURITY.md) for vulnerability reporting.\n\n## Support\n\n- GitHub Issues: [Report bugs or request features](https://github.com/Daghis/teamcity-mcp/issues)\n- Documentation: See the `docs/` folder in this repository\n\n## Acknowledgments\n\n- JetBrains TeamCity for the excellent CI/CD platform\n- Anthropic for the Model Control Protocol specification\n- The open-source community for continuous support\n- See [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) for third-party licenses\n\n---\n\nBuilt with ❤️ for developers who love efficient CI/CD workflows\n",
  "bytes": 15414,
  "sha": "c17a93a1f9333caf7c06d51ff30f28eac2e5bdf8c24d65390add1f783e4ead37",
  "repo_slug": "daghis/teamcity-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_daghis_teamcity_044d992d/readme"
}