TeamCity MCP Server
Enables AI coding assistants to interact with JetBrains TeamCity CI/CD server through natural language commands. Supports triggering builds, monitoring status, analyzing test failures, and managing build configurations directly from development environments.
README
TeamCity MCP Server
A Model Control Protocol (MCP) server that bridges AI coding assistants with JetBrains TeamCity CI/CD server, enabling natural language control of builds, tests, and deployments.
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 using natural language commands.
Features
🚀 Two Operational Modes
-
Dev Mode: Safe CI/CD operations
- Trigger builds
- Monitor build status and progress
- Fetch and analyze 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
🎯 Key Capabilities
- Natural Language Control: Execute CI/CD tasks using conversational commands
- Intelligent Analysis: Automatic test failure summarization and build problem identification
- Real-time Monitoring: Live build status updates via WebSocket/SSE
- Enterprise Security: Token-based authentication with audit logging
- Modern Architecture: Simple, direct implementation with singleton pattern
- Performance Optimized: Fast startup time with minimal overhead
- Clean Codebase: Well-organized modules with clear separation of concerns
Installation
Prerequisites
- Node.js >= 20.10.0
- TeamCity Server 2020.1+ with REST API access
- TeamCity authentication token
Quick Start
# Clone the repository
git clone https://github.com/Daghis/teamcity-mcp.git
cd teamcity-mcp
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env with your TeamCity URL and token
# Run in development mode
npm run dev
npm Package (Coming Soon)
npx @daghis/teamcity-mcp --mode=dev
Configuration
Environment is validated centrally with Zod. Supported variables and defaults:
# Server Configuration
PORT=3000
NODE_ENV=development
LOG_LEVEL=info
# TeamCity Configuration (aliases supported)
TEAMCITY_URL=https://teamcity.example.com
TEAMCITY_TOKEN=your-auth-token
# Optional aliases:
# TEAMCITY_SERVER_URL=...
# TEAMCITY_API_TOKEN=...
# MCP Mode (dev or full)
MCP_MODE=dev
# Optional advanced TeamCity options (defaults shown)
# Connection
# TEAMCITY_TIMEOUT=30000
# TEAMCITY_MAX_CONCURRENT=10
# TEAMCITY_KEEP_ALIVE=true
# TEAMCITY_COMPRESSION=true
# Retry
# TEAMCITY_RETRY_ENABLED=true
# TEAMCITY_MAX_RETRIES=3
# TEAMCITY_RETRY_DELAY=1000
# TEAMCITY_MAX_RETRY_DELAY=30000
# Pagination
# TEAMCITY_PAGE_SIZE=100
# TEAMCITY_MAX_PAGE_SIZE=1000
# TEAMCITY_AUTO_FETCH_ALL=false
# Circuit Breaker
# TEAMCITY_CIRCUIT_BREAKER=true
# TEAMCITY_CB_FAILURE_THRESHOLD=5
# TEAMCITY_CB_RESET_TIMEOUT=60000
# TEAMCITY_CB_SUCCESS_THRESHOLD=2
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:
"Build the frontend on feature branch"
"Why did last night's tests fail?"
"Deploy staging with the latest build"
"Create a new build config for the mobile app"
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
import { TeamCityAPI } from '@/api-client';
// Get the API client instance
const api = TeamCityAPI.getInstance();
// List projects
const projects = await api.listProjects();
// Get build status
const build = await api.getBuild('BuildId123');
// Trigger a new build
const newBuild = await api.triggerBuild('BuildConfigId', {
branchName: 'main',
});
Development
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Lint code
npm run lint
# Format code
npm run format
# Type check
npm run typecheck
# Build for production
npm run build
# Analyze bundle for Codecov
npm run build:bundle
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
teamcity-mcp/
├── src/ # Source code
│ ├── tools/ # MCP tool implementations
│ ├── utils/ # Utility functions
│ ├── types/ # TypeScript type definitions
│ └── config/ # Configuration management
├── tests/ # Test files
├── docs/ # Documentation
└── .agent-os/ # Agent OS specifications
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 Tool Reference for details: docs/mcp-tools-reference.md
CloneBuildConfig- Duplicate configurations (coming soon)ManageBuildSteps- Add/edit/remove steps (coming soon)ManageVCS- Configure version control (coming soon)
See also: docs/TEAMCITY_MCP_TOOLS_GUIDE.md for an overview. Some advanced sections in that guide describe future enhancements; the behavior above reflects the current implementation.
Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
Security
- Configure
TEAMCITY_TOKENvia environment (see.env.example); never commit real tokens - Token-based authentication only
- Logs redact sensitive values
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
Built with ❤️ for developers who love efficient CI/CD workflows
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。