Tribal Knowledge Service
STDIOMCP server implementation for error knowledge tracking and retrieval.
MCP server implementation for error knowledge tracking and retrieval.
Tribal is an MCP (Model Context Protocol) server implementation for error knowledge tracking and retrieval. It provides both REST API and native MCP interfaces for integration with tools like Claude Code and Cline.
Tribal helps Claude remember and learn from programming errors. When you start a Claude Code session, Tribal is automatically available through MCP without additional imports.
Claude will:
The simplest approach is to install directly from the current directory:
# From the project root directory cd /path/to/tribal # Install using uv uv pip install .
For development work where you want changes to be immediately reflected:
# From the project root directory cd /path/to/tribal # Install in development mode uv pip install -e .
If you want to build a distributable package:
# Make sure you're in the project root directory cd /path/to/tribal # Install the build package if needed uv pip install build # Build the package python -m build # This creates distribution files in the dist/ directory # Now install the wheel file uv pip install dist/tribal-0.1.0-py3-none-any.whl
uv tool install
commandYou can also use the tool installation approach:
# Install as a global tool cd /path/to/tribal uv tool install . # Or install in development mode uv tool install -e .
After installation, verify that the tool is properly installed:
# Check the installation which tribal # Check the version tribal version
After installation, you can integrate with Claude:
# Add Tribal to Claude Code claude mcp add tribal --launch "tribal" # Verify the configuration claude mcp list # For Docker container claude mcp add tribal http://localhost:5000
Tribal provides these MCP tools:
add_error
- Create new error record (POST /errors)get_error
- Retrieve error by UUID (GET /errors/{id})update_error
- Modify existing error (PUT /errors/{id})delete_error
- Remove error record (DELETE /errors/{id})search_errors
- Find errors by criteria (GET /errors)find_similar
- Semantic similarity search (GET /errors/similar)get_token
- Obtain JWT token (POST /token)When Claude encounters an error:
I'll track this error and look for similar problems in our knowledge base.
When Claude finds a solution:
I've found a solution! I'll store this in our knowledge base for next time.
You can ask Claude to:
# Run the server tribal # Get help tribal help # Show version tribal version # Run with options tribal server --port 5000 --auto-port
# Run the Tribal server python -m mcp_server_tribal.mcp_app # Run the FastAPI backend server python -m mcp_server_tribal.app
# Legacy MCP server mcp-server # Legacy FastAPI server mcp-api
# Development mode with auto-reload mcp-api --reload mcp-server --reload # Custom port mcp-api --port 8080 mcp-server --port 5000 # Auto port selection mcp-api --auto-port mcp-server --auto-port
The FastAPI server will be available at http://localhost:8000 with API documentation at /docs. The MCP server will be available at http://localhost:5000 for Claude and other MCP-compatible LLMs.
PERSIST_DIRECTORY
: ChromaDB storage path (default: "./chroma_db")API_KEY
: Authentication key (default: "dev-api-key")SECRET_KEY
: JWT signing key (default: "insecure-dev-key-change-in-production")REQUIRE_AUTH
: Authentication requirement (default: "false")PORT
: Server port (default: 8000)MCP_API_URL
: FastAPI server URL (default: "http://localhost:8000")MCP_PORT
: MCP server port (default: 5000)MCP_HOST
: Host to bind to (default: "0.0.0.0")API_KEY
: FastAPI access key (default: "dev-api-key")AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
, AWS_S3_BUCKET
: For AWS integrationPOST /errors
: Create new error recordGET /errors/{error_id}
: Get error by IDPUT /errors/{error_id}
: Update error recordDELETE /errors/{error_id}
: Delete errorGET /errors
: Search errors by criteriaGET /errors/similar
: Find similar errorsPOST /token
: Get authentication token# Add a new error record mcp-client --action add --error-type ImportError --language python --error-message "No module named 'requests'" --solution-description "Install requests" --solution-explanation "You need to install the requests package" # Get an error by ID mcp-client --action get --id <error-id> # Search for errors mcp-client --action search --error-type ImportError --language python # Find similar errors mcp-client --action similar --query "ModuleNotFoundError: No module named 'pandas'"
pytest pytest tests/path_to_test.py::test_name # For specific tests
ruff check . mypy . black .
This project uses GitHub Actions for continuous integration and deployment. The workflow automatically runs tests, linting, and type checking on push to main and pull requests.
Test: Runs linting, type checking, and unit tests
Build and Publish: Builds and publishes the package to PyPI
You can test the GitHub workflow locally using the provided script:
# Make the script executable chmod +x scripts/test-workflow.sh # Run the workflow locally ./scripts/test-workflow.sh
This script simulates the GitHub workflow steps on your local machine:
Note: The script skips the publishing step for local testing.
tribal/
├── src/
│ ├── mcp_server_tribal/ # Core package
│ │ ├── api/ # FastAPI endpoints
│ │ ├── cli/ # Command-line interface
│ │ ├── models/ # Pydantic models
│ │ ├── services/ # Service layer
│ │ │ ├── aws/ # AWS integrations
│ │ │ └── chroma_storage.py # ChromaDB implementation
│ │ └── utils/ # Utility functions
│ └── examples/ # Example usage code
├── tests/ # pytest test suite
├── docker-compose.yml # Docker production setup
├── pyproject.toml # Project configuration
├── VERSIONING.md # Versioning strategy documentation
├── CHANGELOG.md # Version history
├── .bumpversion.cfg # Version bumping configuration
└── README.md # Project documentation
Tribal follows Semantic Versioning. See VERSIONING.md for complete details about:
Check the version with:
# Display version information tribal version
# Add a dependency uv pip add <package-name> # Add a development dependency uv pip add <package-name> # Update dependencies uv pip sync requirements.txt requirements-dev.txt
# Build and start containers docker-compose up -d --build # View logs docker-compose logs -f # Stop containers docker-compose down # With custom environment variables API_PORT=8080 MCP_PORT=5000 REQUIRE_AUTH=true API_KEY=your-secret-key docker-start
Open ~/Library/Application Support/Claude/claude_desktop_config.json
Add the MCP server configuration (assumes Tribal tool is already installed):
{ "mcpServers": [ { "name": "tribal", "launchCommand": "tribal" } ] }
Restart Claude for Desktop
Start the container:
cd /path/to/tribal docker-start
Configure Claude for Desktop:
{ "mcpServers": [ { "name": "tribal", "url": "http://localhost:5000" } ] }
# For Docker container claude mcp add tribal http://localhost:5000 # For directly launched server claude mcp add tribal --launch "tribal" # Test the connection claude mcp list claude mcp test tribal
which tribal
claude mcp list
tribal status
The project includes placeholder implementations for AWS services:
S3Storage
: For storing error records in Amazon S3DynamoDBStorage
: For using DynamoDB as the database