Connect LiveKit or your own agent
Any MCP client that speaks Streamable HTTP can use Autonex. Just send the Authorization: Bearer mk_… header with every request. The server is stateless: every request is authenticated on its own. The basics (limits, confirmations, security) are in Essentials.
LiveKit Agents (Python)
import os
from livekit.agents import Agent, AgentSession, mcp
session = AgentSession(
# ... stt, llm, tts, vad ...
mcp_servers=[
mcp.MCPServerHTTP(
url="https://mcp.autonexhub.es/mcp",
headers={"Authorization": f"Bearer {os.environ['AUTONEX_MCP_KEY']}"},
),
],
)For a customer-facing voice agent, use a key with minimal scopes and ask for verbal confirmation before calling confirm_action.
TypeScript (official MCP SDK)
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
const client = new Client({ name: 'my-agent', version: '1.0.0' });
await client.connect(new StreamableHTTPClientTransport(new URL('https://mcp.autonexhub.es/mcp'), {
requestInit: { headers: { Authorization: `Bearer ${process.env.AUTONEX_MCP_KEY}`, 'Accept-Language': 'en' } },
}));
const { tools } = await client.listTools();
const me = await client.callTool({ name: 'whoami', arguments: {} });
console.log(me.structuredContent);Python (official MCP SDK)
With mcp 2.x the headers go on the HTTP client:
import asyncio, os
import httpx2
from mcp import Client
from mcp.client.streamable_http import streamable_http_client
async def main() -> None:
headers = {"Authorization": f"Bearer {os.environ['AUTONEX_MCP_KEY']}"}
async with httpx2.AsyncClient(headers=headers) as http_client:
async with Client(streamable_http_client("https://mcp.autonexhub.es/mcp", http_client=http_client)) as client:
result = await client.call_tool("whoami", {})
print(result.structured_content)
asyncio.run(main())With mcp 1.x:
import asyncio, os
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
async def main():
headers = {"Authorization": f"Bearer {os.environ['AUTONEX_MCP_KEY']}"}
async with streamablehttp_client("https://mcp.autonexhub.es/mcp", headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
result = await session.call_tool("whoami", {})
print(result.structuredContent)
asyncio.run(main())A full example with preview and confirmation is in Coding agents → Build your own agent.
With curl
curl -s https://mcp.autonexhub.es/mcp \
-H "Authorization: Bearer $AUTONEX_MCP_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"whoami","arguments":{}}}'What every tool returns
Every response has two parts:
structuredContent: the data as JSON, with the schema documented on each tool's page (field names are in English and stable).content[0].text: a short summary in the requested language, meant to be shown in a chat.
When something fails, the response has isError: true, a text with the code (for example FORBIDDEN: …) and _meta.error with { code, message, … }. See the error codes.