feat(backend): implement MCP client infrastructure (#55)
Core MCP client implementation with comprehensive tooling:
**Services:**
- MCPClientManager: Main facade for all MCP operations
- MCPServerRegistry: Thread-safe singleton for server configs
- ConnectionPool: Connection pooling with auto-reconnection
- ToolRouter: Automatic tool routing with circuit breaker
- AsyncCircuitBreaker: Custom async-compatible circuit breaker
**Configuration:**
- YAML-based config with Pydantic models
- Environment variable expansion support
- Transport types: HTTP, SSE, STDIO
**API Endpoints:**
- GET /mcp/servers - List all MCP servers
- GET /mcp/servers/{name}/tools - List server tools
- GET /mcp/tools - List all tools from all servers
- GET /mcp/health - Health check all servers
- POST /mcp/call - Execute tool (admin only)
- GET /mcp/circuit-breakers - Circuit breaker status
- POST /mcp/circuit-breakers/{name}/reset - Reset circuit breaker
- POST /mcp/servers/{name}/reconnect - Force reconnection
**Testing:**
- 156 unit tests with comprehensive coverage
- Tests for all services, routes, and error handling
- Proper mocking and async test support
**Documentation:**
- MCP_CLIENT.md with usage examples
- Phase 2+ workflow documentation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
60
backend/mcp_servers.yaml
Normal file
60
backend/mcp_servers.yaml
Normal file
@@ -0,0 +1,60 @@
|
||||
# MCP Server Configuration
|
||||
#
|
||||
# This file defines the MCP servers that the Syndarix backend connects to.
|
||||
# Environment variables can be used with ${VAR:-default} syntax.
|
||||
#
|
||||
# Example:
|
||||
# url: ${MY_SERVER_URL:-http://localhost:8001}
|
||||
#
|
||||
# For development, these servers typically run as separate Docker containers.
|
||||
# See docker-compose.yml for container definitions.
|
||||
|
||||
mcp_servers:
|
||||
# LLM Gateway - Multi-provider AI interactions
|
||||
llm-gateway:
|
||||
url: ${LLM_GATEWAY_URL:-http://localhost:8001}
|
||||
transport: http
|
||||
timeout: 60
|
||||
retry_attempts: 3
|
||||
retry_delay: 1.0
|
||||
retry_max_delay: 30.0
|
||||
circuit_breaker_threshold: 5
|
||||
circuit_breaker_timeout: 30.0
|
||||
enabled: true
|
||||
description: "LLM Gateway for Anthropic, OpenAI, Ollama, and other providers"
|
||||
|
||||
# Knowledge Base - RAG and document retrieval
|
||||
knowledge-base:
|
||||
url: ${KNOWLEDGE_BASE_URL:-http://localhost:8002}
|
||||
transport: http
|
||||
timeout: 30
|
||||
retry_attempts: 3
|
||||
circuit_breaker_threshold: 5
|
||||
enabled: true
|
||||
description: "Knowledge Base with pgvector for semantic search and RAG"
|
||||
|
||||
# Git Operations - Repository management
|
||||
git-ops:
|
||||
url: ${GIT_OPS_URL:-http://localhost:8003}
|
||||
transport: http
|
||||
timeout: 120
|
||||
retry_attempts: 2
|
||||
circuit_breaker_threshold: 3
|
||||
enabled: true
|
||||
description: "Git Operations for clone, commit, push, and repository management"
|
||||
|
||||
# Issues - Issue tracker integration
|
||||
issues:
|
||||
url: ${ISSUES_URL:-http://localhost:8004}
|
||||
transport: http
|
||||
timeout: 30
|
||||
retry_attempts: 3
|
||||
circuit_breaker_threshold: 5
|
||||
enabled: true
|
||||
description: "Issue Tracker integration for Gitea, GitHub, and GitLab"
|
||||
|
||||
# Global defaults
|
||||
default_timeout: 30
|
||||
default_retry_attempts: 3
|
||||
connection_pool_size: 10
|
||||
health_check_interval: 30
|
||||
Reference in New Issue
Block a user