What the GitHub MCP server can do
GitHub’s official MCP server exposes dozens of tools across toolsets for issues, pull requests, repository contents, Actions and more. Connected with a personal access token, an agent can read code and issues, but also create and merge pull requests, push files, delete files and trigger workflows. Whatever the token can do, the agent can do.
GitHub gives you two coarse controls: a read-only mode (the /readonly URL or --read-only flag) and toolsets to switch whole groups of tools on or off. That’s a good start, but it’s all or nothing. You can’t say “create issues, but only in this repository” or “comment, but never merge”.
The risks
- The token is in the agent’s environment. Anything the agent can read can end up in its context, logs or the code it writes.
- Write tools are all-or-nothing. An agent that can open a pull request can usually merge one, and one that can update a file can push to any branch the token reaches.
- Prompt injection comes through GitHub itself. Issues, comments and READMEs are text written by other people. An agent that reads a malicious issue can be told to call any tool it has.
A Stashbase profile for the GitHub MCP server
This profile lets the agent read issues, pull requests and code anywhere the token can, create issues and comments only in acme/widget, and nothing else:
# .stashbase/agents/github.toml
egress_hosts = ["api.anthropic.com", "api.githubcopilot.com"]
[secrets]
project = "my-app"
environment = "agents"
[secrets.GITHUB_TOKEN]
[[secrets.GITHUB_TOKEN.rules]]
effect = "allow"
hosts = ["api.githubcopilot.com"]
methods = ["GET", "POST"]
paths = ["/mcp/*"]
[mcp_servers.github]
url = "https://api.githubcopilot.com/mcp/"
binding = "GITHUB_TOKEN"
allow_tools = [
"issue_read", "list_issues", "search_issues",
"pull_request_read", "list_pull_requests",
"get_file_contents",
]
# Create issues only in acme/widget, with only a title, body and labels.
[[mcp_servers.github.tool_rules]]
effect = "allow"
tools = ["issue_write"]
arguments = { owner = ["acme"], repo = ["widget"], method = ["create"] }
allow_fields = ["title", "body", "labels"]
# Comment only in acme/widget.
[[mcp_servers.github.tool_rules]]
effect = "allow"
tools = ["add_issue_comment"]
arguments = { owner = ["acme"], repo = ["widget"] }
Then connect it and run the agent:
claude mcp add github -- stashbase agent mcp connect github
stashbase agent run --profile github -- claude
Whose GitHub account does the agent use?
| Agent’s own identity | Your identity | |
|---|---|---|
| Profile section | [secrets.GITHUB_TOKEN] | [personal_credentials.GITHUB_TOKEN] |
| GitHub account | A bot or machine account | Your own account |
| Owned by | The workspace, in a Stashbase environment | Your Stashbase account, private to you |
| Issues and comments show up as | The bot | You |
| Proxy | Local or remote | Remote |
| Use it when | The agent works for the team | The agent works on your behalf |
Give the agent its own identity. The profile above uses a Stashbase secret: a token for a bot or machine account, kept in a Stashbase environment. Everyone on the team who runs the profile gets the same access, and issues and comments show up as the bot. It’s the right choice when the agent works for the team.
Let the agent act as you. When the agent should use your own GitHub account and your own repository access, use a personal credential instead. It’s private to your Stashbase account, the CLI never fetches, prints or logs it, and the remote Agent Proxy adds it only to requests your rules allow. Swap the secret binding for a personal one:
[personal_credentials.GITHUB_TOKEN]
env = "GITHUB_TOKEN"
[[personal_credentials.GITHUB_TOKEN.rules]]
effect = "allow"
hosts = ["api.githubcopilot.com"]
methods = ["GET", "POST"]
paths = ["/mcp/*"]
The [mcp_servers.github] section stays the same, with binding = "GITHUB_TOKEN". Personal credentials need the remote proxy, so start the agent with --remote:
stashbase agent run --remote --profile github -- claude
Teammates can share the same profile file: each of them runs it with their own GitHub token, and nobody’s token is shared.
What the agent can and can’t do
| Action | Result |
|---|---|
| Read issues, pull requests and files | Allowed |
Create an issue in acme/widget with a title and body | Allowed |
| Create an issue in another repository | Blocked |
| Set assignees or a milestone on a new issue | Blocked, field not allowed |
| Edit an existing issue | Blocked, only create is allowed |
| Merge a pull request, push or delete files | Not visible to the agent |
| Read the GitHub token | Never: it only holds a placeholder, for its own token or yours |
Blocked calls return an error that names the argument, like arguments.repo, and show up in the audit log, so you can see what the agent tried and allow it with one rule if it was legitimate.
Check your profile
Tool names change as GitHub updates the server. List what the server exposes and test a call before you rely on a rule:
stashbase agent mcp tools --profile github --server github
stashbase agent mcp check --profile github --server github --tool merge_pull_request
The same approach works for any MCP server. See the MCP docs for argument conditions such as numeric ranges and absent fields, and Claude Code’s sandbox vs Stashbase for how this differs from Claude Code’s own MCP permissions.