# Site MCP servers

Manage Model Context Protocol (Mcp) servers used by your site.

## The SiteMcpServer object

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"components":{"schemas":{"SiteMcpServer":{"type":"object","properties":{"object":{"type":"string","enum":["site-mcp-server"]},"id":{"type":"string","description":"Unique identifier for the MCP server"},"name":{"$ref":"#/components/schemas/SiteMcpServerName"},"url":{"$ref":"#/components/schemas/URL"},"headers":{"$ref":"#/components/schemas/SiteMcpServerHeaders"},"condition":{"description":"Conditional expression used to evaluate whether the MCP server should be available to the site's visitor.","$ref":"#/components/schemas/Expression"},"urls":{"type":"object","description":"URLs associated with the object","properties":{"location":{"type":"string","description":"URL of the MCP server in the API","format":"uri"}},"required":["location"]}},"required":["object","id","name","url","headers","urls"]},"SiteMcpServerName":{"type":"string","description":"Name of the MCP server","minLength":1,"maxLength":100},"URL":{"type":"string","format":"uri","maxLength":2048},"SiteMcpServerHeaders":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":512},"description":"HTTP headers sent with requests to this server"},"Expression":{"type":"string","description":"Expression to evaluate","minLength":0,"maxLength":1024}}}}
```

## GET /orgs/{organizationId}/sites/{siteId}/mcp-servers

> List all MCP servers for a site

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"site-mcp-servers","description":"Manage Model Context Protocol (Mcp) servers used by your site.\n\n{% openapi-schemas spec=\"gitbook\" schemas=\"SiteMcpServer\" grouped=\"false\" %}\n    The SiteMcpServer object\n{% endopenapi-schemas %}\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"}},"parameters":{"organizationId":{"name":"organizationId","in":"path","required":true,"description":"The unique id of the organization","schema":{"$ref":"#/components/schemas/EntityId"}},"siteId":{"name":"siteId","in":"path","required":true,"description":"The unique id of the site","schema":{"type":"string"}},"listPage":{"name":"page","in":"query","description":"Identifier of the page results to fetch.","schema":{"type":"string"}},"listLimit":{"name":"limit","in":"query","description":"The number of results per page","schema":{"type":"number","minimum":0,"maximum":1000}}},"schemas":{"EntityId":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"A unique entity identifier"},"List":{"type":"object","properties":{"next":{"type":"object","properties":{"page":{"type":"string","description":"Unique identifier to query the next results page"}},"required":["page"]},"count":{"type":"number","description":"Total count of objects in the list"}}},"SiteMcpServer":{"type":"object","properties":{"object":{"type":"string","enum":["site-mcp-server"]},"id":{"type":"string","description":"Unique identifier for the MCP server"},"name":{"$ref":"#/components/schemas/SiteMcpServerName"},"url":{"$ref":"#/components/schemas/URL"},"headers":{"$ref":"#/components/schemas/SiteMcpServerHeaders"},"condition":{"description":"Conditional expression used to evaluate whether the MCP server should be available to the site's visitor.","$ref":"#/components/schemas/Expression"},"urls":{"type":"object","description":"URLs associated with the object","properties":{"location":{"type":"string","description":"URL of the MCP server in the API","format":"uri"}},"required":["location"]}},"required":["object","id","name","url","headers","urls"]},"SiteMcpServerName":{"type":"string","description":"Name of the MCP server","minLength":1,"maxLength":100},"URL":{"type":"string","format":"uri","maxLength":2048},"SiteMcpServerHeaders":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":512},"description":"HTTP headers sent with requests to this server"},"Expression":{"type":"string","description":"Expression to evaluate","minLength":0,"maxLength":1024}}},"paths":{"/orgs/{organizationId}/sites/{siteId}/mcp-servers":{"get":{"operationId":"listSiteMcpServers","summary":"List all MCP servers for a site","tags":["site-mcp-servers"],"parameters":[{"$ref":"#/components/parameters/organizationId"},{"$ref":"#/components/parameters/siteId"},{"$ref":"#/components/parameters/listPage"},{"$ref":"#/components/parameters/listLimit"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/List"},{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/SiteMcpServer"}}}}]}}}}}}}}}
```

## POST /orgs/{organizationId}/sites/{siteId}/mcp-servers

> Create a new MCP server

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"site-mcp-servers","description":"Manage Model Context Protocol (Mcp) servers used by your site.\n\n{% openapi-schemas spec=\"gitbook\" schemas=\"SiteMcpServer\" grouped=\"false\" %}\n    The SiteMcpServer object\n{% endopenapi-schemas %}\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"}},"parameters":{"organizationId":{"name":"organizationId","in":"path","required":true,"description":"The unique id of the organization","schema":{"$ref":"#/components/schemas/EntityId"}},"siteId":{"name":"siteId","in":"path","required":true,"description":"The unique id of the site","schema":{"type":"string"}}},"schemas":{"EntityId":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"A unique entity identifier"},"SiteMcpServerName":{"type":"string","description":"Name of the MCP server","minLength":1,"maxLength":100},"URL":{"type":"string","format":"uri","maxLength":2048},"SiteMcpServerHeaders":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":512},"description":"HTTP headers sent with requests to this server"},"Expression":{"type":"string","description":"Expression to evaluate","minLength":0,"maxLength":1024},"SiteMcpServer":{"type":"object","properties":{"object":{"type":"string","enum":["site-mcp-server"]},"id":{"type":"string","description":"Unique identifier for the MCP server"},"name":{"$ref":"#/components/schemas/SiteMcpServerName"},"url":{"$ref":"#/components/schemas/URL"},"headers":{"$ref":"#/components/schemas/SiteMcpServerHeaders"},"condition":{"description":"Conditional expression used to evaluate whether the MCP server should be available to the site's visitor.","$ref":"#/components/schemas/Expression"},"urls":{"type":"object","description":"URLs associated with the object","properties":{"location":{"type":"string","description":"URL of the MCP server in the API","format":"uri"}},"required":["location"]}},"required":["object","id","name","url","headers","urls"]}}},"paths":{"/orgs/{organizationId}/sites/{siteId}/mcp-servers":{"post":{"operationId":"createSiteMcpServer","summary":"Create a new MCP server","tags":["site-mcp-servers"],"parameters":[{"$ref":"#/components/parameters/organizationId"},{"$ref":"#/components/parameters/siteId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"$ref":"#/components/schemas/SiteMcpServerName"},"url":{"$ref":"#/components/schemas/URL"},"headers":{"$ref":"#/components/schemas/SiteMcpServerHeaders"},"condition":{"description":"Conditional expression used to evaluate whether the MCP server should be available to the site's visitor (should evaluate to a boolean). If set to null, the condition will be removed.","oneOf":[{"$ref":"#/components/schemas/Expression"},{"type":"null"}]}},"required":["name","url","headers"]}}}},"responses":{"201":{"description":"MCP server created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteMcpServer"}}}}}}}}}
```

## GET /orgs/{organizationId}/sites/{siteId}/mcp-servers/{siteMcpServerId}

> Get a site MCP server

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"site-mcp-servers","description":"Manage Model Context Protocol (Mcp) servers used by your site.\n\n{% openapi-schemas spec=\"gitbook\" schemas=\"SiteMcpServer\" grouped=\"false\" %}\n    The SiteMcpServer object\n{% endopenapi-schemas %}\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"}},"parameters":{"organizationId":{"name":"organizationId","in":"path","required":true,"description":"The unique id of the organization","schema":{"$ref":"#/components/schemas/EntityId"}},"siteId":{"name":"siteId","in":"path","required":true,"description":"The unique id of the site","schema":{"type":"string"}},"siteMcpServerId":{"name":"siteMcpServerId","in":"path","required":true,"description":"The unique id of the MCP server","schema":{"type":"string"}}},"schemas":{"EntityId":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"A unique entity identifier"},"SiteMcpServer":{"type":"object","properties":{"object":{"type":"string","enum":["site-mcp-server"]},"id":{"type":"string","description":"Unique identifier for the MCP server"},"name":{"$ref":"#/components/schemas/SiteMcpServerName"},"url":{"$ref":"#/components/schemas/URL"},"headers":{"$ref":"#/components/schemas/SiteMcpServerHeaders"},"condition":{"description":"Conditional expression used to evaluate whether the MCP server should be available to the site's visitor.","$ref":"#/components/schemas/Expression"},"urls":{"type":"object","description":"URLs associated with the object","properties":{"location":{"type":"string","description":"URL of the MCP server in the API","format":"uri"}},"required":["location"]}},"required":["object","id","name","url","headers","urls"]},"SiteMcpServerName":{"type":"string","description":"Name of the MCP server","minLength":1,"maxLength":100},"URL":{"type":"string","format":"uri","maxLength":2048},"SiteMcpServerHeaders":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":512},"description":"HTTP headers sent with requests to this server"},"Expression":{"type":"string","description":"Expression to evaluate","minLength":0,"maxLength":1024}}},"paths":{"/orgs/{organizationId}/sites/{siteId}/mcp-servers/{siteMcpServerId}":{"get":{"operationId":"getSiteMcpServerById","summary":"Get a site MCP server","tags":["site-mcp-servers"],"parameters":[{"$ref":"#/components/parameters/organizationId"},{"$ref":"#/components/parameters/siteId"},{"$ref":"#/components/parameters/siteMcpServerId"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteMcpServer"}}}}}}}}}
```

## DELETE /orgs/{organizationId}/sites/{siteId}/mcp-servers/{siteMcpServerId}

> Delete a site MCP server

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"site-mcp-servers","description":"Manage Model Context Protocol (Mcp) servers used by your site.\n\n{% openapi-schemas spec=\"gitbook\" schemas=\"SiteMcpServer\" grouped=\"false\" %}\n    The SiteMcpServer object\n{% endopenapi-schemas %}\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"}},"parameters":{"organizationId":{"name":"organizationId","in":"path","required":true,"description":"The unique id of the organization","schema":{"$ref":"#/components/schemas/EntityId"}},"siteId":{"name":"siteId","in":"path","required":true,"description":"The unique id of the site","schema":{"type":"string"}},"siteMcpServerId":{"name":"siteMcpServerId","in":"path","required":true,"description":"The unique id of the MCP server","schema":{"type":"string"}}},"schemas":{"EntityId":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"A unique entity identifier"}}},"paths":{"/orgs/{organizationId}/sites/{siteId}/mcp-servers/{siteMcpServerId}":{"delete":{"operationId":"deleteSiteMcpServerById","summary":"Delete a site MCP server","tags":["site-mcp-servers"],"parameters":[{"$ref":"#/components/parameters/organizationId"},{"$ref":"#/components/parameters/siteId"},{"$ref":"#/components/parameters/siteMcpServerId"}],"responses":{"204":{"description":"MCP server did not exist"},"205":{"description":"MCP server deleted"}}}}}}
```

## PATCH /orgs/{organizationId}/sites/{siteId}/mcp-servers/{siteMcpServerId}

> Update a site MCP server

```json
{"openapi":"3.1.0","info":{"title":"GitBook API","version":"0.0.1-beta"},"tags":[{"name":"site-mcp-servers","description":"Manage Model Context Protocol (Mcp) servers used by your site.\n\n{% openapi-schemas spec=\"gitbook\" schemas=\"SiteMcpServer\" grouped=\"false\" %}\n    The SiteMcpServer object\n{% endopenapi-schemas %}\n"}],"servers":[{"url":"{host}/v1","variables":{"host":{"default":"https://api.gitbook.com"}}}],"security":[{"user":[]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"}},"parameters":{"organizationId":{"name":"organizationId","in":"path","required":true,"description":"The unique id of the organization","schema":{"$ref":"#/components/schemas/EntityId"}},"siteId":{"name":"siteId","in":"path","required":true,"description":"The unique id of the site","schema":{"type":"string"}},"siteMcpServerId":{"name":"siteMcpServerId","in":"path","required":true,"description":"The unique id of the MCP server","schema":{"type":"string"}}},"schemas":{"EntityId":{"type":"string","pattern":"^[a-zA-Z0-9_-]+$","description":"A unique entity identifier"},"SiteMcpServerName":{"type":"string","description":"Name of the MCP server","minLength":1,"maxLength":100},"SiteMcpServerHeaders":{"type":"object","additionalProperties":{"type":"string","minLength":1,"maxLength":512},"description":"HTTP headers sent with requests to this server"},"Expression":{"type":"string","description":"Expression to evaluate","minLength":0,"maxLength":1024},"SiteMcpServer":{"type":"object","properties":{"object":{"type":"string","enum":["site-mcp-server"]},"id":{"type":"string","description":"Unique identifier for the MCP server"},"name":{"$ref":"#/components/schemas/SiteMcpServerName"},"url":{"$ref":"#/components/schemas/URL"},"headers":{"$ref":"#/components/schemas/SiteMcpServerHeaders"},"condition":{"description":"Conditional expression used to evaluate whether the MCP server should be available to the site's visitor.","$ref":"#/components/schemas/Expression"},"urls":{"type":"object","description":"URLs associated with the object","properties":{"location":{"type":"string","description":"URL of the MCP server in the API","format":"uri"}},"required":["location"]}},"required":["object","id","name","url","headers","urls"]},"URL":{"type":"string","format":"uri","maxLength":2048}}},"paths":{"/orgs/{organizationId}/sites/{siteId}/mcp-servers/{siteMcpServerId}":{"patch":{"operationId":"updateSiteMcpServerById","summary":"Update a site MCP server","tags":["site-mcp-servers"],"parameters":[{"$ref":"#/components/parameters/organizationId"},{"$ref":"#/components/parameters/siteId"},{"$ref":"#/components/parameters/siteMcpServerId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"$ref":"#/components/schemas/SiteMcpServerName"},"url":{"type":"string","format":"uri","maxLength":2048},"headers":{"$ref":"#/components/schemas/SiteMcpServerHeaders"},"condition":{"description":"Conditional expression used to evaluate whether the MCP server should be available to the site's visitor (should evaluate to a boolean). If not set, the condition will remain unchanged. If set to null, the condition will be removed.","oneOf":[{"$ref":"#/components/schemas/Expression"},{"type":"null"}]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SiteMcpServer"}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gitbook.com/docs/developers/gitbook-api/api-reference/docs-sites/site-mcp-servers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
