A quick intro to using FastMCP to generate an MCP server.
makemake run-httpmake testClaude Code supports MCP server configuration at different scopes. For this project, we'll use local scope so the server is only loaded when working in this directory.
From this project directory, run:
claude mcp add --transport stdio fastmcp-101 --scope local -- uv run main.pyThis command:
- Configures the server for this project only (not globally)
- Automatically uses the current directory as the working directory
- Stores the configuration in project-specific user settings
After adding the server, restart Claude Code to load it.
In Claude Code, you can test the server by asking:
Use the greet tool to say hello to Alice
Claude Code will automatically connect to your MCP server and use the greet tool defined in main.py:12-16.
# List all configured MCP servers
claude mcp list
# Get details for this server
claude mcp get fastmcp-101
# Remove this server
claude mcp remove fastmcp-101 -s local- Local scope (recommended) - Project-specific, only loaded in this directory
- Project scope - Shared via
.mcp.jsonfile (committed to repo) - User scope - Global across all projects
When you run claude mcp add with --scope local, it updates your .claude.json file in your home directory (~/.claude.json).
The configuration is stored under a project field, with project-specific settings keyed by the project's path. This structure includes:
- Server transport settings - How to start the MCP server (type, command, args, env)
- Allowed tools - List of tools that can be used without user approval
- MCP context URIs - Resources that provide additional context
Example structure in ~/.claude.json:
{
"project": {
"/Users/username/projects/python/python-fastmcp-101": {
"allowedTools": [],
"mcpContextUris": [],
"mcpServers": {
"fastmcp-101": {
"type": "stdio",
"command": "uv",
"args": ["run", "main.py"],
"env": {}
}
}
}
}
}Claude Code checks the current working directory and only loads MCP servers configured for that specific project path. This ensures project-specific servers don't interfere with other projects.
- Server not appearing: Run
claude mcp listto verify it's configured - Connection errors: Ensure
uvis installed (brew install uv) - Tool not found: Check Claude Code logs for startup errors
brew install uvuv initThis will create the necessary project structure including:
- pyproject.toml - Project configuration file
- README.md (will be updated)
- .python-version - Python version specification
- Basic project structure
uv add fastmcpuv run fastmcp versionuv shell
fastmcp version
exitif you need to work in the virtual environment interactively:
uv syncsource .venv/bin/activatefastmcp versiondeactivate