2025-01-06 22:34:57 +00:00
|
|
|
# Gitea MCP Server
|
2025-01-06 22:33:00 +00:00
|
|
|
|
2025-01-06 22:34:57 +00:00
|
|
|
An MCP server that provides tools for interacting with the Gitea API.
|
2025-01-06 22:33:00 +00:00
|
|
|
|
2025-01-06 22:34:57 +00:00
|
|
|
## Setup
|
2025-01-06 22:33:00 +00:00
|
|
|
|
2025-01-06 22:34:57 +00:00
|
|
|
1. Clone the repository
|
|
|
|
2. Install dependencies:
|
|
|
|
```bash
|
|
|
|
npm install
|
|
|
|
```
|
|
|
|
3. Copy the example environment file:
|
|
|
|
```bash
|
|
|
|
cp .env.example .env
|
|
|
|
```
|
|
|
|
4. Configure your environment variables in `.env`:
|
|
|
|
- `GITEA_API_URL`: Your Gitea API URL (e.g., https://gitea.example.com/api/v1)
|
|
|
|
- `GITEA_TOKEN`: Your Gitea API token
|
2025-01-06 22:33:00 +00:00
|
|
|
|
2025-01-06 22:34:57 +00:00
|
|
|
## Building
|
2025-01-06 22:33:00 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
npm run build
|
|
|
|
```
|
|
|
|
|
2025-01-06 22:34:57 +00:00
|
|
|
## Available Tools
|
2025-01-06 22:33:00 +00:00
|
|
|
|
2025-01-06 22:34:57 +00:00
|
|
|
- `list_repositories`: List repositories for the authenticated user
|
|
|
|
- `get_repository`: Get details about a specific repository
|
|
|
|
- `list_issues`: List issues in a repository
|
|
|
|
- `create_issue`: Create a new issue in a repository
|
|
|
|
- `list_pull_requests`: List pull requests in a repository
|
|
|
|
- `create_repository`: Create a new repository
|
|
|
|
- `get_contents`: Get contents of a file or directory in a repository
|
|
|
|
- `add_file_to_repo`: Add a new file to a repository
|
|
|
|
- `create_branch`: Create a new branch in a repository
|
2025-01-06 22:33:00 +00:00
|
|
|
|
2025-01-06 22:34:57 +00:00
|
|
|
## Tool Usage Examples
|
2025-01-06 22:33:00 +00:00
|
|
|
|
2025-01-06 22:34:57 +00:00
|
|
|
### Adding a File to a Repository
|
2025-01-06 22:33:00 +00:00
|
|
|
|
2025-01-06 22:34:57 +00:00
|
|
|
```typescript
|
2025-01-06 22:33:00 +00:00
|
|
|
{
|
2025-01-06 22:34:57 +00:00
|
|
|
"owner": "username",
|
|
|
|
"repo": "repository-name",
|
|
|
|
"path": "path/to/file.txt",
|
|
|
|
"content": "File content here", // or use file_text
|
|
|
|
"message": "Commit message",
|
|
|
|
"branch": "main" // optional
|
2025-01-06 22:33:00 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2025-01-06 22:34:57 +00:00
|
|
|
### Creating a Repository
|
2025-01-06 22:33:00 +00:00
|
|
|
|
2025-01-06 22:34:57 +00:00
|
|
|
```typescript
|
|
|
|
{
|
|
|
|
"name": "repository-name",
|
|
|
|
"description": "Repository description",
|
|
|
|
"private": false,
|
|
|
|
"autoInit": true
|
|
|
|
}
|
2025-01-06 22:33:00 +00:00
|
|
|
```
|
|
|
|
|
2025-01-06 22:34:57 +00:00
|
|
|
## Error Handling
|
|
|
|
|
|
|
|
The server will throw appropriate errors if:
|
|
|
|
- Required environment variables are missing
|
|
|
|
- API requests fail
|
|
|
|
- Invalid parameters are provided
|
|
|
|
- Tool names are incorrect
|