Study117 [MCP] Math MCP 서버 생성 및 연결 이 글은 책 '나만의 MCP 서버 만들기 with 커서 AI'를 바탕으로 작성했습니다.더하기와 빼기 기능을 수행하는 간단한 Math MCP 서버 만들기 실습해보자.- 커서에서 math-server 폴더를 선택 - math_server.py를 실행 math_server.py 코드# 로깅 기능을 위한 모듈 가져오기import logging# FastMCP 서버를 사용하기 위한 클래스 가져오기from mcp.server.fastmcp import FastMCP# 로깅 설정: INFO 레벨 이상의 로그를 출력logging.basicConfig(level=logging.INFO)# MCP 서버 인스턴스 생성 ("Math"는 이 MCP의 이름 역할)mcp = FastMCP("Math")# 도구 1: 더하기 함수@m.. 2025. 9. 5. [Unity] 로그 파일 생성 및 기본 Debug 로직 확장 유니티에서 내가 원하는 형식에 맞게 디버그 로그가 찍히도록 기존 UnityEngine의 Debug를 확장했다. 또한, 유니티 빌드 후 테스트 시 Crash 등의 이슈에 대한 원인을 찾기위해 로그 파일 생성 클래스를 만들었다. 코드 예시using System;using System.Collections.Concurrent;using System.IO;using System.Text;using System.Threading;public static class Debug{ private static string _logFilePath = "Logs/log.txt"; // 로그 파일 경로 private static StreamWriter _logWriter; // 파일에 쓰는 S.. 2025. 9. 3. [Unity] Unity Main Thread 처리 Unity에서 외부 Thread를 만들어 사용할 때 유니티 관련 처리는 유니티 Main Thread에서 처리해야한다. - 유니티 내에서 외부 Thread를 사용해 TCP/UDP 서버가 동작하도록 만들었는데, 내부에서 유니티 관련 함수를 하니 빌드해서 테스트 했을 때 간혹 빌드본이 응답없음이 되면서 잘못된 주소를 참조했습니다.라는 오류가 떴다. 그래서 알아보니 유니티에서 외부 Thread를 사용할 때, 유니티의 GameObject나 Transform을 변경하거나 GetComponent 등의 함수를 호출했을 때 그런 문제가 발생할 수 있다고 한다. - 그래서 이런 문제를 해결하기 위해 해당 함수를 유니티 Main Thread로 가져와 사용하는 방식을 사용해서 해결했고, 그 방식은 아래와 같이 외부에서 사용되.. 2025. 9. 2. [Unity] Unity Render Streaming(유니티 스트리밍) 유니티의 화면을 외부에 스트리밍 하는 방법 1. PakageManager에서 좌측 상단의 + 버튼을 누르고 Add package by name을 누른 뒤 아래의 문자를 입력 후 Add 클릭 com.unity.renderstreaming 2. 다운받은 뒤 뜨는 Render Streaming Wizard에서 Fix All 클릭 3. 같은 창 하단의 WebApp에서 첫번째 버튼을 클릭하여 web app 다운 4. 다운받은 실행파일 실행 5. 실행 후 가장 하단의 경로를 인터넷 주소창에 복사하여 진입 http://127.0.0.1:80 6. Receiver Sample 클릭 7. 유니티로 다시 돌아와서 다운받은 Unity Render Streaming 패키지의 샘플을 프로젝트에 임포트 8. 외부로 스트리밍하고 .. 2024. 4. 18. [Gstreamer] Gstreamer 기본 튜토리얼 4 : 시간 관리 전체 소스코드 #include #ifdef __APPLE__ #include #endif /* Structure to contain all our information, so we can pass it around */ typedef struct _CustomData { GstElement *playbin; /* Our one and only element */ gboolean playing; /* Are we in the PLAYING state? */ gboolean terminate; /* Should we terminate execution? */ gboolean seek_enabled; /* Is seeking enabled for this media? */ gboolean seek_done; .. 2024. 3. 25. [Gstreamer] Gstreamer 기본 튜토리얼 3 전체 소스코드 #include #ifdef __APPLE__ #include #endif /* Structure to contain all our information, so we can pass it to callbacks */ typedef struct _CustomData { GstElement *pipeline; GstElement *source; GstElement *convert; GstElement *resample; GstElement *sink; } CustomData; /* Handler for the pad-added signal */ static void pad_added_handler (GstElement * src, GstPad * pad, CustomData * data); i.. 2024. 3. 22. [Gstreamer] Gstreamer 기본 튜토리얼 2 전체 소스코드 #include #ifdef __APPLE__ #include #endif int tutorial_main (int argc, char *argv[]) { GstElement *pipeline, *source, *sink; GstBus *bus; GstMessage *msg; GstStateChangeReturn ret; /* Initialize GStreamer */ gst_init (&argc, &argv); /* Create the elements */ source = gst_element_factory_make ("videotestsrc", "source"); sink = gst_element_factory_make ("autovideosink", "sink"); /* Create .. 2024. 3. 21. [Gstreamer] Gstreamer 기본 튜토리얼 1 전체 소스코드 #include #ifdef __APPLE__ #include #endif int tutorial_main (int argc, char *argv[]) { GstElement *pipeline; GstBus *bus; GstMessage *msg; /* Initialize GStreamer */ gst_init (&argc, &argv); /* Build the pipeline */ pipeline = gst_parse_launch ("playbin uri=https://gstreamer.freedesktop.org/data/media/sintel_trailer-480p.webm", NULL); /* Start playing */ gst_element_set_state (pipeline, .. 2024. 3. 19. [Gstreamer] Gstreamer 튜토리얼 준비 1. Gstreamer 설치 2. 코드 다운 subprojects/gst-docs · main · GStreamer / gstreamer · GitLab GStreamer multimedia framework gitlab.freedesktop.org 3. 압축해제 후 솔루션 파일 찾기 - gstreamer-main-subprojects-gst-docs > subprojects > gst-docs > examples > tutorials > vs2010 > tutorials.sln파일 실행 4. 속성관리자 설정 - visual studio 파일 실행 이후 vs 안에서 설정 보기 > 다른 창 > 속성관리자 > 파일목록 전체 선택 > 마우스 오른쪽버튼 클릭 > 기존 속성 시트 추가 선택 5. 기존 gstrea.. 2024. 3. 19. [Unity] ReadOnly 인스펙터 - 읽기전용으로 인스펙터에 보일 수 있게 만들어주는 Attribute 생성 코드 - 변수 앞에 [ReadOnly]를 붙여 사용가능(단, public 이거나 Serialized Field 를 이용해 인스펙터 상에서 보여야 함.) - [ReadOnly(false)] 또는 [ReadOnly]는 모든 경우에 읽기전용 - [ReadOnly(true)] 는 런타임 중에만 읽기전용으로 변경 #region ReadOnly 인스펙터 생성이 가능하도록 함. #if UNITY_EDITOR namespace UnityEditor { [CustomPropertyDrawer(typeof(ReadOnlyAttribute), true)] public class ReadOnlyAttributeDrawer : PropertyDrawer.. 2024. 3. 4. [Unity] 유니티 - UI 자동 바인딩 구현(Reflection 이용, enum) 인프런 루키스님의 강좌를 참고했습니다. - 드래그 앤 드롭을 매번 해주는 것을 대체하기 위해서 구현했다. - dictionary에 사용할 오브젝트를 담고, 드래그 앤 드롭 대신 enum을 이용했다. - enum의 원소이름은 사용할 오브젝트의 실제 이름과 동일해야 한다. // UI_Base using System; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class UI_Base : MonoBehaviour { // 컴포넌트 타입별 오브젝트들을 담아 관리할 딕셔너리 // Key : enum 이름, Value : 오브젝트 배열 Dictionary dict = new Dictiona.. 2024. 2. 4. [Unity][C#] 인터페이스(Interface) 인터페이스란? - 외부와 통신하는 공개 통로, 통로의 규격 - 통로의 규격은 강제하지만, 내부에서 어떤 일이 일어날지를 결정하지는 않음. 인터페이스의 특징 - 관례적으로 이름 앞에 I를 붙여 선언 - 인터페이스를 상속하는 클래스는 해당 인터페이스의 메서드를 반드시 구현해야함. - 인터페이스를 상속하는 클래스는 해당 인터페이스의 메서드를 반드시 public으로 선언해야함. - 세부적인 타입과 구체적인 구현을 따지지 않고 동작 - 느슨한 커플링(Loose Coupling) : 어떤 코드가 특정 클래스의 구현에 결합되지 않아 유연하게 변경 가능한 상태 예시 public interface IItem { void Use(GameObject target); } public class HpPotion : MonoBe.. 2024. 2. 1. 이전 1 2 3 4 ··· 10 다음