Last active
December 7, 2024 05:18
-
-
Save zzstoatzz/d0291715afcbc171b2e0ea3b7c98f7a2 to your computer and use it in GitHub Desktop.
reference mcp server impl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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