@mokoconsulting/mcp-mokogitea-api 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mokogitea/workflows/auto-bump.yml +9 -9
- package/.mokogitea/workflows/auto-release.yml +90 -28
- package/.mokogitea/workflows/branch-cleanup.yml +1 -1
- package/.mokogitea/workflows/ci-generic.yml +0 -13
- package/.mokogitea/workflows/gitleaks.yml +0 -4
- package/.mokogitea/workflows/npm-publish.yml +69 -10
- package/.mokogitea/workflows/pr-check.yml +26 -0
- package/.mokogitea/workflows/pre-release.yml +244 -3
- package/.mokogitea/workflows/rc-revert.yml +66 -0
- package/.mokogitea/workflows/repo-health.yml +4 -3
- package/.mokogitea/workflows/workflow-sync-trigger.yml +73 -0
- package/dist/client.js +20 -1
- package/dist/index.js +10 -2
- package/package.json +1 -1
- package/src/client.ts +15 -1
- package/src/index.ts +10 -2
- package/.mokogitea/manifest.xml +0 -25
- package/Dockerfile +0 -18
- package/dist/server.d.ts +0 -4
- package/dist/server.js +0 -12
- package/dist/sse.d.ts +0 -2
- package/dist/sse.js +0 -87
- package/src/server.ts +0 -16
- package/src/sse.ts +0 -100
- package/wiki/ARCHITECTURE.md +0 -144
- package/wiki/Home.md +0 -35
- package/wiki/INSTALLATION.md +0 -170
package/wiki/ARCHITECTURE.md
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
← [Home](Home)
|
|
2
|
-
|
|
3
|
-
# Architecture
|
|
4
|
-
|
|
5
|
-
## Component Overview
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
src/
|
|
9
|
-
index.ts -- MCP server entry point, tool registrations (61 tools)
|
|
10
|
-
client.ts -- HTTP client for Gitea REST API v1
|
|
11
|
-
config.ts -- Configuration loader (multi-connection support)
|
|
12
|
-
types.ts -- TypeScript type definitions
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### index.ts -- Server Entry Point
|
|
16
|
-
|
|
17
|
-
The main module that:
|
|
18
|
-
|
|
19
|
-
- Creates the `McpServer` instance with stdio transport
|
|
20
|
-
- Loads configuration on startup via `loadConfig()`
|
|
21
|
-
- Registers all 61 tools organized by category
|
|
22
|
-
- Provides shared parameter schemas (`OwnerRepo`, `PaginationParams`, `ConnectionParam`)
|
|
23
|
-
- Routes tool calls through `clientFor(connection)` to resolve the target Gitea instance
|
|
24
|
-
- Formats all API responses through `formatResponse()` for consistent MCP output
|
|
25
|
-
|
|
26
|
-
### client.ts -- HTTP Client
|
|
27
|
-
|
|
28
|
-
`GiteaClient` is a zero-dependency HTTP client built on `node:https` and `node:http`:
|
|
29
|
-
|
|
30
|
-
- Prepends `/api/v1` to all endpoint paths
|
|
31
|
-
- Sets `Authorization: token <token>` header on every request (Gitea's native auth format)
|
|
32
|
-
- Supports `GET`, `POST`, `PUT`, `PATCH`, `DELETE` methods
|
|
33
|
-
- Handles query parameter construction via `URL.searchParams`
|
|
34
|
-
- Parses JSON responses automatically
|
|
35
|
-
- 30-second request timeout
|
|
36
|
-
- Optional TLS certificate verification bypass (`insecure` flag)
|
|
37
|
-
|
|
38
|
-
### config.ts -- Configuration Loader
|
|
39
|
-
|
|
40
|
-
Loads the connection configuration from disk:
|
|
41
|
-
|
|
42
|
-
- Default path: `~/.gitea-api-mcp.json`
|
|
43
|
-
- Override via `GITEA_API_MCP_CONFIG` environment variable
|
|
44
|
-
- Validates that at least one connection exists
|
|
45
|
-
- Sets `defaultConnection` to the first connection if not explicitly specified
|
|
46
|
-
- `getConnection()` resolves a named connection or falls back to the default
|
|
47
|
-
|
|
48
|
-
### types.ts -- Type Definitions
|
|
49
|
-
|
|
50
|
-
Three core interfaces:
|
|
51
|
-
|
|
52
|
-
- `GiteaConnection` -- Single connection config (`baseUrl`, `token`, `insecure?`)
|
|
53
|
-
- `GiteaConfig` -- Full config with named connections map and default
|
|
54
|
-
- `ApiResponse` -- Standardized response wrapper (`status`, `data`)
|
|
55
|
-
|
|
56
|
-
## Design Decisions
|
|
57
|
-
|
|
58
|
-
### Token Authentication
|
|
59
|
-
|
|
60
|
-
Gitea uses `Authorization: token <access-token>` as its native authentication header format, unlike GitHub's `Bearer` token format. This server uses the native Gitea format directly, ensuring compatibility with all Gitea versions without requiring OAuth2 setup.
|
|
61
|
-
|
|
62
|
-
### Multi-Connection Architecture
|
|
63
|
-
|
|
64
|
-
Every tool accepts an optional `connection` parameter. This enables:
|
|
65
|
-
|
|
66
|
-
- Managing multiple Gitea instances from a single MCP server
|
|
67
|
-
- Switching between production, staging, and development instances
|
|
68
|
-
- Cross-instance operations within a single Claude Code session
|
|
69
|
-
|
|
70
|
-
The connection is resolved at call time, not at startup, so different tool calls can target different instances.
|
|
71
|
-
|
|
72
|
-
### node:https (Zero HTTP Dependencies)
|
|
73
|
-
|
|
74
|
-
The HTTP client uses Node.js built-in `node:https` and `node:http` modules instead of third-party libraries (e.g., axios, node-fetch). This decision:
|
|
75
|
-
|
|
76
|
-
- Eliminates supply-chain risk from HTTP client dependencies
|
|
77
|
-
- Reduces `node_modules` size
|
|
78
|
-
- Avoids compatibility issues across Node.js versions
|
|
79
|
-
- Provides full control over TLS configuration (needed for `insecure` flag)
|
|
80
|
-
|
|
81
|
-
### Stdio Transport
|
|
82
|
-
|
|
83
|
-
The MCP server uses stdio transport (stdin/stdout) rather than HTTP/SSE. This means:
|
|
84
|
-
|
|
85
|
-
- No network ports are opened by the server
|
|
86
|
-
- Tokens are never exposed through HTTP endpoints
|
|
87
|
-
- The server runs as a child process of the MCP client
|
|
88
|
-
- Communication is process-local, reducing attack surface
|
|
89
|
-
|
|
90
|
-
### Shared Parameter Objects
|
|
91
|
-
|
|
92
|
-
Common parameter patterns are defined as reusable objects:
|
|
93
|
-
|
|
94
|
-
- `OwnerRepo` -- `{ owner, repo }` for all repository-scoped operations
|
|
95
|
-
- `PaginationParams` -- `{ page, limit }` for all list endpoints
|
|
96
|
-
- `ConnectionParam` -- `{ connection }` for multi-connection routing
|
|
97
|
-
|
|
98
|
-
This ensures consistency across all 61 tools and simplifies adding new tools.
|
|
99
|
-
|
|
100
|
-
## Data Flow
|
|
101
|
-
|
|
102
|
-
```
|
|
103
|
-
+-----------------+
|
|
104
|
-
| Claude Code / |
|
|
105
|
-
| MCP Client |
|
|
106
|
-
+--------+--------+
|
|
107
|
-
|
|
|
108
|
-
stdio (JSON-RPC)
|
|
109
|
-
|
|
|
110
|
-
+--------v--------+
|
|
111
|
-
| index.ts |
|
|
112
|
-
| McpServer |
|
|
113
|
-
| (tool router) |
|
|
114
|
-
+--------+--------+
|
|
115
|
-
|
|
|
116
|
-
+-----------+-----------+
|
|
117
|
-
| |
|
|
118
|
-
+------v------+ +-------v-------+
|
|
119
|
-
| config.ts | | client.ts |
|
|
120
|
-
| loadConfig | | GiteaClient |
|
|
121
|
-
| getConn | | (HTTP calls) |
|
|
122
|
-
+------+------+ +-------+-------+
|
|
123
|
-
| |
|
|
124
|
-
+------v------+ HTTPS / HTTP
|
|
125
|
-
| ~/.gitea- | |
|
|
126
|
-
| api-mcp.json| +--------v--------+
|
|
127
|
-
+-------------+ | Gitea Instance |
|
|
128
|
-
| /api/v1/* |
|
|
129
|
-
+-----------------+
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
1. Claude Code sends a JSON-RPC tool call over stdio
|
|
133
|
-
2. `McpServer` routes the call to the registered tool handler
|
|
134
|
-
3. The handler calls `clientFor(connection)` which resolves the connection from config
|
|
135
|
-
4. `GiteaClient` constructs the HTTP request and sends it to the Gitea API
|
|
136
|
-
5. The JSON response is wrapped in `formatResponse()` and returned to the MCP client
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
*Repo: [gitea-api-mcp](https://git.mokoconsulting.tech/MokoConsulting/gitea-api-mcp) . [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/mokoplatform/wiki/Home)*
|
|
141
|
-
|
|
142
|
-
| Revision | Date | Author | Description |
|
|
143
|
-
|---|---|---|---|
|
|
144
|
-
| 1.0 | 2026-05-09 | Moko Consulting | Initial version |
|
package/wiki/Home.md
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# gitea-api-mcp
|
|
2
|
-
|
|
3
|
-
MCP server for Gitea REST API v1 operations — 61 tools for repos, issues, PRs, releases, branches, actions, orgs, wiki, webhooks, and more
|
|
4
|
-
|
|
5
|
-
| Field | Value |
|
|
6
|
-
|---|---|
|
|
7
|
-
| **Language** | Markdown |
|
|
8
|
-
| **License** | GPL-3.0-or-later |
|
|
9
|
-
| **Platform** | [Gitea](https://git.mokoconsulting.tech/MokoConsulting/gitea-api-mcp) |
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## Guides
|
|
14
|
-
|
|
15
|
-
| Page | Description |
|
|
16
|
-
|---|---|
|
|
17
|
-
| [INSTALLATION](INSTALLATION) | - **Node.js** >= 20.0.0 ([download](https://nodejs.org)) |
|
|
18
|
-
|
|
19
|
-
## Reference
|
|
20
|
-
|
|
21
|
-
| Page | Description |
|
|
22
|
-
|---|---|
|
|
23
|
-
| [ARCHITECTURE](ARCHITECTURE) | index.ts -- MCP server entry point, tool registrations (61 tools) |
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
> [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/mokoplatform/wiki/Home)
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
*Repo: [gitea-api-mcp](https://git.mokoconsulting.tech/MokoConsulting/gitea-api-mcp) . [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/mokoplatform/wiki/Home)*
|
|
32
|
-
|
|
33
|
-
| Revision | Date | Author | Description |
|
|
34
|
-
|---|---|---|---|
|
|
35
|
-
| 1.0 | 2026-05-09 | Moko Consulting | Initial version |
|
package/wiki/INSTALLATION.md
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
← [Home](Home)
|
|
2
|
-
|
|
3
|
-
# Installation Guide
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
- **Node.js** >= 20.0.0 ([download](https://nodejs.org))
|
|
8
|
-
- **npm** (included with Node.js)
|
|
9
|
-
- A **Gitea instance** with API access enabled
|
|
10
|
-
- A **Gitea access token** with appropriate scopes
|
|
11
|
-
|
|
12
|
-
## Install
|
|
13
|
-
|
|
14
|
-
### Clone and Build
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
git clone https://git.mokoconsulting.tech/MokoConsulting/gitea-api-mcp.git
|
|
18
|
-
cd gitea-api-mcp
|
|
19
|
-
npm install
|
|
20
|
-
npm run build
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
The compiled output is placed in `dist/index.js`.
|
|
24
|
-
|
|
25
|
-
### Verify the Build
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
node dist/index.js --help
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Gitea Token Generation
|
|
32
|
-
|
|
33
|
-
1. Log in to your Gitea instance (e.g., `https://git.mokoconsulting.tech`)
|
|
34
|
-
2. Navigate to **Settings** (click your avatar, top-right corner)
|
|
35
|
-
3. Select **Applications** from the sidebar
|
|
36
|
-
4. Under **Manage Access Tokens**, enter a descriptive token name (e.g., `mcp-server`)
|
|
37
|
-
5. Select the required permission scopes:
|
|
38
|
-
- `repo` -- for repository operations
|
|
39
|
-
- `admin:org` -- for organization management
|
|
40
|
-
- `notification` -- for notification tools
|
|
41
|
-
- `user` -- for user profile operations
|
|
42
|
-
- `issue` -- for issue and pull request tools
|
|
43
|
-
- `package` -- if using package-related endpoints
|
|
44
|
-
6. Click **Generate Token**
|
|
45
|
-
7. **Copy the token immediately** -- it will not be displayed again
|
|
46
|
-
|
|
47
|
-
## Configuration
|
|
48
|
-
|
|
49
|
-
### Config File Format
|
|
50
|
-
|
|
51
|
-
Create `~/.gitea-api-mcp.json`:
|
|
52
|
-
|
|
53
|
-
```json
|
|
54
|
-
{
|
|
55
|
-
"defaultConnection": "moko",
|
|
56
|
-
"connections": {
|
|
57
|
-
"moko": {
|
|
58
|
-
"baseUrl": "https://git.mokoconsulting.tech",
|
|
59
|
-
"token": "your-gitea-access-token",
|
|
60
|
-
"insecure": false
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Config Fields
|
|
67
|
-
|
|
68
|
-
| Field | Type | Required | Description |
|
|
69
|
-
|-------|------|----------|-------------|
|
|
70
|
-
| `defaultConnection` | string | No | Name of the default connection (defaults to the first one) |
|
|
71
|
-
| `connections` | object | Yes | Map of named connections |
|
|
72
|
-
| `connections.<name>.baseUrl` | string | Yes | Base URL of the Gitea instance (no trailing slash) |
|
|
73
|
-
| `connections.<name>.token` | string | Yes | Gitea API access token |
|
|
74
|
-
| `connections.<name>.insecure` | boolean | No | Skip TLS certificate verification (default: `false`) |
|
|
75
|
-
|
|
76
|
-
### Custom Config Path
|
|
77
|
-
|
|
78
|
-
Override the default config location with an environment variable:
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
export GITEA_API_MCP_CONFIG=/path/to/custom-config.json
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### File Permissions
|
|
85
|
-
|
|
86
|
-
Secure your config file since it contains API tokens:
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
chmod 600 ~/.gitea-api-mcp.json
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## Claude Code Registration
|
|
93
|
-
|
|
94
|
-
### Project-Level (`.mcp.json`)
|
|
95
|
-
|
|
96
|
-
Create or edit `.mcp.json` in your project root:
|
|
97
|
-
|
|
98
|
-
```json
|
|
99
|
-
{
|
|
100
|
-
"mcpServers": {
|
|
101
|
-
"gitea-moko": {
|
|
102
|
-
"command": "node",
|
|
103
|
-
"args": ["/absolute/path/to/gitea-api-mcp/dist/index.js"]
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Global-Level (`~/.claude/claude_desktop_config.json`)
|
|
110
|
-
|
|
111
|
-
```json
|
|
112
|
-
{
|
|
113
|
-
"mcpServers": {
|
|
114
|
-
"gitea-moko": {
|
|
115
|
-
"command": "node",
|
|
116
|
-
"args": ["/absolute/path/to/gitea-api-mcp/dist/index.js"]
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
After registering, restart Claude Code or run `/mcp` to verify the server is connected.
|
|
123
|
-
|
|
124
|
-
## Troubleshooting
|
|
125
|
-
|
|
126
|
-
### "Failed to load config" Error
|
|
127
|
-
|
|
128
|
-
- Verify `~/.gitea-api-mcp.json` exists and is valid JSON
|
|
129
|
-
- Check that at least one connection is defined in `connections`
|
|
130
|
-
- If using `GITEA_API_MCP_CONFIG`, verify the path is correct and the file is readable
|
|
131
|
-
|
|
132
|
-
### "Connection not found" Error
|
|
133
|
-
|
|
134
|
-
- The `connection` parameter you passed does not match any key in `connections`
|
|
135
|
-
- Run `gitea_list_connections` to see available connections
|
|
136
|
-
- Check for typos in the connection name
|
|
137
|
-
|
|
138
|
-
### Authentication Failures (HTTP 401)
|
|
139
|
-
|
|
140
|
-
- Verify your token is correct and has not expired
|
|
141
|
-
- Ensure the token has the required scopes for the operation
|
|
142
|
-
- Check that the `baseUrl` points to the correct Gitea instance
|
|
143
|
-
- Confirm the Gitea instance has API access enabled (admin setting)
|
|
144
|
-
|
|
145
|
-
### TLS / Certificate Errors
|
|
146
|
-
|
|
147
|
-
- For self-signed certificates, set `"insecure": true` in the connection config
|
|
148
|
-
- Ensure the Gitea instance URL uses the correct protocol (`https://` vs `http://`)
|
|
149
|
-
|
|
150
|
-
### Timeout Errors
|
|
151
|
-
|
|
152
|
-
- The default request timeout is 30 seconds
|
|
153
|
-
- Check network connectivity to the Gitea instance
|
|
154
|
-
- Verify the Gitea instance is running and responsive
|
|
155
|
-
- For large responses (e.g., recursive tree listings), consider pagination
|
|
156
|
-
|
|
157
|
-
### MCP Server Not Appearing in Claude Code
|
|
158
|
-
|
|
159
|
-
- Ensure the path in your MCP config is an absolute path to `dist/index.js`
|
|
160
|
-
- Verify the build completed successfully (`npm run build`)
|
|
161
|
-
- Check that Node.js >= 20.0.0 is in your PATH
|
|
162
|
-
- Restart Claude Code after modifying MCP configuration
|
|
163
|
-
|
|
164
|
-
---
|
|
165
|
-
|
|
166
|
-
*Repo: [gitea-api-mcp](https://git.mokoconsulting.tech/MokoConsulting/gitea-api-mcp) . [MokoStandards](https://git.mokoconsulting.tech/MokoConsulting/mokoplatform/wiki/Home)*
|
|
167
|
-
|
|
168
|
-
| Revision | Date | Author | Description |
|
|
169
|
-
|---|---|---|---|
|
|
170
|
-
| 1.0 | 2026-05-09 | Moko Consulting | Initial version |
|