Skip to content

Commit 364fd42

Browse files
authored
Add MCP server example (#35)
* Add MCP server example * Update examples/mcp-server/README.md
1 parent d05435d commit 364fd42

File tree

6 files changed

+409
-8
lines changed

6 files changed

+409
-8
lines changed

.devcontainer/Dockerfile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@ RUN apt-get update && apt-get install -y \
55
libxkbcommon0 \
66
ca-certificates \
77
git \
8-
golang \
98
unzip \
109
libc++1 \
1110
vim \
11+
curl \
12+
procps \
1213
&& apt-get clean autoclean
1314

15+
RUN curl -OL https://go.dev/dl/go1.24.0.linux-amd64.tar.gz && \
16+
tar -C /usr/local -xzvf go1.24.0.linux-amd64.tar.gz && \
17+
rm go1.24.0.linux-amd64.tar.gz
18+
ENV PATH="$PATH:/usr/local/go/bin"
19+
1420
# Ensure UTF-8 encoding
1521
ENV LANG=C.UTF-8
1622
ENV LC_ALL=C.UTF-8
17-
18-
ENV GOPATH=/go
19-
ENV PATH=$GOPATH/bin:$PATH
20-
21-
WORKDIR /workspace
22-
23-
COPY . /workspace

examples/mcp-server/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mcp-server

examples/mcp-server/README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Gitpod MCP Server
2+
3+
A Model Control Protocol (MCP) server that provides access to Gitpod resources and operations through Claude.
4+
5+
## Features
6+
7+
- List Gitpod projects
8+
- List Gitpod environments
9+
- Create new environments
10+
- Stop environments
11+
- Execute commands in environments
12+
13+
## Claude Desktop Configuration
14+
15+
1. Create a file containing your Gitpod personal access token:
16+
```bash
17+
echo "your_api_key_here" > /tmp/gitpod-personal-access-token.txt
18+
```
19+
20+
2. Build the server:
21+
```bash
22+
go build -o /tmp/gitpod-mcp
23+
```
24+
25+
3. Add the following to your Claude Desktop configuration to enable Gitpod integration:
26+
27+
```json
28+
{
29+
"mcpServers": {
30+
"gitpod": {
31+
"command": "/tmp/gitpod-mcp",
32+
"env": {
33+
"GITPOD_API_KEY": "your-key-here",
34+
}
35+
}
36+
}
37+
}
38+
```
39+
40+
>**Note:** Don't forget to delete the token file after you're done.
41+
42+
## Available Resources
43+
44+
- `gitpod://projects` - List all available Gitpod projects
45+
- `gitpod://environments` - List current Gitpod environments
46+
47+
## Available Tools
48+
49+
### create_environment
50+
Creates a new Gitpod environment for a project.
51+
- Parameters:
52+
- `project_id` (string, required): The ID of the project to create the environment in
53+
54+
### stop_environment
55+
Stops a running Gitpod environment.
56+
- Parameters:
57+
- `environment_id` (string, required): The ID of the environment to stop
58+
59+
### execute_command
60+
Executes a command in a Gitpod environment.
61+
- Parameters:
62+
- `environment_id` (string, required): The ID of the environment to execute the command in
63+
- `command` (string, required): The command to execute (runs as a bash script in project root)
64+
- `description` (string, required): A short description of the command (max 200 characters)
65+
```

examples/mcp-server/go.mod

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module github.com/gitpod-io/gitpod-sdk-go/examples/mcp-server
2+
3+
go 1.23.0
4+
5+
replace github.com/gitpod-io/gitpod-sdk-go => ../..
6+
7+
require github.com/mark3labs/mcp-go v0.8.4
8+
9+
require (
10+
github.com/gitpod-io/gitpod-sdk-go v0.0.0-00010101000000-000000000000 // indirect
11+
github.com/google/uuid v1.6.0 // indirect
12+
github.com/tidwall/gjson v1.14.4 // indirect
13+
github.com/tidwall/match v1.1.1 // indirect
14+
github.com/tidwall/pretty v1.2.1 // indirect
15+
github.com/tidwall/sjson v1.2.5 // indirect
16+
)

examples/mcp-server/go.sum

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
4+
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
5+
github.com/mark3labs/mcp-go v0.8.4 h1:/VxjJ0+4oN2eYLuAgVzixrYNfrmwJnV38EfPIX3VbPE=
6+
github.com/mark3labs/mcp-go v0.8.4/go.mod h1:cjMlBU0cv/cj9kjlgmRhoJ5JREdS7YX83xeIG9Ko/jE=
7+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
8+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
9+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
10+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
11+
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
12+
github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM=
13+
github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
14+
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
15+
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
16+
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
17+
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
18+
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
19+
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
20+
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
21+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
22+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)