Skip to content

Instantly share code, notes, and snippets.

@zzstoatzz
Last active December 7, 2024 05:18
Show Gist options
  • Save zzstoatzz/d0291715afcbc171b2e0ea3b7c98f7a2 to your computer and use it in GitHub Desktop.
Save zzstoatzz/d0291715afcbc171b2e0ea3b7c98f7a2 to your computer and use it in GitHub Desktop.
reference mcp server impl
# echo OPENAI_API_KEY=$OPENAI_API_KEY > .env
# uv run --with marvin --with fastmcp fastmcp install mcp_server.py -f .env
# open -a Claude
import marvin
from fastmcp import FastMCP
server = FastMCP("Fruit server", dependencies=["marvin"])
@server.tool()
def generate_fruit(n: int, color: str) -> list[str]:
return marvin.generate(
target=str,
n=n,
instructions=f"Generate fruits of color {color}",
)
@server.resource("memory://nate")
def memory_of_nate() -> str:
return "Nate likes graphs and is easily lost to the sauce."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment