Skip to content

Commit d07e8d8

Browse files
authored
chore: add docs regarding configuration of MCP Servers (github#68)
* chore: add docs regarding configuration of MCP Servers Signed-off-by: Ivan Pedrazas <[email protected]>
1 parent 3045f71 commit d07e8d8

File tree

1 file changed

+134
-0
lines changed

1 file changed

+134
-0
lines changed

docs/configuration.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Configuration
2+
3+
If an MCP Server needs configuration, the `server.yaml` should have an `config` attribute where you will be able to define the different parameters that the MCP Server needs as environment variables, secrets, or other parameters.
4+
5+
## Parameters
6+
7+
If your MCP Server needs to provide a way for user to add their own configuration, you will need to define a `parameters` attribute under `config`.
8+
9+
Parameters needs to define a type, properties and which of those properties are required:
10+
11+
```
12+
config:
13+
parameters:
14+
type: object
15+
properties:
16+
my_param:
17+
type: string
18+
required:
19+
- my_param
20+
```
21+
22+
To define a parameter, you need to add an attribute using the parameter name as attibute name. Properties need to define the type (string, array, integer...)
23+
24+
Lastly, if you have a parameter that it's required to run your MCP Server, you should add it to the `required` attribute. This will force users in Docker Desktop, to fill that parameter before adding the MCP Server to the catalog.
25+
26+
## Environment variables
27+
28+
To define an environment variable you need to define a paremeter first and then add an entry under the `env` attribute of `config`:
29+
30+
```
31+
config:
32+
env:
33+
- name: ENVIRONMENT_VARIABLE_NAME
34+
example: ""
35+
value: '{{server_name.parameter_name}}'
36+
parameters:
37+
type: object
38+
properties:
39+
parameter_name:
40+
type: string
41+
required:
42+
- parameter_name
43+
```
44+
45+
Remember that paremeters are used to create the appropriate input field in Docker Desktop. Also, it's important to notice that we use the `server name` as prefix for your parameters, so make sure that the `name` attribute matches the parameters prefix.
46+
47+
## Secrets
48+
49+
Secrets don't need to define a parameter since we handle them differently.
50+
51+
```
52+
config:
53+
secrets:
54+
- name: server_name.api_key
55+
env: API_KEY
56+
example: YOUR_API_KEY
57+
```
58+
59+
## Volumes
60+
61+
To define a `volume` you need to add a `run` attribute. If you need the user to define the host directory, the container directory or both, you will need to create first the appropriate parameter and then add the `run` block to the server.
62+
63+
```
64+
run:
65+
volumes:
66+
- '{{server_name.volume_path}}:/path/inside/container'
67+
config:
68+
description: example of a volume
69+
parameters:
70+
type: object
71+
properties:
72+
volume_path:
73+
type: string
74+
required:
75+
- volume_path
76+
```
77+
78+
## Command
79+
80+
If you need to overwrite the command, you can do it in the `run` block:
81+
82+
```
83+
run:
84+
command:
85+
- --transport=stdio
86+
```
87+
88+
## Full Example
89+
90+
Here you can see a full example:
91+
92+
```
93+
name: server_name
94+
image: mcp/server_name
95+
type: server
96+
meta:
97+
category: devops
98+
tags:
99+
- server_name
100+
about:
101+
title: Server Name
102+
description: Description about my Server. What it does and why it's useful
103+
icon: https://...
104+
source:
105+
project: https://github.com/my-org/my-mcp-server
106+
run:
107+
command:
108+
- --transport=stdio
109+
volumes:
110+
- '{{server_name.path}}:/data'
111+
disableNetwork: true
112+
config:
113+
description: The MCP server is allowed to access these path
114+
secrets:
115+
- name: server_name.api_key
116+
env: API_KEY
117+
example: YOUR_API_KEY
118+
env:
119+
- name: ENVIRONMENT_VARIABLE_NAME
120+
example: ""
121+
value: '{{server_name.parameter_name}}'
122+
parameters:
123+
type: object
124+
properties:
125+
path:
126+
type: string
127+
default:
128+
- /Users/local-test
129+
parameter_name:
130+
type: string
131+
required:
132+
- path
133+
134+
```

0 commit comments

Comments
 (0)