feat: add HTTP server mode with updated docs and localization (#45) All checks were successful release-nightly / release-image (push) Successful in 3m4s
All checks were successful
release-nightly / release-image (push) Successful in 3m4s
- Update download instructions for clarity and consistency in all README files - Add example configuration for HTTP mode to all README files - Expand transport type support to include "http" in command-line flags and documentation - Implement HTTP server mode in the application entrypoint - Update log output behavior to include "http" mode alongside "sse" for stdout logging - Refine Chinese README translations for greater accuracy and localization Signed-off-by: appleboy <appleboy.tw@gmail.com> Reviewed-on: #45 Co-authored-by: appleboy <appleboy.tw@gmail.com> Co-committed-by: appleboy <appleboy.tw@gmail.com>
This commit was merged in pull request #45.
This commit is contained in:
86 README.md
86
README.md @@ -59,7 +59,7 @@ Optionally, you can add it to a file called `.vscode/mcp.json` in your workspace | ||||
| ||||
### 📥 Download the official binary release | ||||
| ||||
You can download the official release from [here](https://gitea.com/gitea/gitea-mcp/releases). | ||||
You can download the official release from [official Gitea MCP binary releases](https://gitea.com/gitea/gitea-mcp/releases). | ||||
| ||||
### 🔧 Build from Source | ||||
| ||||
@@ -129,6 +129,18 @@ To configure the MCP server for Gitea, add the following to your MCP configurati | ||||
} | ||||
``` | ||||
| ||||
- **http mode** | ||||
| ||||
```json | ||||
{ | ||||
"mcpServers": { | ||||
"gitea": { | ||||
"url": "http://localhost:8080/mcp" | ||||
} | ||||
} | ||||
} | ||||
``` | ||||
| ||||
**Default log path**: `$HOME/.gitea-mcp/gitea-mcp.log` | ||||
| ||||
> [!NOTE] | ||||
@@ -145,42 +157,42 @@ list all my repositories | ||||
| ||||
The Gitea MCP Server supports the following tools: | ||||
| ||||
| Tool | Scope | Description | | ||||
| :--------------------------: | :----------: | :---------------------------------------------------: | | ||||
| get_my_user_info | User | Get the information of the authenticated user | | ||||
| get_user_orgs | User | Get organizations associated with the authenticated user | | ||||
| create_repo | Repository | Create a new repository | | ||||
| fork_repo | Repository | Fork a repository | | ||||
| list_my_repos | Repository | List all repositories owned by the authenticated user | | ||||
| create_branch | Branch | Create a new branch | | ||||
| delete_branch | Branch | Delete a branch | | ||||
| list_branches | Branch | List all branches in a repository | | ||||
| create_release | Release | Create a new release in a repository | | ||||
| delete_release | Release | Delete a release from a repository | | ||||
| get_release | Release | Get a release | | ||||
| get_latest_release | Release | Get the latest release in a repository | | ||||
| list_releases | Release | List all releases in a repository | | ||||
| create_tag | Tag | Create a new tag | | ||||
| delete_tag | Tag | Delete a tag | | ||||
| get_tag | Tag | Get a tag | | ||||
| list_tags | Tag | List all tags in a repository | | ||||
| list_repo_commits | Commit | List all commits in a repository | | ||||
| get_file_content | File | Get the content and metadata of a file | | ||||
| create_file | File | Create a new file | | ||||
| update_file | File | Update an existing file | | ||||
| delete_file | File | Delete a file | | ||||
| get_issue_by_index | Issue | Get an issue by its index | | ||||
| list_repo_issues | Issue | List all issues in a repository | | ||||
| create_issue | Issue | Create a new issue | | ||||
| create_issue_comment | Issue | Create a comment on an issue | | ||||
| edit_issue | Issue | Edit a issue | | ||||
| get_pull_request_by_index | Pull Request | Get a pull request by its index | | ||||
| list_repo_pull_requests | Pull Request | List all pull requests in a repository | | ||||
| create_pull_request | Pull Request | Create a new pull request | | ||||
| search_users | User | Search for users | | ||||
| search_org_teams | Organization | Search for teams in an organization | | ||||
| search_repos | Repository | Search for repositories | | ||||
| get_gitea_mcp_server_version | Server | Get the version of the Gitea MCP Server | | ||||
| Tool | Scope | Description | | ||||
| :--------------------------: | :----------: | :------------------------------------------------------: | | ||||
| get_my_user_info | User | Get the information of the authenticated user | | ||||
| get_user_orgs | User | Get organizations associated with the authenticated user | | ||||
| create_repo | Repository | Create a new repository | | ||||
| fork_repo | Repository | Fork a repository | | ||||
| list_my_repos | Repository | List all repositories owned by the authenticated user | | ||||
| create_branch | Branch | Create a new branch | | ||||
| delete_branch | Branch | Delete a branch | | ||||
| list_branches | Branch | List all branches in a repository | | ||||
| create_release | Release | Create a new release in a repository | | ||||
| delete_release | Release | Delete a release from a repository | | ||||
| get_release | Release | Get a release | | ||||
| get_latest_release | Release | Get the latest release in a repository | | ||||
| list_releases | Release | List all releases in a repository | | ||||
| create_tag | Tag | Create a new tag | | ||||
| delete_tag | Tag | Delete a tag | | ||||
| get_tag | Tag | Get a tag | | ||||
| list_tags | Tag | List all tags in a repository | | ||||
| list_repo_commits | Commit | List all commits in a repository | | ||||
| get_file_content | File | Get the content and metadata of a file | | ||||
| create_file | File | Create a new file | | ||||
| update_file | File | Update an existing file | | ||||
| delete_file | File | Delete a file | | ||||
| get_issue_by_index | Issue | Get an issue by its index | | ||||
| list_repo_issues | Issue | List all issues in a repository | | ||||
| create_issue | Issue | Create a new issue | | ||||
| create_issue_comment | Issue | Create a comment on an issue | | ||||
| edit_issue | Issue | Edit a issue | | ||||
| get_pull_request_by_index | Pull Request | Get a pull request by its index | | ||||
| list_repo_pull_requests | Pull Request | List all pull requests in a repository | | ||||
| create_pull_request | Pull Request | Create a new pull request | | ||||
| search_users | User | Search for users | | ||||
| search_org_teams | Organization | Search for teams in an organization | | ||||
| search_repos | Repository | Search for repositories | | ||||
| get_gitea_mcp_server_version | Server | Get the version of the Gitea MCP Server | | ||||
| ||||
## 🐛 Debugging | ||||
| ||||
|
@@ -57,9 +57,9 @@ Model Context Protocol (MCP) 是一种协议,允许通过聊天界面整合各 | ||||
} | ||||
``` | ||||
| ||||
### 📥 下载官方二进制版本 | ||||
### 📥 下载官方 Gitea MCP 二进制版本 | ||||
| ||||
您可以从[这里](https://gitea.com/gitea/gitea-mcp/releases)下载官方版本。 | ||||
您可以从[官方 Gitea MCP 二进制版本](https://gitea.com/gitea/gitea-mcp/releases)下载官方版本。 | ||||
| ||||
### 🔧 从源代码构建 | ||||
| ||||
@@ -129,6 +129,18 @@ cp gitea-mcp /usr/local/bin/ | ||||
} | ||||
``` | ||||
| ||||
- **http 模式** | ||||
| ||||
```json | ||||
{ | ||||
"mcpServers": { | ||||
"gitea": { | ||||
"url": "http://localhost:8080/mcp" | ||||
} | ||||
} | ||||
} | ||||
``` | ||||
| ||||
**默认日志路径**: `$HOME/.gitea-mcp/gitea-mcp.log` | ||||
| ||||
> [!注意] | ||||
@@ -180,7 +192,7 @@ Gitea MCP 服务器支持以下工具: | ||||
| search_users | 用户 | 搜索用户 | | ||||
| search_org_teams | 组织 | 搜索组织中的团队 | | ||||
| search_repos | 仓库 | 搜索仓库 | | ||||
| get_gitea_mcp_server_version | 服务器 | 获取 Gitea MCP 服务器的版本 | | ||||
| get_gitea_mcp_server_version | 服务器 | 获取 Gitea MCP 服务器的版本 | | ||||
| ||||
## 🐛 调试 | ||||
| ||||
|
@@ -57,9 +57,9 @@ Model Context Protocol (MCP) 是一種協議,允許通過聊天界面整合各 | ||||
} | ||||
``` | ||||
| ||||
### 📥 下載官方二進制版本 | ||||
### 📥 下載官方 Gitea MCP 二進位版本 | ||||
| ||||
您可以從[這裡](https://gitea.com/gitea/gitea-mcp/releases)下載官方版本。 | ||||
您可以從[官方 Gitea MCP 二進位版本](https://gitea.com/gitea/gitea-mcp/releases)下載官方版本。 | ||||
| ||||
### 🔧 從源代碼構建 | ||||
| ||||
@@ -129,11 +129,23 @@ cp gitea-mcp /usr/local/bin/ | ||||
} | ||||
``` | ||||
| ||||
**默認日誌路徑**: `$HOME/.gitea-mcp/gitea-mcp.log` | ||||
- **http 模式** | ||||
| ||||
```json | ||||
{ | ||||
"mcpServers": { | ||||
"gitea": { | ||||
"url": "http://localhost:8080/mcp" | ||||
} | ||||
} | ||||
} | ||||
``` | ||||
| ||||
**預設日誌路徑**: `$HOME/.gitea-mcp/gitea-mcp.log` | ||||
| ||||
> [!注意] | ||||
> 您可以通過命令行參數或環境變量提供您的 Gitea 主機和訪問令牌。 | ||||
> 命令行參數具有最高優先級 | ||||
> 您可以通過命令列參數或環境變數提供您的 Gitea 主機和訪問令牌。 | ||||
> 命令列參數具有最高優先權 | ||||
| ||||
一切設置完成後,請嘗試在您的 MCP 兼容聊天框中輸入以下內容: | ||||
| ||||
@@ -180,11 +192,11 @@ Gitea MCP 伺服器支持以下工具: | ||||
| search_users | 用戶 | 搜索用戶 | | ||||
| search_org_teams | 組織 | 搜索組織中的團隊 | | ||||
| search_repos | 倉庫 | 搜索倉庫 | | ||||
| get_gitea_mcp_server_version | 伺服器 | 獲取 Gitea MCP 伺服器的版本 | | ||||
| get_gitea_mcp_server_version | 伺服器 | 獲取 Gitea MCP 伺服器的版本 | | ||||
| ||||
## 🐛 調試 | ||||
| ||||
要啟用調試模式,請在使用 sse 模式運行 Gitea MCP 伺服器時添加 `-d` 標誌: | ||||
要啟用調試模式,請在使用 sse 模式運行 Gitea MCP 伺服器時添加 `-d` 旗標: | ||||
| ||||
```sh | ||||
./gitea-mcp -t sse [--port 8080] --token <your personal access token> -d | ||||
|
@@ -21,13 +21,13 @@ func init() { | ||||
&flagPkg.Mode, | ||||
"t", | ||||
"stdio", | ||||
"Transport type (stdio or sse)", | ||||
"Transport type (stdio, sse or http)", | ||||
) | ||||
flag.StringVar( | ||||
&flagPkg.Mode, | ||||
"transport", | ||||
"stdio", | ||||
"Transport type (stdio or sse)", | ||||
"Transport type (stdio, sse or http)", | ||||
) | ||||
flag.StringVar( | ||||
&host, | ||||
@@ -39,7 +39,7 @@ func init() { | ||||
&port, | ||||
"port", | ||||
8080, | ||||
"sse port", | ||||
"see or http port", | ||||
) | ||||
flag.StringVar( | ||||
&token, | ||||
|
@@ -15,9 +15,7 @@ import ( | ||||
"github.com/mark3labs/mcp-go/server" | ||||
) | ||||
| ||||
var ( | ||||
mcpServer *server.MCPServer | ||||
) | ||||
var mcpServer *server.MCPServer | ||||
| ||||
func RegisterTool(s *server.MCPServer) { | ||||
// User Tool | ||||
@@ -55,8 +53,14 @@ func Run() error { | ||||
if err := sseServer.Start(fmt.Sprintf(":%d", flag.Port)); err != nil { | ||||
return err | ||||
} | ||||
case "http": | ||||
httpServer := server.NewStreamableHTTPServer(mcpServer) | ||||
log.Infof("Gitea MCP HTTP server listening on :%d", flag.Port) | ||||
if err := httpServer.Start(fmt.Sprintf(":%d", flag.Port)); err != nil { | ||||
return err | ||||
} | ||||
default: | ||||
return fmt.Errorf("invalid transport type: %s. Must be 'stdio' or 'sse'", flag.Mode) | ||||
return fmt.Errorf("invalid transport type: %s. Must be 'stdio', 'sse' or 'http'", flag.Mode) | ||||
} | ||||
return nil | ||||
} | ||||
|
@@ -39,7 +39,7 @@ func Default() *zap.Logger { | ||||
MaxAge: 30, | ||||
})) | ||||
| ||||
if flag.Mode == "sse" { | ||||
if flag.Mode == "http" || flag.Mode == "sse" { | ||||
wss = append(wss, zapcore.AddSync(os.Stdout)) | ||||
} | ||||
| ||||
|
Reference in New Issue
Block a user