Λογότυπο Gitea MCP Server

Gitea MCP Server

Κοινότητα
MushroomFleet

MCP server for Gitea — manage repos, issues, pull requests & organizations from AI coding assistants

ΕκδότηςMushroomFleet
Αποθετήριοgitea-mcp
ΓλώσσαTypeScript
Forks
9
Αστέρια
15
Διαθέσιμα εργαλεία
0
Τύπος μεταφοράςstdio
Κατηγορίες
Άδεια χρήσηςApache-2.0
Σύνδεσμοι
  • Συνδέστε εργαλεία σε ροές εργασίας AI

    Το Gitea MCP Server παρέχει δυνατότητες MCP που μπορούν να χρησιμοποιηθούν από συμβατές εφαρμογές-πελάτες AI και πράκτορες AI.

  • 0 διαθέσιμα εργαλεία

    Περιηγηθείτε παρακάτω στις ενέργειες που μπορούν να κληθούν, μαζί με τα ονόματα και τις περιγραφές τους, όταν παρέχονται από τον διακομιστή.

  • Ρυθμίσεις έτοιμες για αντιγραφή

    Χρησιμοποιήστε τα αποσπάσματα εγκατάστασης για να ρυθμίσετε αυτόν τον διακομιστή στην εφαρμογή-πελάτη MCP που προτιμάτε.

  • Δείκτες ενδιαφέροντος για τον ανοιχτό κώδικα

    15 αστέρια και 9 διακλαδώσεις στο συνδεδεμένο αποθετήριο.

Gitea MCP Server

A production-ready Model Context Protocol (MCP) server for seamless integration with self-hosted Gitea platforms. This server provides tools for creating repositories and uploading files while preserving directory structure.

Installation and Setup Guide

This guide provides step-by-step instructions for installing and configuring the Gitea MCP server, including troubleshooting common issues.

Features

  • Repository Creation: Create new repositories on any configured Gitea instance
  • File Upload: Upload files and folders while preserving directory structure
  • Project Sync: Automatically sync entire projects for initial commits (new files only)
  • Advanced File Updates: Smart update tool with conflict resolution for modifying existing files
  • Multi-Instance Support: Connect to multiple Gitea instances simultaneously
  • Rate Limiting: Respect API rate limits per instance
  • Batch Processing: Efficient file upload with configurable batch sizes
  • Comprehensive Logging: Structured logging with security-safe output
  • Error Handling: Robust error handling with retry logic
  • TypeScript: Full type safety and modern JavaScript features

Quick Start

Prerequisites

  • Node.js 18.0.0 or higher
  • Access to one or more Gitea instances
  • Personal access tokens for authentication

Installation

  1. Clone the repository:
bash
git clone <repository-url>
cd gitea-mcp
  1. Install dependencies:
bash
npm install
  1. Configure environment variables:
bash
cp .env.example .env
# Edit .env with your Gitea instance details
  1. Build the project:
bash
npm run build
  1. Start the server:
bash
npm run start:mcp

Troubleshooting Common Issues

Windows Compatibility

If you're running on Windows, you might encounter issues with the build script. The default build script uses the chmod command, which is not available on Windows. The package.json has been updated to use a Windows-compatible build script.

Logging Configuration

If you encounter issues with the logging configuration, make sure you have the pino-pretty package installed:

bash
npm install --save-dev pino-pretty

Environment Variables

The .env file should contain the following configuration:

# Server Configuration
NODE_ENV=development
LOG_LEVEL=debug

# Gitea Configuration
# Replace with your Gitea instance URL and token
GITEA_INSTANCES=[{"id":"main","name":"Main Gitea Instance","baseUrl":"https://your-gitea-instance.com","token":"your-personal-access-token","timeout":30000,"rateLimit":{"requests":100,"windowMs":60000}}]

# Upload Configuration
MAX_FILE_SIZE=10485760
MAX_FILES=100
BATCH_SIZE=10

# Gitea API Configuration
GITEA_TIMEOUT=30000
GITEA_MAX_RETRIES=3

Make sure to replace "https://your-gitea-instance.com" with your actual Gitea instance URL and "your-personal-access-token" with your Gitea personal access token.

Running with Debug Logging

To run the server with debug logging enabled, use the start:mcp script:

bash
npm run start:mcp

This script sets the NODE_ENV to development and LOG_LEVEL to debug before starting the server.

Development Setup

For development with hot reloading:

bash
npm run dev

Configuration

Environment Variables

Create a .env file based on .env.example:

bash
# Server Configuration
NODE_ENV=development
LOG_LEVEL=info

# Gitea Configuration
GITEA_INSTANCES='[
  {
    "id": "main",
    "name": "Main Gitea Instance", 
    "baseUrl": "https://gitea.example.com",
    "token": "your-personal-access-token",
    "timeout": 30000,
    "rateLimit": {
      "requests": 100,
      "windowMs": 60000
    }
  }
]'

# Upload Configuration
MAX_FILE_SIZE=10485760  # 10MB
MAX_FILES=100
BATCH_SIZE=10

# API Configuration
GITEA_TIMEOUT=30000
GITEA_MAX_RETRIES=3

Gitea Instance Configuration

Each Gitea instance requires:

  • id: Unique identifier for the instance
  • name: Human-readable name for logging
  • baseUrl: Base URL of your Gitea instance
  • token: Personal access token with appropriate permissions
  • timeout: Request timeout in milliseconds (optional)
  • rateLimit: Rate limiting configuration (optional)

Personal Access Token Setup

  1. Log into your Gitea instance
  2. Go to Settings → Applications → Personal Access Tokens
  3. Create a new token with these permissions:
    • repo: Full repository access
    • write:repository: Create repositories
    • read:user: Read user information

MCP Client Configuration

Claude Desktop

Add to your Claude Desktop configuration:

json
{
  "mcpServers": {
    "gitea-mcp": {
      "command": "node",
      "args": ["./build/index.js"],
      "cwd": "/path/to/gitea-mcp",
      "env": {
        "NODE_ENV": "production",
        "LOG_LEVEL": "info"
      }
    }
  }
}

Other MCP Clients

The server communicates via stdio and follows the MCP protocol specification. Refer to your client's documentation for configuration details.

Available Tools

create_repository

Create a new repository on a specified Gitea instance.

Parameters:

  • instanceId (string, required): Gitea instance identifier
  • name (string, required): Repository name
  • description (string, optional): Repository description
  • private (boolean, default: true): Make repository private
  • autoInit (boolean, default: true): Initialize with README
  • defaultBranch (string, default: "main"): Default branch name

Example:

json
{
  "instanceId": "main",
  "name": "my-new-repo",
  "description": "A test repository",
  "private": true,
  "autoInit": true,
  "defaultBranch": "main"
}

upload_files

Upload multiple files to a repository while preserving directory structure.

Parameters:

  • instanceId (string, required): Gitea instance identifier
  • owner (string, required): Repository owner username
  • repository (string, required): Repository name
  • files (array, required): Array of file objects with path and content
  • message (string, required): Commit message
  • branch (string, default: "main"): Target branch
  • batchSize (number, default: 10): Files per batch

Example:

json
{
  "instanceId": "main",
  "owner": "username",
  "repository": "my-repo",
  "files": [
    {
      "path": "README.md",
      "content": "# My Project\n\nProject description here."
    },
    {
      "path": "src/index.js", 
      "content": "console.log('Hello, World!');"
    }
  ],
  "message": "Initial commit",
  "branch": "main",
  "batchSize": 5
}

sync_project ⚠️ Initial Commits Only

Automatically discover and sync an entire project directory to a Gitea repository while respecting .gitignore rules.

Important: This tool is designed for initial project uploads and can only create new files. It cannot update files that already exist in the repository. For updating existing files, use the sync_update tool instead.

Parameters:

  • instanceId (string, required): Gitea instance identifier
  • owner (string, required): Repository owner username
  • repository (string, required): Repository name
  • message (string, required): Commit message for the sync
  • branch (string, default: "main"): Target branch
  • projectPath (string, default: "."): Path to project directory to sync
  • dryRun (boolean, default: false): Preview what would be uploaded without actually uploading
  • includeHidden (boolean, default: false): Include hidden files (starting with .)
  • maxFileSize (number, default: 1048576): Maximum file size in bytes (1MB)
  • textOnly (boolean, default: true): Only upload text files (skip binary files)

Features:

  • Automatically reads and applies .gitignore rules
  • Includes sensible defaults for common ignore patterns (node_modules/, .git/, etc.)
  • Recursively scans project directory for eligible files
  • Simple heuristic to detect and optionally skip binary files
  • Size filtering for large files
  • Dry run mode for previewing changes
  • Detailed reporting of discovered, filtered, uploaded, and failed files

Use Cases:

  • Initial project setup and first commit
  • Uploading new projects to empty repositories
  • Bulk upload of files to new repositories

Example:

json
{
  "instanceId": "main",
  "owner": "username",
  "repository": "my-project",
  "message": "Initial project sync",
  "branch": "main",
  "projectPath": "./my-app",
  "dryRun": false,
  "includeHidden": false,
  "maxFileSize": 2097152,
  "textOnly": true
}

sync_update ✨ Advanced File Updates

Advanced tool for updating existing files in Gitea repository with intelligent conflict resolution and change detection.

Parameters:

  • instanceId (string, required): Gitea instance identifier
  • owner (string, required): Repository owner username
  • repository (string, required): Repository name
  • files (array, required): Array of file operation objects
  • files[].path (string, required): File path in repository (forward slashes)
  • files[].content (string, conditional): File content (required for add/modify operations)
  • files[].operation (string, required): Operation type: 'add', 'modify', or 'delete'
  • files[].sha (string, optional): Current file SHA (auto-detected if not provided)
  • message (string, required): Commit message for all operations
  • branch (string, default: "main"): Target branch
  • strategy (string, default: "auto"): Update strategy: 'auto', 'batch', or 'individual'
  • conflictResolution (string, default: "fail"): Conflict handling: 'fail', 'overwrite', or 'skip'
  • detectChanges (boolean, default: true): Compare with remote files to avoid unnecessary updates
  • dryRun (boolean, default: false): Preview operations without making changes

Key Features:

  • Smart API Usage: Uses PUT for updates, POST for creates, DELETE for removals
  • Change Detection: Compares local vs remote content to skip unnecessary updates
  • Auto SHA Resolution: Automatically fetches required SHA values for update operations
  • Multiple Strategies: Auto, batch (single commit), or individual (separate commits)
  • Conflict Resolution: Handles cases where remote files have changed since last sync
  • Mixed Operations: Can handle create, update, and delete operations in a single call
  • Dry Run Mode: Preview what operations would be performed without making changes

Operation Types:

  • add: Create new files (equivalent to POST API)
  • modify: Update existing files (uses PUT API with SHA for conflict resolution)
  • delete: Remove existing files (uses DELETE API with SHA)

Strategy Options:

  • auto: Intelligently chooses the best approach based on file count and operation types
  • batch: Performs all operations in a single commit using Gitea's batch API
  • individual: Performs each operation as a separate commit

Use Cases:

  • Updating existing project files
  • Selective file modifications
  • Bulk file operations (create, update, delete)
  • Incremental project updates
  • Automated file maintenance

Example:

json
{
  "instanceId": "main",
  "owner": "username",
  "repository": "my-project",
  "files": [
    {
      "path": "README.md",
      "content": "# Updated Project\n\nThis is an updated version of the project.",
      "operation": "modify"
    },
    {
      "path": "src/new-feature.js",
      "content": "// New feature implementation\nfunction newFeature() {\n  return 'Hello, World!';\n}",
      "operation": "add"
    },
    {
      "path": "old-file.txt",
      "operation": "delete"
    }
  ],
  "message": "Update documentation and add new feature",
  "branch": "main",
  "strategy": "auto",
  "detectChanges": true,
  "dryRun": false
}

Dry Run Example Response:

json
{
  "dryRun": true,
  "strategy": "individual",
  "summary": {
    "discovered": 3,
    "analyzed": 3,
    "needsUpdate": 2,
    "processed": 0,
    "succeeded": 0,
    "failed": 0,
    "skipped": 0
  },
  "filesNeedingUpdate": [
    {
      "path": "README.md",
      "operation": "modify",
      "hasRemoteSha": true
    },
    {
      "path": "src/new-feature.js",
      "operation": "add",
      "hasRemoteSha": false
    }
  ]
}

Tool Selection Guide

When to use each tool:

  1. create_repository: Create new repositories
  2. sync_project: Initial project upload to empty/new repositories
  3. upload_files: Upload specific files with full control over the process
  4. sync_update: Update existing files, create new files, or delete files in existing repositories

Workflow Example:

bash
# 1. Create a new repository
create_repository → "my-new-project"

# 2. Initial upload of all project files
sync_project → Upload entire project structure

# 3. Later updates to specific files
sync_update → Modify README.md, add new features, delete old files

Development

Scripts

  • npm run build - Build for production
  • npm run dev - Development with hot reloading
  • npm start - Start production server
  • npm test - Run tests
  • npm run lint - Lint code
  • npm run format - Format code
  • npm run type-check - TypeScript type checking

Project Structure

gitea-mcp/
├── src/
│   ├── index.ts              # Main server entry point
│   ├── config/               # Configuration management
│   ├── gitea/                # Gitea API client
│   ├── tools/                # MCP tool implementations
│   ├── services/             # Business logic services
│   ├── utils/                # Utilities (logging, errors, etc.)
│   └── types/                # TypeScript type definitions
├── build/                    # Compiled JavaScript
├── docs/                     # Documentation
└── package.json

Adding New Tools

  1. Create tool implementation in src/tools/
  2. Add schema validation in src/tools/schemas.ts
  3. Register tool in src/tools/index.ts
  4. Add tests in tests/unit/tools/

Deployment

Docker

Build and run with Docker:

bash
# Build image
docker build -t gitea-mcp .

# Run container
docker run -d \
  --name gitea-mcp \
  --env-file .env \
  gitea-mcp

Production Considerations

  • Use environment variables or secrets management for tokens
  • Configure appropriate log levels
  • Set up monitoring and health checks
  • Use process managers like PM2 for Node.js applications
  • Consider using Docker or Kubernetes for orchestration

Security

Best Practices

  • Store tokens securely using environment variables or secrets management
  • Use minimal required permissions for access tokens
  • Validate all input parameters
  • Log security events without exposing sensitive data
  • Use HTTPS for all Gitea API communications
  • Regularly rotate access tokens

Rate Limiting

The server implements rate limiting per Gitea instance to respect API limits:

  • Default: 100 requests per minute per instance
  • Configurable via rateLimit in instance configuration
  • Automatic retry with exponential backoff

Troubleshooting

Common Issues

Authentication Failed

  • Verify access token is correct and has required permissions
  • Check token hasn't expired
  • Ensure base URL is correct

Rate Limited

  • Reduce batch size for file uploads
  • Adjust rate limit configuration
  • Wait before retrying requests

File Upload Failures

  • Check file content is valid
  • Verify file paths don't contain illegal characters
  • Ensure repository exists and you have write permissions

Logging

Enable debug logging for troubleshooting:

bash
LOG_LEVEL=debug npm start

Health Checks

Check server status:

bash
curl -f http://localhost:8080/health || exit 1

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make changes with tests
  4. Run linting and type checking
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

  • GitHub Issues: Report bugs and feature requests
  • Documentation: Check docs/ directory
  • Examples: See examples/ directory

Built with ❤️ for the Gitea and MCP communities.

See Also

Χρησιμοποιήστε το MCP Gitea MCP Server με πολλά μοντέλα AI

Το TypingMind συνδέει τα εργαλεία MCP σε επίπεδο χώρου εργασίας. Έτσι, μόλις συνδεθεί το Gitea MCP Server, μπορείτε να το χρησιμοποιείτε με διαφορετικά μοντέλα AI στο TypingMind, αντί να το ρυθμίζετε ξεχωριστά για κάθε μοντέλο. Αυτή η ενσωμάτωση MCP εκτελείται τοπικά στη συσκευή σας μέσω του συνδέσμου MCP του TypingMind.

Οδηγός ρύθμισης για τη χρήση του τοπικού συνδέσμου

Επιλέξτε αυτή τη μέθοδο όταν ο διακομιστής MCP χρειάζεται πρόσβαση σε τοπικά αρχεία, εφαρμογές ή ιδιωτικούς πόρους στον υπολογιστή σας.

1

Ανοίξτε τις ρυθμίσεις MCP

Στο TypingMind, μεταβείτε στις «Ρυθμίσεις», έπειτα στις «Σύνθετες ρυθμίσεις» και στο «Model Context Protocol» και επιλέξτε «Ρύθμιση συνδέσμου».

  1. Ανοίξτε το TypingMind στο πρόγραμμα περιήγησής σας.
  2. Κάντε κλικ στο εικονίδιο «Ρυθμίσεις».
  3. Μεταβείτε στις «Σύνθετες ρυθμίσεις».
  4. Ανοίξτε την ενότητα Model Context Protocol.
  5. Κάντε κλικ στην επιλογή «Ρύθμιση συνδέσμου» και επιλέξτε «Αυτή η συσκευή».
Οθόνη ρύθμισης συνδέσμου MCP του TypingMind με επιλεγμένη την επιλογή «Αυτή η συσκευή»
2

Εκτελέστε την εντολή του συνδέσμου

Επιλέξτε «Αυτή η συσκευή», αντιγράψτε την εντολή από το TypingMind και εκτελέστε την στο Τερματικό. Διατηρήστε τη διεργασία σε λειτουργία όσο χρησιμοποιείτε το MCP.

  1. Αντιγράψτε την εντολή ρύθμισης που εμφανίζεται στο TypingMind.
  2. Ανοίξτε το Τερματικό στο macOS ή το Windows Terminal στα Windows.
  3. Επικολλήστε και εκτελέστε την εντολή.
  4. Εγκρίνετε την εγκατάσταση του πακέτου, αν το Τερματικό σάς ζητήσει επιβεβαίωση για να συνεχίσει.
  5. Διατηρήστε ανοιχτό το παράθυρο του Τερματικού και τη διεργασία σε λειτουργία όσο χρησιμοποιείτε εργαλεία MCP.
3

Προσθέστε το Gitea MCP Server ως διακομιστή

Όταν η κατάσταση του συνδέσμου είναι «Έτοιμος», κάντε κλικ στο «Αλλαγή servers» και επικολλήστε τις ρυθμίσεις του διακομιστή MCP.

  1. Περιμένετε μέχρι η κατάσταση του συνδέσμου να εμφανιστεί ως «Έτοιμος».
  2. Κάντε κλικ στο «Αλλαγή servers».
  3. Επικολλήστε τις ρυθμίσεις του διακομιστή MCP Gitea MCP Server.
  4. Αποθηκεύστε τη λίστα διακομιστών.
  5. Κάντε ανανέωση αν θέλετε να επιβεβαιώσετε ότι ο σύνδεσμος παραμένει έτοιμος για χρήση.
Ρυθμίσεις MCP του TypingMind με ενεργό διακομιστή και το κουμπί «Αλλαγή servers»
{
  "mcpServers": {
    "gitea-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Χρησιμοποιήστε τη σύνδεση με διαφορετικά μοντέλα

Αποθηκεύστε τη λίστα διακομιστών, ανοίξτε τα «Πρόσθετα», ενεργοποιήστε τα εργαλεία MCP του Gitea MCP Server και έπειτα επιλέξτε οποιοδήποτε υποστηριζόμενο μοντέλο AI στο TypingMind. Χρησιμοποιήστε τα εργαλεία στη συνομιλία ή αναθέστε τα σε έναν πράκτορα AI.

  1. Ανοίξτε τη σελίδα «Πρόσθετα» στο TypingMind.
  2. Ενεργοποιήστε τα εργαλεία MCP του Gitea MCP Server.
  3. Ξεκινήστε μια συνομιλία και επιλέξτε το μοντέλο AI που θέλετε να χρησιμοποιήσετε.
  4. Χρησιμοποιήστε τα εργαλεία MCP στη συνομιλία ή αντιστοιχίστε τα σε έναν πράκτορα AI.
  5. Μεταβείτε σε άλλο μοντέλο AI όποτε χρειάζεται, χωρίς να συνδέσετε ξανά το MCP.
Συνομιλία στο TypingMind με ενεργοποιημένα εργαλεία MCP και επιλεγμένο μοντέλο AI
Θα με βοηθήσετε σε αυτό μέσω Gitea MCP Server;
Gitea MCP Server
Βεβαίως. Το διάβασα.
Δείτε τι βρήκα μέσω του Gitea MCP Server.

Συχνές ερωτήσεις

Σε τι χρησιμεύει ο διακομιστής MCP Gitea MCP Server;

Το Gitea MCP Server είναι ένας διακομιστής MCP που επιτρέπει σε συμβατές εφαρμογές AI να συνδέονται με εξωτερικά εργαλεία και πληροφορίες πλαισίου. Στο TypingMind, μπορείτε να προσθέσετε αυτόν τον διακομιστή MCP μία φορά και να κάνετε τα εργαλεία του διαθέσιμα στον χώρο εργασίας AI σας.

Μπορώ να χρησιμοποιήσω το Gitea MCP Server MCP με πολλά μοντέλα AI στο TypingMind;

Ναι. Το TypingMind συνδέει τα εργαλεία MCP σε επίπεδο χώρου εργασίας, ώστε να μπορείτε να χρησιμοποιείτε το Gitea MCP Server με διαφορετικά μοντέλα AI, όπως τα Claude, ChatGPT, Gemini ή άλλα μοντέλα που έχετε ρυθμίσει στο TypingMind, χωρίς να ρυθμίζετε τον διακομιστή MCP ξεχωριστά για κάθε μοντέλο.

Γιατί να χρησιμοποιήσετε τον σύνδεσμο MCP Gitea MCP Server με το TypingMind;

Το TypingMind είναι ένα από τα καλύτερα περιβάλλοντα συνομιλίας με μεγάλα γλωσσικά μοντέλα, καθώς συγκεντρώνει πολλά μοντέλα AI, προτροπές, πρόσθετα, πράκτορες AI, κλειδιά API και εργαλεία MCP σε έναν χώρο εργασίας. Συνδέοντας το Gitea MCP Server, μπορείτε να χρησιμοποιείτε τα εργαλεία MCP του με τα μοντέλα που προτιμάτε, διατηρώντας οργανωμένη τη ροή εργασίας των συνομιλιών σας στο TypingMind.

Πώς συνδέω το Gitea MCP Server MCP στο TypingMind;

Το Gitea MCP Server λειτουργεί μέσω του τοπικού συνδέσμου MCP του TypingMind. Αυτή είναι η καλύτερη επιλογή όταν ο διακομιστής MCP χρειάζεται πρόσβαση σε τοπικά αρχεία, εφαρμογές υπολογιστή, εργαλεία γραμμής εντολών ή ιδιωτικούς πόρους στον υπολογιστή σας.

Ποια εργαλεία παρέχει το Gitea MCP Server MCP στο TypingMind;

Το Gitea MCP Server διαθέτει δυνατότητες MCP που μπορείτε να ενεργοποιήσετε από τη σελίδα Πρόσθετα του TypingMind και να χρησιμοποιήσετε σε συνομιλίες ή να αναθέσετε σε πράκτορες AI.

Χρειάζεται να κοινοποιήσω τα κλειδιά API μου στο TypingMind για να χρησιμοποιήσω το Gitea MCP Server MCP;

Όχι. Το TypingMind δίνει προτεραιότητα στην τοπική λειτουργία και σας επιτρέπει να διατηρείτε τον έλεγχο των παρόχων μοντέλων, των κλειδιών API, των προτροπών και των ρυθμίσεων MCP σας. Αν το Gitea MCP Server απαιτεί έλεγχο ταυτότητας, προσθέστε τις απαιτούμενες κεφαλίδες, τις ρυθμίσεις OAuth ή τις τοπικές ρυθμίσεις για τον συγκεκριμένο διακομιστή MCP κατά τη δημιουργία της σύνδεσης.

Σχετικοί διακομιστές MCP

Προβολή όλων

Στήστε δικό σας χώρο εργασίας AI τώρα

Εγγραφείτε στο ενημερωτικό μας δελτίο για να ενημερώνεστε για νέες λειτουργίες και μελλοντικές κληρώσεις δώρων 👇