mcp.servers.example_server_fastmcpΒΆ

Example MCP server using FastMCP for haive-dataflow integration.

AttributesΒΆ

FunctionsΒΆ

code_review_prompt(β†’ list[dict[str, str]])

Generate a code review prompt.

list_directory(β†’ list[str])

List files in a directory.

read_file(β†’ str)

Read contents of a file.

read_file_resource(β†’ str)

Resource handler for reading files.

refactor_prompt(β†’ list[dict[str, str]])

Generate a refactoring prompt.

search_files(β†’ dict[str, list[str]])

Search for a term in files within a directory.

write_file(β†’ str)

Write content to a file.

Module ContentsΒΆ

async mcp.servers.example_server_fastmcp.code_review_prompt(code: str, language: str = 'python') list[dict[str, str]]ΒΆ

Generate a code review prompt.

Parameters:
  • code – Code to review

  • language – Programming language of the code

Returns:

List of prompt messages

async mcp.servers.example_server_fastmcp.list_directory(path: str = '.', pattern: str = '*') list[str]ΒΆ

List files in a directory.

Parameters:
  • path – Directory path to list (default: current directory)

  • pattern – Glob pattern to filter files (default: *)

Returns:

List of file paths matching the pattern

async mcp.servers.example_server_fastmcp.read_file(path: str) strΒΆ

Read contents of a file.

Parameters:

path – Path to the file to read

Returns:

Contents of the file

async mcp.servers.example_server_fastmcp.read_file_resource(path: str) strΒΆ

Resource handler for reading files.

Parameters:

path – Path to the file

Returns:

File contents

async mcp.servers.example_server_fastmcp.refactor_prompt(code: str, goal: str, language: str = 'python') list[dict[str, str]]ΒΆ

Generate a refactoring prompt.

Parameters:
  • code – Code to refactor

  • goal – Goal of the refactoring

  • language – Programming language

Returns:

List of prompt messages

async mcp.servers.example_server_fastmcp.search_files(directory: str, search_term: str, file_pattern: str = '*.py') dict[str, list[str]]ΒΆ

Search for a term in files within a directory.

Parameters:
  • directory – Directory to search in

  • search_term – Term to search for

  • file_pattern – Pattern for files to search (default: *.py)

Returns:

Dictionary mapping file paths to list of matching lines

async mcp.servers.example_server_fastmcp.write_file(path: str, content: str) strΒΆ

Write content to a file.

Parameters:
  • path – Path to the file to write

  • content – Content to write to the file

Returns:

Success message or error

mcp.servers.example_server_fastmcp.loggerΒΆ
mcp.servers.example_server_fastmcp.mcpΒΆ