Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,19 @@ The following sets of tools are available (all are on by default):

<summary>Projects</summary>

- **add_project_item** - Add project item
- `item_id`: The numeric ID of the issue or pull request to add to the project. (number, required)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

item_id here means pr id below specifically something else, would this benefit from a new distinct name, or below (not the issue or pull request ID).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can mean either an issue id or a pr id, depending on the item type

- `item_type`: The item's type, either issue or pull_request. (string, required)
- `owner`: If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive. (string, required)
- `owner_type`: Owner type (string, required)
- `project_number`: The project's number. (number, required)

- **delete_project_item** - Delete project item
- `item_id`: The internal project item ID to delete from the project (not the issue or pull request ID). (number, required)
- `owner`: If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive. (string, required)
- `owner_type`: Owner type (string, required)
- `project_number`: The project's number. (number, required)

- **get_project** - Get project
- `owner`: If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive. (string, required)
- `owner_type`: Owner type (string, required)
Expand Down Expand Up @@ -694,6 +707,13 @@ The following sets of tools are available (all are on by default):
- `per_page`: Number of results per page (max 100, default: 30) (number, optional)
- `query`: Filter projects by a search query (matches title and description) (string, optional)

- **update_project_item** - Update project item
- `fields`: A list of field updates to apply. (array, required)
- `item_id`: The numeric ID of the project item to update (not the issue or pull request ID). (number, required)
- `owner`: If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive. (string, required)
- `owner_type`: Owner type (string, required)
- `project_number`: The project's number. (number, required)

</details>

<details>
Expand Down
4 changes: 2 additions & 2 deletions internal/ghmcp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ func NewMCPServer(cfg MCPServerConfig) (*server.MCPServer, error) {

// Generate instructions based on enabled toolsets
instructions := github.GenerateInstructions(enabledToolsets)
ghServer := github.NewServer(cfg.Version,

ghServer := github.NewServer(cfg.Version,
server.WithInstructions(instructions),
server.WithHooks(hooks),
)
Expand Down
48 changes: 48 additions & 0 deletions pkg/github/__toolsnaps__/add_project_item.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"annotations": {
"title": "Add project item",
"readOnlyHint": false
},
"description": "Add a specific Project item for a user or org",
"inputSchema": {
"properties": {
"item_id": {
"description": "The numeric ID of the issue or pull request to add to the project.",
"type": "number"
},
"item_type": {
"description": "The item's type, either issue or pull_request.",
"enum": [
"issue",
"pull_request"
],
"type": "string"
},
"owner": {
"description": "If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive.",
"type": "string"
},
"owner_type": {
"description": "Owner type",
"enum": [
"user",
"org"
],
"type": "string"
},
"project_number": {
"description": "The project's number.",
"type": "number"
}
},
"required": [
"owner_type",
"owner",
"project_number",
"item_type",
"item_id"
],
"type": "object"
},
"name": "add_project_item"
}
39 changes: 39 additions & 0 deletions pkg/github/__toolsnaps__/delete_project_item.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"annotations": {
"title": "Delete project item",
"readOnlyHint": false
},
"description": "Delete a specific Project item for a user or org",
"inputSchema": {
"properties": {
"item_id": {
"description": "The internal project item ID to delete from the project (not the issue or pull request ID).",
"type": "number"
},
"owner": {
"description": "If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive.",
"type": "string"
},
"owner_type": {
"description": "Owner type",
"enum": [
"user",
"org"
],
"type": "string"
},
"project_number": {
"description": "The project's number.",
"type": "number"
}
},
"required": [
"owner_type",
"owner",
"project_number",
"item_id"
],
"type": "object"
},
"name": "delete_project_item"
}
44 changes: 44 additions & 0 deletions pkg/github/__toolsnaps__/update_project_item.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"annotations": {
"title": "Update project item",
"readOnlyHint": false
},
"description": "Update a specific Project item for a user or org",
"inputSchema": {
"properties": {
"fields": {
"description": "A list of field updates to apply.",
"type": "array"
},
"item_id": {
"description": "The numeric ID of the project item to update (not the issue or pull request ID).",
"type": "number"
},
"owner": {
"description": "If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive.",
"type": "string"
},
"owner_type": {
"description": "Owner type",
"enum": [
"user",
"org"
],
"type": "string"
},
"project_number": {
"description": "The project's number.",
"type": "number"
}
},
"required": [
"owner_type",
"owner",
"project_number",
"item_id",
"fields"
],
"type": "object"
},
"name": "update_project_item"
}
11 changes: 5 additions & 6 deletions pkg/github/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ func GenerateInstructions(enabledToolsets []string) string {
if os.Getenv("DISABLE_INSTRUCTIONS") == "true" {
return "" // Baseline mode
}

var instructions []string

// Core instruction - always included if context toolset enabled
if slices.Contains(enabledToolsets, "context") {
instructions = append(instructions, "Always call 'get_me' first to understand current user permissions and context.")
}

// Individual toolset instructions
for _, toolset := range enabledToolsets {
if inst := getToolsetInstructions(toolset); inst != "" {
instructions = append(instructions, inst)
}
}

// Base instruction with context management
baseInstruction := `The GitHub MCP Server provides tools to interact with GitHub platform.

Expand All @@ -40,7 +40,7 @@ Context management:

allInstructions := []string{baseInstruction}
allInstructions = append(allInstructions, instructions...)

return strings.Join(allInstructions, " ")
}

Expand All @@ -57,4 +57,3 @@ func getToolsetInstructions(toolset string) string {
return ""
}
}

2 changes: 1 addition & 1 deletion pkg/github/instructions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ func TestGetToolsetInstructions(t *testing.T) {
}
})
}
}
}
Loading
Loading