Your First Hyperia App
Quickstart
Welcome! This guide walks you through spinning up your first Hyperia MCP server in a few lines of code. If you haven’t installed the library yet, head back to the Installation page.
1 · Create a Hyperia Server
A Hyperia server is simply a Python file that instantiates the Hyperia class and then registers MCP components (tools, resources, prompts…). Create my_server.py:
from hyperia import Hyperia
mcp = Hyperia("My MCP Server")At this point you have a valid MCP server.
2 · Add a Tool
Let’s make it useful by adding a greeting tool. Decorate any function with @mcp.tool() to register it:
from hyperia import Hyperia
mcp = Hyperia("My MCP Server")
@mcp.tool()
def greet(name: str) -> str:
return f"Hello, {name}!"3 · Test Locally with an In‑Process Client
Hyperia includes an async client you can point at any server instance. Append this to my_server.py or place it in a separate script:
Notes •
Clientis asynchronous, so we useasyncio.run. • Entering the client context (async with …) lets you make multiple calls on the same connection.
4 · Run the Server as a Script
Add a __main__ guard so the server can be launched with plain Python:
Then start it:
Why the if __name__ == "__main__": block? Including it ensures your server behaves consistently across shells, IDEs, and container runners—even when Hyperia’s CLI isn’t used.
5 · Interact from Another Process
Create a separate file my_client.py to demonstrate talking to a running server via stdio transport:
Hyperia recognizes the .py file as an MCP server and spawns it with python my_server.py under the hood.
6 · Using the Hyperia CLI
Prefer not to manage processes yourself? The CLI can run the server for you and keep it alive until terminated:
my_server.pyis the module path.mcpspecifies the server object. If omitted, Hyperia searches formcp,app, orserverautomatically.
The CLI ignores any __main__ guard and uses the faster internal runner. Additional transport and deployment options are covered in the Server Configuration guide.
Last updated