|
|
9 月之前 | |
|---|---|---|
| docs-api @ 9740f402bd | 9 月之前 | |
| src | 9 月之前 | |
| .dockerignore | 9 月之前 | |
| .env.example | 9 月之前 | |
| .gitignore | 9 月之前 | |
| .gitmodules | 9 月之前 | |
| .mcp-gogs.json | 9 月之前 | |
| CHANGELOG_LABELS.md | 9 月之前 | |
| CLAUDE.md | 9 月之前 | |
| Dockerfile | 9 月之前 | |
| LABEL_IMPLEMENTATION_SUMMARY.md | 9 月之前 | |
| LICENSE | 9 月之前 | |
| README.md | 9 月之前 | |
| SERVICE.md | 9 月之前 | |
| USAGE_EXAMPLES.md | 9 月之前 | |
| docker-compose.yml | 9 月之前 | |
| gogs-mcp-server.service | 9 月之前 | |
| install-service.sh | 9 月之前 | |
| package-lock.json | 9 月之前 | |
| package.json | 9 月之前 | |
| tsconfig.json | 9 月之前 | |
| uninstall-service.sh | 9 月之前 |
A Model Context Protocol (MCP) server that provides access to Gogs git hosting APIs. This server enables AI assistants like Claude to interact with Gogs repositories, users, and other resources.
This MCP server provides tools to:
User Management
Repository Management
Content Access
Issue Management
Label Management
OR
Clone this repository:
git clone ssh://git@207.154.220.231:10022/claude/gogs-mcp.git
cd gogs-mcp
Install dependencies:
npm install
Build the project:
npm run build
Clone this repository:
git clone ssh://git@207.154.220.231:10022/claude/gogs-mcp.git
cd gogs-mcp
Create a .env file from the example:
cp .env.example .env
Edit .env and configure your Gogs server URL and access token:
GOGS_SERVER_URL=https://your-gogs-server.com
GOGS_ACCESS_TOKEN=your-access-token-here
Build and run with Docker Compose:
docker-compose up -d
Or build the Docker image manually:
docker build -t gogs-mcp-server .
docker run --env-file .env gogs-mcp-server
Create a .env file or set environment variables:
GOGS_SERVER_URL=https://your-gogs-server.com
GOGS_ACCESS_TOKEN=your-access-token-here
# Transport mode (optional, default: stdio)
TRANSPORT_MODE=stdio # or 'http' for HTTP/SSE transport
# HTTP server configuration (only used when TRANSPORT_MODE=http)
HTTP_PORT=3000
HTTP_HOST=0.0.0.0
The access token is optional but recommended. Without it:
The server supports two transport modes:
stdio (default): For use with MCP clients like Claude Desktop
http: For HTTP-based access with Server-Sent Events (SSE)
Add the server to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"gogs": {
"command": "node",
"args": ["/absolute/path/to/gogs-mcp-server/dist/index.js"],
"env": {
"GOGS_SERVER_URL": "https://your-gogs-server.com",
"GOGS_ACCESS_TOKEN": "your-access-token-here",
"TRANSPORT_MODE": "stdio"
}
}
}
}
To run the server in HTTP mode for web applications:
Set the transport mode to HTTP in your .env file:
TRANSPORT_MODE=http
HTTP_PORT=3000
HTTP_HOST=0.0.0.0
Start the server:
npm start
The server will be available at:
http://localhost:3000/ssehttp://localhost:3000/messagehttp://localhost:3000/healthConnect your MCP client to the SSE endpoint to establish a persistent connection.
# Set environment variables in .env
TRANSPORT_MODE=http
HTTP_PORT=3000
# Run with docker-compose
docker-compose up -d
# Or run with Docker directly
docker run -p 3000:3000 \
-e GOGS_SERVER_URL=https://your-gogs-server.com \
-e GOGS_ACCESS_TOKEN=your-access-token-here \
-e TRANSPORT_MODE=http \
-e HTTP_PORT=3000 \
gogs-mcp-server:latest
The server uses stdio transport and can be integrated with any MCP-compatible client:
# Set environment variables
export GOGS_SERVER_URL=https://your-gogs-server.com
export GOGS_ACCESS_TOKEN=your-access-token-here
export TRANSPORT_MODE=stdio
# Run the server
npm start
You can use the Docker image with MCP clients by mounting it as a command:
{
"mcpServers": {
"gogs": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e", "GOGS_SERVER_URL=https://your-gogs-server.com",
"-e", "GOGS_ACCESS_TOKEN=your-access-token-here",
"gogs-mcp-server:latest"
]
}
}
}
Or using docker-compose:
{
"mcpServers": {
"gogs": {
"command": "docker-compose",
"args": [
"-f", "/absolute/path/to/gogs-mcp-server/docker-compose.yml",
"run",
"--rm",
"gogs-mcp-server"
]
}
}
}
get_current_userGet information about the authenticated user.
get_userGet information about a specific user.
username (string, required): Username to look upsearch_usersSearch for users by username.
query (string, required): Search querylimit (number, optional): Maximum results (default: 10)list_user_repositoriesList repositories for a user.
username (string, optional): Username (omit for authenticated user)search_repositoriesSearch for repositories.
query (string, required): Search queryuid (number, optional): User ID to filter bylimit (number, optional): Maximum results (default: 10)page (number, optional): Page number (default: 1)get_repositoryGet information about a specific repository.
owner (string, required): Repository owner usernamerepo (string, required): Repository namecreate_repositoryCreate a new repository.
name (string, required): Repository namedescription (string, optional): Repository descriptionprivate (boolean, optional): Create as private (default: false)auto_init (boolean, optional): Initialize with README (default: false)gitignores (string, optional): Gitignore templates (e.g., "Go,VisualStudioCode")license (string, optional): License template (e.g., "MIT License")readme (string, optional): README template (default: "Default")delete_repositoryDelete a repository (requires admin access).
owner (string, required): Repository owner usernamerepo (string, required): Repository nameget_contentsGet file or directory contents from a repository.
owner (string, required): Repository owner usernamerepo (string, required): Repository namepath (string, required): File or directory pathref (string, optional): Branch, tag, or commit SHA (default: default branch)get_raw_contentGet raw file content from a repository.
owner (string, required): Repository owner usernamerepo (string, required): Repository nameref (string, required): Branch, tag, or commit SHApath (string, required): File pathlist_branchesList all branches in a repository.
owner (string, required): Repository owner usernamerepo (string, required): Repository nameget_commitsGet commit history from a repository.
owner (string, required): Repository owner usernamerepo (string, required): Repository namesha (string, optional): Branch name or commit SHApage (number, optional): Page number (default: 1)list_issuesList issues in a repository.
owner (string, required): Repository owner usernamerepo (string, required): Repository namestate (string, optional): Filter by state - 'open', 'closed', or 'all' (default: 'open')labels (string, optional): Comma-separated list of label namespage (number, optional): Page number (default: 1)per_page (number, optional): Results per page (default: 30)get_issueGet a specific issue by number.
owner (string, required): Repository owner usernamerepo (string, required): Repository namenumber (number, required): Issue numbercreate_issueCreate a new issue in a repository.
owner (string, required): Repository owner usernamerepo (string, required): Repository nametitle (string, required): Issue titlebody (string, optional): Issue descriptionassignee (string, optional): Username to assign the issue tomilestone (number, optional): Milestone IDlabels (array of numbers, optional): Array of label IDsupdate_issueUpdate an existing issue (including closing or reopening).
owner (string, required): Repository owner usernamerepo (string, required): Repository namenumber (number, required): Issue numbertitle (string, optional): Issue titlebody (string, optional): Issue descriptionassignee (string, optional): Username to assign the issue tomilestone (number, optional): Milestone IDstate (string, optional): Issue state - 'open' or 'closed'labels (array of numbers, optional): Array of label IDslist_issue_commentsList all comments on an issue.
owner (string, required): Repository owner usernamerepo (string, required): Repository namenumber (number, required): Issue numbercreate_issue_commentAdd a comment to an issue.
owner (string, required): Repository owner usernamerepo (string, required): Repository namenumber (number, required): Issue numberbody (string, required): Comment textupdate_issue_commentEdit an existing comment on an issue.
owner (string, required): Repository owner usernamerepo (string, required): Repository namecommentId (number, required): Comment IDbody (string, required): Updated comment textlist_labelsList all labels in a repository.
owner (string, required): Repository owner usernamerepo (string, required): Repository nameget_labelGet a specific label by ID.
owner (string, required): Repository owner usernamerepo (string, required): Repository namelabelId (number, required): Label IDcreate_labelCreate a new label in a repository.
owner (string, required): Repository owner usernamerepo (string, required): Repository namename (string, required): Label namecolor (string, required): 7-character hex color code with leading # (e.g., #ff0000)update_labelUpdate an existing label.
owner (string, required): Repository owner usernamerepo (string, required): Repository namelabelId (number, required): Label IDname (string, optional): Label namecolor (string, optional): 7-character hex color code with leading # (e.g., #ff0000)delete_labelDelete a label from a repository.
owner (string, required): Repository owner usernamerepo (string, required): Repository namelabelId (number, required): Label IDlist_issue_labelsList all labels on a specific issue.
owner (string, required): Repository owner usernamerepo (string, required): Repository namenumber (number, required): Issue numberadd_issue_labelsAdd labels to an issue.
owner (string, required): Repository owner usernamerepo (string, required): Repository namenumber (number, required): Issue numberlabels (array of numbers, required): Array of label IDs to addremove_issue_labelRemove a specific label from an issue.
owner (string, required): Repository owner usernamerepo (string, required): Repository namenumber (number, required): Issue numberlabelId (number, required): Label ID to removereplace_issue_labelsReplace all labels on an issue with a new set.
owner (string, required): Repository owner usernamerepo (string, required): Repository namenumber (number, required): Issue numberlabels (array of numbers, required): Array of label IDs to set (replaces all existing labels)remove_all_issue_labelsRemove all labels from an issue.
owner (string, required): Repository owner usernamerepo (string, required): Repository namenumber (number, required): Issue numbernpm run dev
npm run build
npm run watch
The Gogs API documentation is included in the docs-api submodule. For more information about the Gogs REST API, see:
docs-api/README.mdMake sure you've set the GOGS_SERVER_URL environment variable or included it in your MCP client configuration.
This can indicate:
MIT
Contributions are welcome! Please feel free to submit a Pull Request.