MCP | 내가만든 Stdio 도구 JSON등록하기

Ruah·2025년 4월 4일
0

MCP 도구 Json으로 만들기

mcp 도구를 실행하기 위해서는 cursor나 claude desktop에 json형식의 도구를 넣어야 실행할수있다.

{
  "mcpServers": {
    "shell": {
          "command": "uv", // 가아닌 path를 넣자
          "args": [
            
          ]
        }
    }
}

stdio 형식의 도구가 실행되지 않을때가 있는데, 그럴때는

command

터미널에서 직접 command(node, uv, uvx 등) 부분에 경로를 넣어주어야한다.

터미널에서

//window
where.exe uvx

//macOS
which uvx

출력 예시 :

// window
C:\\Users\\name\\.local\\bin\\uvx.exe
// macOS
/User/name/.local/bin/uvx

이제 다음과 같이 넣어주면된다.

{
  "mcpServers": {
    "shell": {
          "command": "C:\\Users\\name\\.local\\bin\\uvx.exe", // MAC OS는 역슬레쉬가 아닌 정방향 슬레쉬 한줄 '/' 사용
          "args": [
            
          ]
        }
    }
}

args

먼저 터미널에서 해당 툴이 있는 py 파일의 디렉토리에가서 경로를 찾는다.

pwd

// window 출력 예시
Path
----
C:\Users\name\Desktop\projects\mcp-servers\shellserver
{
  "mcpServers": {
      "shell": {
          "command": "C:\\Users\\name\\.local\\bin\\uvx.exe", 
          "args": [
              "--directory", // 어느 디렉토리인지
        	  "C:\\Users\\pps\\Desktop\\projects\\mcp-servers\\shellserver", // `pwd`로 찾은 루트 경로
        	  "run", // 실행
        	  "server.py" // 파일이름
            ]
        }
    }
}
profile
집요한 주니어 개발자의 호되게 당했던 기록

0개의 댓글