MCP 접근과 머신 및 워크로드 아이덴티티
Teleport는 Model Context Protocol(MCP) 서버에 대한 접근을 보호하고 제어합니다. 이 가이드에서는 MCP 클라이언트가 Teleport 클러스터에 등록된 MCP 서버에 접근하는 데 사용할 수 있는 단기 자격 증명을 생성하도록 tbot을 설정합니다.
Teleport는 Model Context Protocol(MCP) 서버에 대한 접근을 보호하고 제어합니다. 머신 및 워크로드 아이덴티티(MWI)를 사용하면 장기 정적 시크릿 없이 머신과 워크로드에 이러한 MCP 서버에 대한 안전하고 단기적인 접근을 허용할 수 있습니다.
이 가이드에서는 MCP 클라이언트가 Teleport 클러스터에 등록된 MCP 서버에 접근하는 데 사용할 수 있는 단기 자격 증명을 생성하도록 tbot을 설정합니다.
이 가이드는 머신에 MCP 서버 접근을 허용하는 데 초점을 맞춥니다. 인간 사용자에게 MCP 서버 접근을 허용하려면 Stdio MCP 서버를 사용한 MCP 접근 가이드를 참조하세요.
작동 방식#
Teleport Application Access 에이전트가 접근을 보호하려는 MCP 서버 앞에 배포됩니다. 이 에이전트는 Teleport에서 설정된 역할에 따라 접근 제어를 적용합니다.
머신 및 워크로드 아이덴티티 에이전트 tbot이 MCP 서버에 접근해야 하는 머신에 설치됩니다. tbot은 Teleport 클러스터에 인증하고 MCP 클라이언트가 Teleport Proxy를 통해 MCP 서버에 접근하는 데 사용할 수 있는 아이덴티티 파일을 생성합니다.
사전 조건#
-
A running Teleport cluster. If you want to get started with Teleport, sign up for a free trial or set up a demo environment.
-
The
tctlandtshclients.Installing `tctl` and `tsh` clients
-
Determine the version of your Teleport cluster. The
tctlandtshclients must be at most one major version behind your Teleport cluster version. Send a GET request to the Proxy Service at/v1/webapi/findand use a JSON query tool to obtain your cluster version. Replace with the web address of your Teleport Proxy Service:$ TELEPORT_DOMAIN= $ TELEPORT_VERSION="$(curl -s https://$TELEPORT_DOMAIN/v1/webapi/find | jq -r '.server_version')" -
Follow the instructions for your platform to install
tctlandtshclients:
-
- 아직 MCP 서버를 Teleport에 연결하지 않았다면 MCP 시작 가이드를 따르세요.
To check that you can connect to your Teleport cluster, sign in with tsh login, then
verify that you can run tctl commands using your current credentials.
For example, run the following command, assigning to the domain name of the Teleport Proxy Service in your cluster and to your Teleport username:
$ tsh login --proxy= --user=
$ tctl status
# Cluster (=teleport.url=)
# Version (=teleport.version=)
# CA pin (=presets.ca_pin=)
If you can connect to the cluster and run the tctl status command, you can use your
current credentials to run subsequent tctl commands from your workstation.
If you host your own Teleport cluster, you can also run tctl commands on the computer that
hosts the Teleport Auth Service for full permissions.
- MCP 서버에 접근할 머신에
tbot과tsh가 이미 설치되고 설정되어 있어야 합니다. 자세한 내용은 배포 가이드를 참조하세요.
1단계/3단계. RBAC 설정#
먼저 봇이 생성한 자격 증명이 인프라의 MCP 서버에 접근할 수 있도록 Teleport를 설정해야 합니다. 이는 접근을 허용하려는 MCP 서버의 레이블 매처를 지정하는 역할을 만들고 해당 MCP 서버 내에서 접근 가능한 도구를 지정하는 방식으로 수행됩니다.
이 예시에서는 env: dev로 레이블이 지정된 MCP 서버에 대한 접근을 허용하고 해당 MCP 서버 내의 모든 도구에 대한 접근을 허용합니다.
다음 내용으로 role.yaml 파일을 만듭니다:
kind: role
version: v6
metadata:
name: example-role
spec:
allow:
app_labels:
'env': 'dev'
mcp:
tools: ['*']
example-role을 사용 사례와 관련된 설명적인 이름으로 교체하고, app_labels를 MCP 서버의 레이블과 일치하도록 조정하고, mcp.tools 필드를 수정하여 접근을 허용할 도구를 지정하세요.
tctl create -f ./role.yaml을 사용하여 역할을 만듭니다.
이제 tctl bots update를 사용하여 봇에 역할을 추가합니다. example을 배포 가이드에서 만든 봇의 이름으로, example-role을 방금 만든 역할의 이름으로 교체하세요:
$ tctl bots update example --add-roles example-role
2단계/3단계. tbot 설정#
다음으로 tbot이 아이덴티티 파일을 출력하도록 설정합니다. 이 아이덴티티 파일은 MCP 클라이언트가 Teleport에 인증하는 데 사용됩니다. 이는 identity 서비스 유형을 사용하여 수행됩니다.
서비스는 대상으로 설정해야 합니다. 이 예시에서는 directory 유형이 사용됩니다. 이는 아티팩트를 디스크의 지정된 디렉터리에 기록합니다. tbot이 실행되는 사용자가 이 디렉터리에 쓸 수 있고 MCP 클라이언트가 실행될 Linux 사용자가 읽을 수 있도록 하세요.
tbot 설정을 수정하여 identity 서비스를 추가합니다:
services:
- type: identity
allow_reissue: true
destination:
type: directory
path: /opt/machine-id
/opt/machine-id를 선택한 디렉터리로 교체하세요.
tbot을 백그라운드 서비스로 실행 중인 경우 재시작하세요. 원샷 모드로 실행 중이라면 자격 증명을 사용하기 전에 실행해야 합니다.
3단계/3단계. MCP 클라이언트 연결#
이제 MCP 서버에 접근하기 위해 tbot이 생성한 자격 증명을 사용하도록 MCP 클라이언트를 설정할 수 있습니다. 필요한 정확한 단계는 사용하는 MCP 클라이언트에 따라 다릅니다.
LangGraph와의 호환성을 위해 langchain-mcp-adapters 패키지를 사용하세요. 이 패키지는 MCP 클라이언트를 구현하고 Python에서 기본적으로 정의된 도구와 동일한 방식으로 MCP 서버의 도구를 노출합니다.
MultiServerMCPClient를 인스턴스화하고 tbot이 생성한 아이덴티티 파일과 함께 tsh mcp connect를 호출하도록 설정합니다:
from langchain_mcp_adapters.client import MultiServerMCPClient
client = MultiServerMCPClient({
"my-mcp-server": {
"command": "tsh"
"args": [
"mcp",
"connect",
"-i", "/opt/machine-id/identity",
"--proxy", "example.teleport.sh:443",
"my-mcp-server",
],
"transport": "stdio",
},
})
tools = await client.get_tools()
환경에 맞게 예시 값을 수정합니다:
/opt/machine-id/identity를tbot이 생성한 아이덴티티 파일 경로로.example.teleport.sh:443을 Teleport 프록시 주소로.my-mcp-server를 Teleport에 등록된 MCP 서버 이름으로.
자세한 내용은 LangGraph 문서를 참조하세요.
Teleport를 통해 MCP 서버를 호출하도록 Claude Desktop을 설정하려면 tbot이 생성한 아이덴티티 파일과 함께 tsh mcp connect를 실행하는 항목을 claude_desktop_config.json에 추가합니다:
{
"mcpServers": {
"teleport-mcp-teleport-mcp-demo": {
"command": "tsh",
"args": [
"mcp",
"connect",
"-i",
"/opt/machine-id/identity",
"--proxy",
"example.teleport.sh:443",
"my-mcp-server"
]
}
}
}
환경에 맞게 예시 값을 수정합니다:
/opt/machine-id/identity를tbot이 생성한 아이덴티티 파일 경로로.example.teleport.sh:443을 Teleport 프록시 주소로.my-mcp-server를 Teleport에 등록된 MCP 서버 이름으로.
자세한 내용은 Claude Desktop 문서를 참조하세요.
일반적으로 STDIO 전송을 지원하는 모든 MCP 클라이언트는 Teleport MCP 접근과 함께 사용할 수 있습니다.
다음 인수와 함께 tsh 바이너리를 실행하도록 MCP 클라이언트를 설정해야 합니다:
$ tsh mcp connect -i /opt/machine-id/identity --proxy example.teleport.sh:443 my-mcp-server
환경에 맞게 예시 값을 수정합니다:
/opt/machine-id/identity를tbot이 생성한 아이덴티티 파일 경로로.example.teleport.sh:443을 Teleport 프록시 주소로.my-mcp-server를 Teleport에 등록된 MCP 서버 이름으로.
