.specify/memory/constitution.md
MCPProxy MUST handle up to 1,000 tools efficiently without degradation in search, indexing, or tool routing performance.
Rules:
Rationale: AI agents need fast, reliable tool discovery across hundreds of MCP servers. Blocking operations or memory issues break the user experience and limit practical deployment scale.
All concurrent operations MUST follow actor-based patterns using Go idioms (goroutines + channels). Locks and mutexes MUST be avoided except where proven necessary through benchmarking.
Rules:
Rationale: Lock-based concurrency introduces deadlocks, race conditions, and performance bottlenecks. Actor-based patterns provide clearer ownership, easier debugging, and better scalability.
The core application MUST store all settings in a configuration file (mcp_config.json) to enable headless and remote deployment.
Rules:
Rationale: Remote deployment, automation, and containerization require configuration-driven systems. Tray-specific state would break headless mode and create sync issues.
MCPProxy MUST protect users from malicious MCP servers through automatic quarantine, transparency, and isolation.
Rules:
Rationale: Tool Poisoning Attacks and malicious MCP servers pose real security risks. Defense-in-depth with quarantine + logging + isolation protects users without requiring security expertise.
All features and bug fixes MUST include tests. Tests MUST be written before implementation (red-green-refactor cycle) when feasible.
Rules:
internal/ packagesgolangci-lint without errorsRationale: Go's excellent testing tools make TDD practical. Tests prevent regressions, document behavior, and enable confident refactoring.
After adding a feature or fixing a bug, developers MUST update:
Rules:
CLAUDE.md (if architecture or commands change)README.md (if user-facing behavior changes)Rationale: Documentation drift causes confusion, wasted time, and incorrect behavior. Treating docs as first-class artifacts keeps the project maintainable.
Rule: The core server (mcpproxy) and tray application (mcpproxy-tray) MUST remain separate binaries with clear responsibilities.
Core Responsibilities:
Tray Responsibilities:
Rationale: Headless deployment requires a core that runs without GUI. Separate binaries enable flexible deployment (server-only, GUI-only, or both).
Rule: State changes MUST propagate via the event bus, not polling or file watching.
Implementation:
servers.changed, config.reloaded)/events)Rationale: Event-driven architecture eliminates polling overhead, reduces latency, and provides a single source of truth for state changes.
Rule: Code MUST follow DDD layering with separation between domain logic and infrastructure.
Layers:
internal/index/, internal/cache/internal/runtime/internal/server/, internal/storage/, internal/logs/internal/httpapi/Rationale: Clear layering prevents domain logic from leaking into HTTP handlers or database code, making tests easier and refactoring safer.
Rule: MCP client implementations MUST follow the 3-layer design in internal/upstream/.
Layers:
core/): Stateless, transport-agnostic MCP protocol clientmanaged/): Production client with state management, retries, connection poolingcli/): Debug client with enhanced logging for manual tool testingRationale: Layered clients enable reuse of core protocol logic while supporting different use cases (production vs debugging) without code duplication.
Rule: Before committing changes, developers MUST run:
# Linting
./scripts/run-linter.sh
# Unit tests
go test ./internal/... -v
# E2E tests (API)
./scripts/test-api-e2e.sh
# Full test suite (for major changes)
./scripts/run-all-tests.sh
Rationale: Automated quality gates prevent broken code from entering the main branch and reduce review overhead.
Rule: All errors MUST follow Go idioms:
error return values (no exceptions)fmt.Errorf("context: %w", err)cmd/mcpproxy/exit_codes.go)Rationale: Consistent error handling improves debuggability and enables automated error recovery (e.g., tray app retry logic).
Rule: Commits MUST be atomic, descriptive, and follow conventional commits format:
feat: for new featuresfix: for bug fixesdocs: for documentation changesrefactor: for code restructuring without behavior changestest: for test additions or fixeschore: for build, CI, or tooling changesIssue References:
Related #123 - Links commits to issues without auto-closingFixes #123, Closes #123, Resolves #123 - These auto-close issues on mergeCo-Authorship:
Co-Authored-By: Claude <[email protected]>Rationale: Clear commit history enables better code review, easier rollbacks, and automated changelog generation.
Rule: Development follows a two-branch strategy:
main branch: Stable releases (production-ready)next branch: Prerelease builds with latest featuresnext, then next merges to main after validationRationale: Allows users to test cutting-edge features while maintaining a stable release channel.
This constitution supersedes all other development practices and guidelines. Any deviation MUST be justified, documented, and approved through a Pull Request.
Amendment Procedure:
.specify/memory/constitution.mdCONSTITUTION_VERSION following semantic versioningLAST_AMENDED_DATE to the merge dateplan-template.md, spec-template.md, tasks-template.md)CLAUDE.md if architectural principles changeCompliance Review:
Versioning Policy:
Version: 1.1.0 | Ratified: 2025-11-08 | Last Amended: 2025-11-08