Testing MCP tools in process
Save the complete module below as tests/integration/test_greeting_mcp.py in your generated project (create the directories if necessary). Its server declaration is local to the test: it does not require adding an HTTP route or running a separate MCP server.
The MCP client sends encoded JSON-RPC through the real dispatcher and opens a new scope for each call. It integrates the protocol and container without sockets. It does not replace testing an HTTP proxy, allowed origin, or stdio transport. The following server declaration belongs in the test module and runs through the Orionis runner.
Examples
Section titled “Examples”Exercise a real MCP tool
Section titled “Exercise a real MCP tool”from orionis.mcp import McpResponse, Server, Toolfrom orionis.schemas import Schemafrom orionis.test import TestCase
class GreetingInput(Schema): name: str
class HelloTool(Tool[GreetingInput]): name = "hello"
def handle(self, payload: GreetingInput) -> McpResponse: return McpResponse.text(f"Hello, {payload.name}")
class GreetingServer(Server): name = "greetings" tools = (HelloTool,)
class TestGreetingServer(TestCase): async def testHello(self) -> None: client = await self.mcp(GreetingServer) response = await client.tool("hello", {"name": "Ada"}) response.assertOk() response.assertTextContains("Hello, Ada")Run and interpret the test
Section titled “Run and interpret the test”uv run python -B reactor test --start-dir tests/integration --file-pattern "test_greeting_mcp.py"Expect one passing test and exit code 0. assertOk() rejects JSON-RPC errors and tool results marked isError=True; assertTextContains() checks the returned text content. The tool must return McpResponse, not a raw Python dictionary or string. To test an existing application tool, import its real server class instead of declaring the example server and call the tool with representative input.
Inspect an HTTP server in the browser
Section titled “Inspect an HTTP server in the browser”Use Orionis MCP Inspector to check a deployed HTTP endpoint alongside your in-process tests. The inspector runs entirely in your browser and sends requests directly to the endpoint you choose, without an intermediary proxy. It supports stateless MCP 2026-07-28; it does not launch STDIO processes.
- Publish your server using the HTTP transport.
- Check that MCP’s
allowed_originsincludeshttps://inspector.orionis-framework.com. The editableconfig/mcp.pyin 1.0.16 supplies this default only whenCORS_ALLOW_ORIGINSis unset. In an existing application, update that local configuration or set the environment variable as shown below; upgrading the package does not rewrite your editable file. - Configure HTTP CORS to allow the same origin,
POST, and the headers required by your requests, including MCP headers and authentication when used. The browser handles theOPTIONSpreflight; the server must answer it without requiring the POST’s credentials. - Open the inspector, enter your endpoint, configure authentication if needed, and connect to discover the server’s capabilities.
- Run Run All Safe Tests to collect protocol and schema diagnostics, coverage, and observed request latency. This action does not automatically call tools. Execute a tool manually only after reviewing its arguments and possible effects.
- Inspect request and response details, then export a JSON, HTML, or PDF report generated locally in the browser.
To select the inspector explicitly through the shared environment variable:
CORS_ALLOW_ORIGINS=["https://inspector.orionis-framework.com"]This replaces the default list; include any other trusted browser origins you need. Use only the origin, without a trailing slash or /es/ path, regardless of the inspector’s language. HTTP CORS accepts "*", but MCP rejects that wildcard as invalid configuration. An explicit [] rejects every MCP request carrying Origin; requests without that header remain allowed by the origin check. See MCP configuration for defaults and validation.
A browser network error can indicate CORS, DNS, TLS, or another connectivity problem; it does not establish that the MCP server is invalid. A successful cURL request also does not verify CORS. Review the coverage and production readiness status: Not Verified means there is insufficient evidence, even if some checks passed. Browser latency includes the network and client, not only server processing.