
How to Build an MCP Server with Python in 5 Min
You want to give Claude (or any MCP client) access to your own custom tools. Every Python tutorial you find is 2,000+ words and 15 steps. Here's a working MCP server with two tools in under 30 lines. The Code Create a file called notes_server.py : from fastmcp import FastMCP mcp = FastMCP ( " Notes " ) # In-memory storage notes : dict [ str , str ] = {} @mcp.tool def add_note ( name : str , content : str ) -> str : """ Save a note with a given name and content. """ notes [ name ] = content return f " Saved note ' { name } ' . " @mcp.tool def search_notes ( query : str ) -> list [ dict ]: """ Search notes by keyword. Returns all notes containing the query string. """ results = [ { " name " : name , " content " : content } for name , content in notes . items () if query . lower () in name . lower () or query . lower () in content . lower () ] return results if results else [{ " message " : f " No notes found for ' { query } '" }] if __name__ == " __main__ " : mcp . run () That's the enti
Continue reading on Dev.to Tutorial
Opens in a new tab



