Skip to main content

Tool Module Overview

The ARKOS Tool Module implements the Model Context Protocol (MCP) for connecting to external tool servers, enabling agents to interact with calendars, search engines, and other services.

What is MCP?

The Model Context Protocol (MCP) is a standard for AI systems to communicate with external tools via JSON-RPC 2.0. ARKOS supports both stdio and HTTP transports.
ARKOS tools follow the MCP specification, allowing seamless integration with any MCP-compatible server.

Architecture

Core Components

MCPClient

Manages a single MCP server connection:

MCPToolManager

Coordinates multiple MCP server connections:

Transport Types

Stdio Transport

Launches MCP servers as subprocesses:

HTTP Transport

Connects to MCP servers over HTTP:

MCP Protocol

Initialization Handshake

Tool Discovery

Tool Execution

Per-User Authentication

Some tools (like Google Calendar) require per-user OAuth authentication.

Services Requiring Auth

AuthRequiredError

When a user hasn’t authenticated:

UserTokenStore

Manages OAuth tokens per user:

User Service Status

Check which services a user has connected:

Configuration

YAML Configuration

Environment Variables

Integration with Agent

The Agent receives tools on startup:

System Prompt Format

Error Handling

Connection Errors

Tool Execution Errors

Lifecycle Management

Graceful Shutdown

Adding New MCP Servers

  1. Install the MCP server package:
  2. Add configuration:
  3. Restart ARKOS - the server will be auto-discovered

Best Practices

  1. Use stdio for local tools: Better security and isolation
  2. Use HTTP for shared services: Better for multi-user deployments
  3. Handle auth errors gracefully: Show users how to connect services
  4. Set reasonable timeouts: Prevent hanging on slow tools
  5. Log tool calls: Helps with debugging and monitoring

Troubleshooting

Check that the command exists and has correct permissions:
Verify the tool is registered:
Check user token status:

Next Steps

Agent Module

Learn about agent orchestration

Base Module

Explore the API server

Memory Module

Understand memory systems

Development Setup

Set up your environment