1. Updates docs to prefer `uv run server.py` instead of `arcade mcp` or `python -m arcade_mcp_server` 2. Found a bug with running stdio servers while updating the docs, so i snuck that in this PR
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
00_hello_world.py - The simplest possible MCP server
|
|
|
|
This example shows the absolute minimum code needed to create an MCP server
|
|
with a single tool using arcade-mcp-server with direct Python execution.
|
|
|
|
To run:
|
|
uv run 00_hello_world.py # HTTP transport (default)
|
|
uv run 00_hello_world.py stdio # stdio transport for Claude Desktop
|
|
"""
|
|
|
|
import sys
|
|
from typing import Annotated
|
|
|
|
from arcade_mcp_server import MCPApp
|
|
|
|
# Create the MCP application
|
|
app = MCPApp(
|
|
name="hello_world", version="1.0.0", instructions="A simple MCP server with a greeting tool"
|
|
)
|
|
|
|
|
|
@app.tool
|
|
def greet(name: Annotated[str, "Name of the person to greet"]) -> Annotated[str, "Welcome message"]:
|
|
"""Greet a person by name with a welcome message."""
|
|
return f"Hello, {name}! Welcome to Arcade MCP."
|
|
|
|
|
|
if __name__ == "__main__":
|
|
# Check if stdio transport was requested
|
|
transport = "stdio" if len(sys.argv) > 1 and sys.argv[1] == "stdio" else "http"
|
|
|
|
print(f"Starting {app.name} v{app.version}")
|
|
print(f"Transport: {transport}")
|
|
|
|
# Run the server
|
|
app.run(transport=transport, host="127.0.0.1", port=8000)
|