Overview

FastMCP is a high-level python framework for building Model Context Protocol (MCP) clients and servers with minimal boilerplate. Whether you’re developing tools that interact with language models or integrating external APIs via MCP, FastMCP simplifies the process with clean Python syntax and robust features. This guide walks you through integrating FastMCP with SambaCloud—letting you build custom MCP servers or connect to existing ones, enabling advanced orchestration, agent tooling, and function-calling use cases.

Prerequisites

  • A SambaCloud account
  • An API key from your SambaNova dashboard
  • Python 3.8 or later
  • Familiarity with Python virtual environments and terminal basics

Installation

  1. Set up a virtual environment
python -m venv .venv
source .venv/bin/activate
  1. Install required packages
pip install openai
pip install mcp
openai is used for compatibility with OpenAI-compatible APIs, including SambaNova’s API endpoints.

Usage

You can use FastMCP to either:
  • Start a custom MCP server
  • Connect to an existing server (like one powered by a SambaNova model)
Here’s a minimal example using a SambaNova-compatible model:
from mcp.server.fast import FastMCPServer

app = FastMCPServer(model="sambanova/falcon-rw-7b-instruct")

@app.tool()
def get_weather(location: str) -> str:
    return f"The weather in {location} is sunny."

app.run()
@app.tool() is a decorator that exposes functions as callable tools via MCP. You can register multiple tools and handle complex inputs with type annotations.

Use Cases

  • Enable tool use and function calling with SambaNova models
  • Build multi-agent systems and orchestration frameworks
  • Integrate external APIs and tools into LLM workflows
  • Serve lightweight custom agents with decorator-based handlers

Resources