tavily_fastmcp.server

FastMCP server factory for Tavily FastMCP.

Purpose:

Build a discoverable FastMCP server exposing typed Tavily-backed tools, prompt catalogs, profile catalogs, static resources, and dynamic resource templates.

Design:
  • Accept a service dependency so tests can inject a fake backend.

  • Publish tool, prompt, and resource metadata with tags and custom meta.

  • Keep prompt markdown as package data and surface it through MCP.

Examples

>>> callable(create_server)
True

Attributes

Functions

_build_catalog(→ tavily_fastmcp.models.ServerCatalog)

create_server(→ Any)

Create a configured FastMCP server instance.

build_arg_parser(→ argparse.ArgumentParser)

Build the CLI argument parser.

main(→ None)

Run the MCP server from the command line.

Module Contents

tavily_fastmcp.server.PACKAGE_NAME = 'tavily-fastmcp'[source]
tavily_fastmcp.server.PACKAGE_VERSION = '0.3.0'[source]
tavily_fastmcp.server.SERVER_NAME = 'Tavily FastMCP'[source]
tavily_fastmcp.server.ROUTER_PROMPT_NAME = 'router'[source]
tavily_fastmcp.server._build_catalog() tavily_fastmcp.models.ServerCatalog[source]
tavily_fastmcp.server.create_server(*, settings: tavily_fastmcp.settings.Settings | None = None, service: tavily_fastmcp.service.TavilyServiceProtocol | None = None) Any[source]

Create a configured FastMCP server instance.

Parameters:
  • settings – Optional validated settings object.

  • service – Optional Tavily service implementation for dependency injection in tests.

Returns:

A configured FastMCP server instance.

Raises:

RuntimeError – If FastMCP is not installed.

Examples

>>> callable(create_server)
True
tavily_fastmcp.server.build_arg_parser() argparse.ArgumentParser[source]

Build the CLI argument parser.

Returns:

A configured ArgumentParser instance.

Raises:

RuntimeError – Never raised intentionally.

Examples

>>> parser = build_arg_parser()
>>> parser.prog
'tavily-fastmcp'
tavily_fastmcp.server.main() None[source]

Run the MCP server from the command line.

Returns:

None.

Raises:

RuntimeError – If FastMCP is unavailable.

Examples

>>> callable(main)
True