mirror of
https://gitea.com/gitea/gitea-mcp.git
synced 2025-10-13 09:31:50 +00:00
refactor: remove SSE transport support from code and documentation (#97)
- Remove support and documentation for sse mode across all language README files - Update CLI flags and help text to exclude references to sse mode - Remove SSE server initialization in operation logic - Adjust error messages to only mention stdio and http transport types - Update logging setup to remove sse mode conditional logging See the latest documentation: https://modelcontextprotocol.io/specification/2025-06-18/basic/transports Signed-off-by: appleboy <appleboy.tw@gmail.com> Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/97 Co-authored-by: appleboy <appleboy.tw@gmail.com> Co-committed-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
19
README.md
19
README.md
@@ -133,21 +133,6 @@ To configure the MCP server for Gitea, add the following to your MCP configurati
|
||||
}
|
||||
```
|
||||
|
||||
- **sse mode**
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"gitea": {
|
||||
"url": "http://localhost:8080/sse",
|
||||
"headers": {
|
||||
"Authorization": "Bearer <your personal access token>"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- **http mode**
|
||||
|
||||
```json
|
||||
@@ -227,10 +212,10 @@ The Gitea MCP Server supports the following tools:
|
||||
|
||||
## 🐛 Debugging
|
||||
|
||||
To enable debug mode, add the `-d` flag when running the Gitea MCP Server with sse mode:
|
||||
To enable debug mode, add the `-d` flag when running the Gitea MCP Server with http mode:
|
||||
|
||||
```sh
|
||||
./gitea-mcp -t sse [--port 8080] --token <your personal access token> -d
|
||||
./gitea-mcp -t http [--port 8080] --token <your personal access token> -d
|
||||
```
|
||||
|
||||
## 🛠 Troubleshooting
|
||||
|
@@ -133,21 +133,6 @@ cp gitea-mcp /usr/local/bin/
|
||||
}
|
||||
```
|
||||
|
||||
- **sse 模式**
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"gitea": {
|
||||
"url": "http://localhost:8080/sse",
|
||||
"headers": {
|
||||
"Authorization": "Bearer <your personal access token>"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- **http 模式**
|
||||
|
||||
```json
|
||||
@@ -221,10 +206,10 @@ Gitea MCP 服务器支持以下工具:
|
||||
|
||||
## 🐛 调试
|
||||
|
||||
要启用调试模式,请在使用 sse 模式运行 Gitea MCP 服务器时添加 `-d` 标志:
|
||||
要启用调试模式,请在使用 http 模式运行 Gitea MCP 服务器时添加 `-d` 标志:
|
||||
|
||||
```sh
|
||||
./gitea-mcp -t sse [--port 8080] --token <your personal access token> -d
|
||||
./gitea-mcp -t http [--port 8080] --token <your personal access token> -d
|
||||
```
|
||||
|
||||
## 🛠 疑难排解
|
||||
|
@@ -133,21 +133,6 @@ cp gitea-mcp /usr/local/bin/
|
||||
}
|
||||
```
|
||||
|
||||
- **sse 模式**
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"gitea": {
|
||||
"url": "http://localhost:8080/sse",
|
||||
"headers": {
|
||||
"Authorization": "Bearer <your personal access token>"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- **http 模式**
|
||||
|
||||
```json
|
||||
@@ -221,10 +206,10 @@ Gitea MCP 伺服器支持以下工具:
|
||||
|
||||
## 🐛 調試
|
||||
|
||||
要啟用調試模式,請在使用 sse 模式運行 Gitea MCP 伺服器時添加 `-d` 旗標:
|
||||
要啟用調試模式,請在使用 http 模式運行 Gitea MCP 伺服器時添加 `-d` 旗標:
|
||||
|
||||
```sh
|
||||
./gitea-mcp -t sse [--port 8080] --token <your personal access token> -d
|
||||
./gitea-mcp -t http [--port 8080] --token <your personal access token> -d
|
||||
```
|
||||
|
||||
## 🛠 疑難排解
|
||||
|
@@ -21,13 +21,13 @@ func init() {
|
||||
&flagPkg.Mode,
|
||||
"t",
|
||||
"stdio",
|
||||
"Transport type (stdio, sse or http)",
|
||||
"Transport type (stdio or http)",
|
||||
)
|
||||
flag.StringVar(
|
||||
&flagPkg.Mode,
|
||||
"transport",
|
||||
"stdio",
|
||||
"Transport type (stdio, sse or http)",
|
||||
"Transport type (stdio or http)",
|
||||
)
|
||||
flag.StringVar(
|
||||
&host,
|
||||
@@ -39,7 +39,7 @@ func init() {
|
||||
&port,
|
||||
"port",
|
||||
8080,
|
||||
"see or http port",
|
||||
"http port",
|
||||
)
|
||||
flag.StringVar(
|
||||
&token,
|
||||
|
@@ -59,12 +59,12 @@ func parseBearerToken(authHeader string) (string, bool) {
|
||||
if len(authHeader) < len(bearerPrefix) || !strings.HasPrefix(authHeader, bearerPrefix) {
|
||||
return "", false
|
||||
}
|
||||
|
||||
|
||||
token := strings.TrimSpace(authHeader[len(bearerPrefix):])
|
||||
if token == "" {
|
||||
return "", false
|
||||
}
|
||||
|
||||
|
||||
return token, true
|
||||
}
|
||||
|
||||
@@ -92,15 +92,6 @@ func Run() error {
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
case "sse":
|
||||
sseServer := server.NewSSEServer(
|
||||
mcpServer,
|
||||
server.WithSSEContextFunc(getContextWithToken),
|
||||
)
|
||||
log.Infof("Gitea MCP SSE server listening on :%d", flag.Port)
|
||||
if err := sseServer.Start(fmt.Sprintf(":%d", flag.Port)); err != nil {
|
||||
return err
|
||||
}
|
||||
case "http":
|
||||
httpServer := server.NewStreamableHTTPServer(
|
||||
mcpServer,
|
||||
@@ -113,7 +104,7 @@ func Run() error {
|
||||
return err
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("invalid transport type: %s. Must be 'stdio', 'sse' or 'http'", flag.Mode)
|
||||
return fmt.Errorf("invalid transport type: %s. Must be 'stdio' or 'http'", flag.Mode)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -127,3 +118,4 @@ func newMCPServer(version string) *server.MCPServer {
|
||||
server.WithRecovery(),
|
||||
)
|
||||
}
|
||||
|
||||
|
@@ -48,7 +48,7 @@ func Default() *zap.Logger {
|
||||
MaxAge: 30,
|
||||
}))
|
||||
|
||||
if flag.Mode == "http" || flag.Mode == "sse" {
|
||||
if flag.Mode == "http" {
|
||||
wss = append(wss, zapcore.AddSync(os.Stdout))
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user