Get started with your first GolfMCP project from scratch.
Install GolfMCP
Initialize your project
init
command:my_awesome_server
with the following structure:golf.json
: Configures your server’s name, port, transport, etc..env
: Stores environment-specific variables (automatically created).tools/
, resources/
, prompts/
: Directories where you’ll define your server’s capabilities.pre_build.py
: An optional script for custom logic before building, often used for authentication setup.Set up authentication
http://127.0.0.1:3000
http://127.0.0.1:3000/auth/callback
.env
file:
Create your first tool
tools/hello.py
:Annotated
with Field
to provide descriptions for each parameter. This helps AI agents understand how to use your tool effectively.Output
class defines the structure of the response using Pydantic.export = hello
line tells Golf which function to expose as the tool.Build for development
dist/
directory containing the runnable server (server.py
) and any necessary supporting files (like auth components).dev
builds, it copies your .env
file to the dist/
directory, making environment variables available to the server.Run your server
Connect to Claude or Cursor
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
Troubleshooting authentication errors