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
-
Install the MCP server package:
-
Add configuration:
- Restart ARKOS - the server will be auto-discovered
Best Practices
- Use stdio for local tools: Better security and isolation
- Use HTTP for shared services: Better for multi-user deployments
- Handle auth errors gracefully: Show users how to connect services
- Set reasonable timeouts: Prevent hanging on slow tools
- Log tool calls: Helps with debugging and monitoring
Troubleshooting
MCP server not starting
MCP server not starting
Check that the command exists and has correct permissions:
Tool not found
Tool not found
Verify the tool is registered:
Authentication errors
Authentication errors
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