mcp.servers.example_server_fastmcpΒΆ
Example MCP server using FastMCP for haive-dataflow integration.
AttributesΒΆ
FunctionsΒΆ
|
Generate a code review prompt. |
|
List files in a directory. |
|
Read contents of a file. |
|
Resource handler for reading files. |
|
Generate a refactoring prompt. |
|
Search for a term in files within a directory. |
|
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ΒΆ