gitea-mcp/README.md

71 lines
1.6 KiB
Markdown

# Gitea MCP Server
An MCP server that provides tools for interacting with the Gitea API.
## Setup
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
## Building
```bash
npm run build
```
## Available Tools
- `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
## Tool Usage Examples
### Adding a File to a Repository
```typescript
{
"owner": "username",
"repo": "repository-name",
"path": "path/to/file.txt",
"content": "File content here", // or use file_text
"message": "Commit message",
"branch": "main" // optional
}
```
### Creating a Repository
```typescript
{
"name": "repository-name",
"description": "Repository description",
"private": false,
"autoInit": true
}
```
## 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