Add support for Gogs User Public Keys functionality to the MCP server.
Why This Feature?
Public keys (SSH keys) are essential for secure authentication with Git repositories. Managing them through the API enables automated key provisioning and user onboarding workflows.
Requirements
Implement list_user_keys tool - List public keys for a specific user
Implement list_my_keys tool - List authenticated user's public keys
Implement get_public_key tool - Get details of a specific public key
Implement create_public_key tool - Add a new public key
Implement delete_public_key tool - Remove a public key
Add proper TypeScript types for PublicKey objects
Support key metadata (title, key content, fingerprint, creation date)
Update documentation with usage examples
API Endpoints to Implement
GET /users/:username/keys - List public keys for a user
See Gogs API documentation for user public keys endpoints.
## Description
Add support for Gogs User Public Keys functionality to the MCP server.
## Why This Feature?
Public keys (SSH keys) are essential for secure authentication with Git repositories. Managing them through the API enables automated key provisioning and user onboarding workflows.
## Requirements
- Implement `list_user_keys` tool - List public keys for a specific user
- Implement `list_my_keys` tool - List authenticated user's public keys
- Implement `get_public_key` tool - Get details of a specific public key
- Implement `create_public_key` tool - Add a new public key
- Implement `delete_public_key` tool - Remove a public key
- Add proper TypeScript types for PublicKey objects
- Support key metadata (title, key content, fingerprint, creation date)
- Update documentation with usage examples
## API Endpoints to Implement
- `GET /users/:username/keys` - List public keys for a user
- `GET /user/keys` - List your public keys
- `GET /user/keys/:id` - Get a single public key
- `POST /user/keys` - Create a public key
- `DELETE /user/keys/:id` - Delete a public key
## Related
Requested by @fszontagh in #4
## API Reference
See Gogs API documentation for user public keys endpoints.
@fszontagh I'm starting work on this issue now! I'll implement the User Public Keys support by:
Adding TypeScript types for PublicKey objects
Implementing the 5 required API methods in gogs-client.ts
Adding the 5 MCP tools in index.ts with proper Zod schemas
Testing the implementation
Updating README.md and CLAUDE.md documentation
I'll keep you updated on the progress!
@fszontagh I'm starting work on this issue now! I'll implement the User Public Keys support by:
1. Adding TypeScript types for PublicKey objects
2. Implementing the 5 required API methods in gogs-client.ts
3. Adding the 5 MCP tools in index.ts with proper Zod schemas
4. Testing the implementation
5. Updating README.md and CLAUDE.md documentation
I'll keep you updated on the progress!
listUserKeys(username) - List public keys for a specific user
listMyKeys() - List authenticated user's public keys
getPublicKey(keyId) - Get details of a specific public key
createPublicKey({ title, key }) - Add a new public key
deletePublicKey(keyId) - Remove a public key
3. MCP Tools (src/server.ts)
list_user_keys - List public SSH keys for a specific user
list_my_keys - List public SSH keys for the authenticated user
get_public_key - Get details of a specific public SSH key by ID
create_public_key - Create a new public SSH key
delete_public_key - Delete a public SSH key by ID
All tools include proper Zod schemas for validation and comprehensive descriptions.
4. Build Status
✅ TypeScript compilation successful - no errors!
Next steps: Testing the implementation and updating documentation.
✅ Implementation completed! I've successfully added User Public Keys support.
## Changes Made:
### 1. TypeScript Types (src/types.ts)
- Added `GogsPublicKey` interface with all required fields:
- id, title, key, url, created_at, read_only, fingerprint
### 2. API Client Methods (src/gogs-client.ts)
- `listUserKeys(username)` - List public keys for a specific user
- `listMyKeys()` - List authenticated user's public keys
- `getPublicKey(keyId)` - Get details of a specific public key
- `createPublicKey({ title, key })` - Add a new public key
- `deletePublicKey(keyId)` - Remove a public key
### 3. MCP Tools (src/server.ts)
- `list_user_keys` - List public SSH keys for a specific user
- `list_my_keys` - List public SSH keys for the authenticated user
- `get_public_key` - Get details of a specific public SSH key by ID
- `create_public_key` - Create a new public SSH key
- `delete_public_key` - Delete a public SSH key by ID
All tools include proper Zod schemas for validation and comprehensive descriptions.
### 4. Build Status
✅ TypeScript compilation successful - no errors!
Next steps: Testing the implementation and updating documentation.
I've successfully implemented full User Public Keys support for the Gogs MCP server.
Summary of Changes
✅ Code Implementation
types.ts: Added GogsPublicKey interface with all required fields
gogs-client.ts: Implemented 5 API client methods
server.ts: Added 5 MCP tools with Zod validation schemas
Build: All TypeScript compiles without errors
✅ Testing
Successfully tested against live Gogs API:
✅ GET /user/keys - List authenticated user's keys
✅ GET /users/:username/keys - List user's keys
✅ GET /user/keys/:id - Get key by ID
✅ Create and delete operations confirmed working
✅ Documentation
README.md:
Added "Public Key Management" to features list
Documented all 5 new tools with parameters and examples
Removed endpoints from "not yet implemented" table
CLAUDE.md: Updated MCP Tool Categories with Public Key Management
📦 Commit
Committed and pushed to main branch:
Commit: deebc5d
Message: feat: add User Public Keys support #12
Files changed: 5 files, +257 lines
Available MCP Tools
list_user_keys - List public SSH keys for a specific user
list_my_keys - List authenticated user's SSH keys
get_public_key - Get details of a specific key by ID
create_public_key - Create new SSH key
delete_public_key - Delete SSH key by ID
All requirements from the issue have been fulfilled! 🚀
🎉 **Implementation Complete!**
I've successfully implemented full User Public Keys support for the Gogs MCP server.
## Summary of Changes
### ✅ Code Implementation
- **types.ts**: Added `GogsPublicKey` interface with all required fields
- **gogs-client.ts**: Implemented 5 API client methods
- **server.ts**: Added 5 MCP tools with Zod validation schemas
- **Build**: All TypeScript compiles without errors
### ✅ Testing
Successfully tested against live Gogs API:
- ✅ `GET /user/keys` - List authenticated user's keys
- ✅ `GET /users/:username/keys` - List user's keys
- ✅ `GET /user/keys/:id` - Get key by ID
- ✅ Create and delete operations confirmed working
### ✅ Documentation
- **README.md**:
- Added "Public Key Management" to features list
- Documented all 5 new tools with parameters and examples
- Removed endpoints from "not yet implemented" table
- **CLAUDE.md**: Updated MCP Tool Categories with Public Key Management
### 📦 Commit
Committed and pushed to main branch:
- Commit: `deebc5d`
- Message: `feat: add User Public Keys support #12`
- Files changed: 5 files, +257 lines
## Available MCP Tools
1. **list_user_keys** - List public SSH keys for a specific user
2. **list_my_keys** - List authenticated user's SSH keys
3. **get_public_key** - Get details of a specific key by ID
4. **create_public_key** - Create new SSH key
5. **delete_public_key** - Delete SSH key by ID
All requirements from the issue have been fulfilled! 🚀
Description
Add support for Gogs User Public Keys functionality to the MCP server.
Why This Feature?
Public keys (SSH keys) are essential for secure authentication with Git repositories. Managing them through the API enables automated key provisioning and user onboarding workflows.
Requirements
list_user_keystool - List public keys for a specific userlist_my_keystool - List authenticated user's public keysget_public_keytool - Get details of a specific public keycreate_public_keytool - Add a new public keydelete_public_keytool - Remove a public keyAPI Endpoints to Implement
GET /users/:username/keys- List public keys for a userGET /user/keys- List your public keysGET /user/keys/:id- Get a single public keyPOST /user/keys- Create a public keyDELETE /user/keys/:id- Delete a public keyRelated
Requested by @fszontagh in #4
API Reference
See Gogs API documentation for user public keys endpoints.
@fszontagh I'm starting work on this issue now! I'll implement the User Public Keys support by:
I'll keep you updated on the progress!
✅ Implementation completed! I've successfully added User Public Keys support.
Changes Made:
1. TypeScript Types (src/types.ts)
GogsPublicKeyinterface with all required fields:2. API Client Methods (src/gogs-client.ts)
listUserKeys(username)- List public keys for a specific userlistMyKeys()- List authenticated user's public keysgetPublicKey(keyId)- Get details of a specific public keycreatePublicKey({ title, key })- Add a new public keydeletePublicKey(keyId)- Remove a public key3. MCP Tools (src/server.ts)
list_user_keys- List public SSH keys for a specific userlist_my_keys- List public SSH keys for the authenticated userget_public_key- Get details of a specific public SSH key by IDcreate_public_key- Create a new public SSH keydelete_public_key- Delete a public SSH key by IDAll tools include proper Zod schemas for validation and comprehensive descriptions.
4. Build Status
✅ TypeScript compilation successful - no errors!
Next steps: Testing the implementation and updating documentation.
🎉 Implementation Complete!
I've successfully implemented full User Public Keys support for the Gogs MCP server.
Summary of Changes
✅ Code Implementation
GogsPublicKeyinterface with all required fields✅ Testing
Successfully tested against live Gogs API:
GET /user/keys- List authenticated user's keysGET /users/:username/keys- List user's keysGET /user/keys/:id- Get key by ID✅ Documentation
📦 Commit
Committed and pushed to main branch:
deebc5dfeat: add User Public Keys support #12Available MCP Tools
All requirements from the issue have been fulfilled! 🚀