Skip to main content

MCP tools loader for Axio

Project description

axio-tools-mcp

PyPI Python License: MIT

Model Context Protocol (MCP) bridge for axio.

Connect any MCP server to your axio agent. Tools exposed by MCP servers are discovered at runtime and become first-class axio Tool instances — no manual wiring required.

Features

  • Dynamic tool discovery — connects to MCP servers and converts their tools into axio Tool instances automatically
  • Multiple servers — configure and run several MCP servers simultaneously
  • Lifecycle management — handles server startup, shutdown, and reconnection
  • TUI integration — ships a settings screen for managing MCP server configuration from within axio-tui

Installation

pip install axio-tools-mcp

Usage

With axio-tui (recommended)

pip install "axio-tui[mcp]"
uv run axio   # MCP Servers section appears in settings

Standalone

from axio_tools_mcp.registry import MCPRegistry
from axio.agent import Agent
from axio.context import MemoryContextStore
from axio_transport_openai import OpenAITransport

async def main() -> None:
    registry = MCPRegistry()
    await registry.init(config=None)

    tools = registry.all_tools   # list[axio.Tool]
    print(f"Loaded {len(tools)} tools from MCP servers")

    agent = Agent(
        system="You are a helpful assistant.",
        tools=tools,
        transport=OpenAITransport(api_key="sk-...", model="gpt-4o"),
    )
    result = await agent.run("Use the available tools to help me", MemoryContextStore())
    print(result)

    await registry.close()

Transport types

Two transport types are supported, selected by which field is set in the server config:

Transport Config field Protocol
stdio command Spawns a subprocess; communicates over stdin/stdout (MCP stdio transport)
HTTP url Connects to a running HTTP server using the MCP Streamable HTTP transport (httpx)

Exactly one of command or url must be set per server — providing both or neither raises a ValueError.

For stdio servers, stderr output from the subprocess is forwarded to the Python logger as warnings under the mcp:<server-name> prefix.

HTTP servers accept optional headers (e.g., for bearer tokens) and a configurable timeout (default: 30 seconds).

Tool naming

Tools from MCP servers are named using the pattern <server_name>__<tool_name>. For example, a server named filesystem that exposes a tool called read_file becomes filesystem__read_file in axio. The tool description is taken from the MCP tool's description field, falling back to the tool name if no description is provided.

Error handling

When an MCP server fails to connect or start, the error is logged at ERROR level and the server is skipped — no exception is raised to the caller. registry.all_tools will simply not include any tools from the failed server. The error message is accessible via registry.server_status(name) (returns "error") and the raw error string is stored internally.

Lifecycle: close()

Call await registry.close() when the agent session ends to disconnect all MCP server sessions and release resources (subprocess file descriptors, HTTP connections):

await registry.close()

MCP server configuration

MCP servers are configured via the axio-tui settings UI or programmatically:

stdio server (spawns a subprocess):

{
  "servers": [
    {
      "name": "filesystem",
      "command": ["npx", "-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
    },
    {
      "name": "github",
      "command": ["npx", "-y", "@modelcontextprotocol/server-github"],
      "env": {"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..."}
    }
  ]
}

HTTP server (connects to a running MCP HTTP endpoint):

{
  "servers": [
    {
      "name": "remote",
      "url": "https://my-mcp-server.example.com/mcp",
      "headers": {"Authorization": "Bearer my-token"},
      "timeout": 60.0
    }
  ]
}

Plugin registration

[project.entry-points."axio.tools.settings"]
mcp = "axio_tools_mcp.plugin:MCPPlugin"

Part of the axio ecosystem

axio · axio-tools-local · axio-tools-docker · axio-tui

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

axio_tools_mcp-0.6.2.tar.gz (69.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

axio_tools_mcp-0.6.2-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file axio_tools_mcp-0.6.2.tar.gz.

File metadata

  • Download URL: axio_tools_mcp-0.6.2.tar.gz
  • Upload date:
  • Size: 69.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for axio_tools_mcp-0.6.2.tar.gz
Algorithm Hash digest
SHA256 4fcb28b88a664f271f6e437c57e2f9388c553cbf2dde4e541a37113d0fbc8e6a
MD5 1118c7062cd57b87e589d257e339c5b6
BLAKE2b-256 606c3468b5f3643c337bf837c62ff180b6206fb3075fdb0109eef2d2505d07d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for axio_tools_mcp-0.6.2.tar.gz:

Publisher: publish.yml on axio-agent/monorepo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file axio_tools_mcp-0.6.2-py3-none-any.whl.

File metadata

  • Download URL: axio_tools_mcp-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for axio_tools_mcp-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 56896c744f6472e55cbbd80b2dfaddb3c53ff16c68124aab456576ab38c0d1b4
MD5 6bdea38c6481bf95927bc8e8f9573a7a
BLAKE2b-256 11d7e6034c11422ca012ceb5781b4925237fa47951c1bb955b21706d8c20f4bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for axio_tools_mcp-0.6.2-py3-none-any.whl:

Publisher: publish.yml on axio-agent/monorepo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page