> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/developers/gitbook-api/api-reference/docs-sites/site-mcp-servers/add-a-new-mcp-server-configuration-to-a-site.md).

# Add a new MCP server configuration to a site

Registers a new Model Context Protocol (MCP) server with the site, providing its URL, transport type, request headers, and an optional conditional expression to control visibility per visitor. Once added, the MCP server's tools become available to the AI Assistant when helping visitors of this 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":[]},{"oauth":["site:write"]}],"components":{"securitySchemes":{"user":{"type":"http","scheme":"bearer"},"oauth":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://oauth.gitbook.com/authorize","tokenUrl":"https://oauth.gitbook.com/token","scopes":{"user:read":"Read your GitBook user profile.","organization:read":"Read organization settings and metadata.","organization:write":"Create and update organization settings.","organization:members:read":"Read organization members, invites and link invites.","organization:members:write":"Manage organization members, invites and link invites.","organization:ask":"Ask AI questions across an organization's content.","organization:search":"Search across an organization's content.","space:read":"Read spaces and their content.","space:write":"Create, update and delete spaces and their content, including imports.","space:permissions:read":"Read space permissions.","space:permissions:write":"Manage space permissions.","change-request:merge":"Merge change requests, publishing their changes to the space.","site:read":"Read sites and their settings.","site:write":"Create, update and delete sites, sections and their settings.","site:publish":"Publish and unpublish sites, controlling their public exposure.","site:permissions:read":"Read site permissions.","site:permissions:write":"Manage site permissions.","site:auth:read":"Read site authentication and security configuration.","site:auth:write":"Manage site authentication and security configuration.","site:insights:read":"Read site analytics and insights.","site:ask":"Ask AI questions across a site's content.","site:search":"Search across a site's content.","openapi:read":"Read OpenAPI specifications.","openapi:write":"Create, update and delete OpenAPI specifications."}}}}},"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},"SiteMcpServerTransport":{"type":"string","description":"Transport protocol used to connect to the MCP server","enum":["sse","http"],"default":"sse"},"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"},"transport":{"$ref":"#/components/schemas/SiteMcpServerTransport"},"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","transport","headers","urls"]}}},"paths":{"/orgs/{organizationId}/sites/{siteId}/mcp-servers":{"post":{"operationId":"createSiteMcpServer","summary":"Add a new MCP server configuration to a site","description":"Registers a new Model Context Protocol (MCP) server with the site, providing its URL, transport type, request headers, and an optional conditional expression to control visibility per visitor. Once added, the MCP server's tools become available to the AI Assistant when helping visitors of this site.","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"},"transport":{"$ref":"#/components/schemas/SiteMcpServerTransport"},"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"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://gitbook.com/docs/developers/gitbook-api/api-reference/docs-sites/site-mcp-servers/add-a-new-mcp-server-configuration-to-a-site.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
