runr_mcp_server (Resource)
Serves a project as a hosted MCP server at <console>/mcp/servers/<handle> behind RunR's gateway, which authenticates callers, forwards their identity with a signature and records every call (hosted MCP servers). The project needs the http trigger.
The gateway key reaches the workload with a deploy: put id into runr_deployment.triggers so the project is deployed once the server exists. Needs mcp.servers.manage on the project.
Example Usage#
# The weather project (a FaaS project of the mcp-python runtime, http trigger) served at
# https://<console>/mcp/servers/weather; MCP clients sign in with OAuth or a RunR token.
resource "runr_mcp_server" "weather" {
project_id = runr_project.weather.id
access_mode = "oauth"
audit_calls = true
}
# The gateway key reaches the workload with a deploy.
resource "runr_deployment" "weather" {
project_id = runr_project.weather.id
triggers = {
mcp_server = runr_mcp_server.weather.id
}
}
output "mcp_url" {
value = runr_mcp_server.weather.url
}
Schema#
Required#
project_id(String) Project id.
Optional#
access_mode(String) Who gets in:public(anyone),token(a RunR API token of a user withmcp.servers.callon the project; default) oroauth(astoken, plus OAuth sign-in for clients that only have the URL).audit_calls(Boolean) Also record every call in the audit log (mcp.server.call).path(String) Path of the MCP endpoint in the function (default/mcp).
Read-Only#
handle(String) Handle in the URL (the project's slug).id(String) Server id.resource_metadata(String) OAuth protected resource metadata URL (empty forpublic).url(String) URL MCP clients connect to.
Import#
Import is supported using the following syntax:
The terraform import command can be used, for example:
# <project name or id>
terraform import runr_mcp_server.weather weather