fastmcp

구조

@mcp.resource("market://state")
def get_market_state() -> str:
	"""Get the current market state
	Returns:
		str: the current market state
	"""
	return "the market is open"

@mcp.resource("market://stock,{symbol}")
def get_stock_price(symbol: str) -> str:
	"""Get the current stock price
	Args:
		symbol(str): The symbol of the company to get the stock price for
	Returns:
		str: The current stock price
	"""
	return f"The current stock price for {symbol} is $100"
@mcp.tool()
def buy_stock(symbol: str, quantity:int) -> str:
	"""Buys a stock for a given symbol and quantity
	Args:
		symbol (str): The symbol of the company to buy stock for
		quantity (int): The quantity of stock to buy
	Returns:
		str: A string containing the result of the transaction
	"""
	return f"Bought {quantity} shares of {symbol}"

@mcp.tool()
def sell_stock(symbol: str, quantity:int) -> str:
	"""Sell a stock for a given symbol and quantity
	Args:
		symbol (str): The symbol of the company to buy stock for
		quantity (int): The quantity of stock to sell
	Returns:
		str: A string containing the result of the transaction
	"""
	return f"Sold {quantity} shares of {symbol}"


from fastmcp import FastMCP, Context
@mcp.tool()
async def long_task(files: list[str], ctx: Context) -> str:
"""
process multiple files with progress tracking
"""
	for i, file in enumerate(files):
		ctx.info(f"processing {file}")
		await ctx.report_progress(i, len(files))
	# read another resource if needed
	data = await ctx.read_resource(f"file://{file}")
return "processing complete"
@mcp.prompt()
def analyze_stock(symbol: str, last_years_profit: str, company_info:str) -> str:
	return f"""
	You are a stock analyst. You are given a stock symbol and you need to analze the stock.
	Here is the income statement:
	{last_years_profit}
	Here is the company info:
	{company_info}
	Here is the symbol:
	{symbol}
	Make sure to analyze the income statement and company info to give a detailed analysis of the stock.
	Make a recommendation on whether to buy, sell, or hold the stock.
	"""

llm 활용 (cursor ai ver)


용어


llm 으로 MCP 작성 예제

스크린샷 2025-03-24 오후 12.51.27.png

cursor ai MCP json에 추가

스크린샷 2025-03-24 오후 12.54.10.png

Pasted image 20250325105504.png


참조 사이트


talk to figma

github 소스 clone
bun 설치 (curl -fsSL https://bun.sh/install | bash)
bun setup
bun start (bun socket)
bunx cursor-talk-to-figma-mcp (새로운 터미널)
figma 설치 및 하단의 plugin 아이콘 클릭 
cursor talk to figma mcp 플러그인 설치 후 use localhost 클릭 후 connect 클릭
또는 plugins -> development -> import plugin from manifest #(src/cursor_mcp_plugin/manifest.json 선택)
join_chennel: y59zgry8// 피그마 채널 y59zgry8 에 작업해줘 먼저 작성하여 디자인 변경 진행
share 버튼 클릭 copy link 클릭 후 cursor 채팅에 붙혀넣기 후 명령
디자인 우클릭 -> copy paste as -> link to selection

github


용도


구분 (2025-04-03 기준)


참고