Todd Wolven
Theme

MCP-Codex: Model Context Protocol Tool Orchestration

By Todd Wolven · Updated 2025-04-12 · Source on GitHub

DISCLAIMER: This project was discontinued after Cloudflare released a similar service that addressed many of the same problems. I'm sharing this codebase as an educational resource and example of MCP orchestration architecture. While no longer actively developed, the concepts and implementations may still be valuable to those interested in AI tool orchestration. Please see Cloudflare's new Remote MCP service and their blogpost announcement here: https://blog.cloudflare.com/remote-model-context-protocol-servers-mcp/

License

A service for orchestrating Model Context Protocol (MCP) servers and allowing AI assistants to dynamically discover and utilize tools without requiring restarts, powered by "The Librarian" - an intelligent agent that understands user needs and connects them with the perfect tools.

Overview

MCP-Codex solves a core problem with the Model Context Protocol ecosystem: the need to restart AI assistants when adding new tools. It enables dynamic tool discovery and execution through a central service, allowing AI assistants to use any compatible MCP tool on demand.

The Librarian: Intelligent Tool Discovery

At the heart of MCP-Codex is "The Librarian" - an intelligent agent designed to understand user needs and connect them with the right tools. The Librarian functions as an agentic RAG (Retrieval-Augmented Generation) system with:

The Librarian effectively serves as a universal adapter between user intent and technical capabilities, eliminating the cognitive load of tool selection for both users and AI assistants.

The Problem

Model Context Protocol (MCP) is a powerful standard for connecting AI assistants to external tools and data sources. However, traditional MCP implementations have a significant limitation:

The Solution

MCP-Codex provides a bridge between AI assistants and the broader MCP ecosystem by offering:

  1. Intelligent Tool Discovery: The Librarian service analyzes user intent and recommends the perfect tools
  2. Dynamic Tool Management: Tools can be installed, configured, and executed on-demand
  3. Remote Execution: Tools can run anywhere, not just on the local machine
  4. Centralized Management: Tools can be added, updated, or removed without restarting assistants
  5. Standardized Protocol: A consistent interface for interacting with any MCP tool

Architecture

The project consists of three main components:

  1. Codex Service (codex-serv.py): The core execution service that manages tool discovery and invocation
  2. Librarian Service (planned): An AI-powered tool recommendation system
  3. MCP Client (mcp-codex.py): The MCP-compatible interface for AI assistants

How It Works

  1. The AI assistant connects to the MCP-Codex client
  2. The client presents two main tools: search and call_tool
  3. The assistant can search for capabilities using natural language
  4. Once a tool is identified, it can be executed through a standardized call
  5. The Codex service handles the actual tool execution and returns results

Components

Codex Service

The central orchestration service that: - Manages the registry of available MCP tools - Handles tool execution requests - Routes requests to the appropriate tool subprocess - Manages tool lifecycle

MCP Client

The MCP-compliant interface that allows any MCP-compatible assistant to: - Connect to the Codex ecosystem - Search for available tools - Execute tools through a standardized interface

Included Tool Examples

The repository includes several example MCP tools:

Installation

Prerequisites

Setup

  1. Clone the repository:

    git clone https://github.com/your-username/mcp-codex.git
    cd mcp-codex

  2. Install dependencies:

    pip install -r requirements.txt

  3. Create required directories:

    mkdir -p config data logs tools

  4. Configure your environment:

    cp .env.example .env
    # Edit .env with your configuration

Usage

Starting the Codex Service

python codex-serv.py

Starting the MCP Client

python mcp-codex.py

Using with Claude Desktop

  1. Install the MCP Client in Claude Desktop:

    mcp install mcp-codex.py

  2. The client will register two tools: - search: Find relevant tools for your task - call_tool: Execute discovered tools

  3. Example usage in Claude:

    I need to analyze stock data for Apple. Can you help me find the right tool?

Roadmap

The project was planned to include several fully-realized components:

The Librarian (In-Depth)

The Librarian was envisioned as a sophisticated AI-powered tool orchestration system that would:

Additional Planned Features

Documentation

Tool Registry Configuration

Tools are defined in the config/codex.yaml file with the following structure:

tools:
  - name: tool_name
    description: Tool description
    server: path/to/tool/server.py
    methods:
      - method_name
    schemas:
      method_name:
        type: object
        properties:
          # Parameter definitions

API Endpoints

The Codex service provides the following REST endpoints:

Why This Project

This project was created to address several limitations in the current AI tool ecosystem:

  1. Enable True Agent Capabilities: Allow AI assistants to dynamically discover and use tools based on user needs
  2. Reduce Operational Complexity: Eliminate the need to restart AI services when adding new capabilities
  3. Centralize Tool Management: Provide a single point of control for tool deployment and updates
  4. Standardize Tool Interaction: Create a consistent interface for tool discovery and execution
  5. Support Remote Execution: Allow tools to run anywhere, not just on the local machine

Unfortunately, similar functionality was recently released by Cloudflare, making aspects of this project redundant. However, the codebase still provides valuable insights into MCP orchestration and dynamic tool discovery.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

This page is generated automatically from the GitHub README, which is the single source of truth.  ← Back to toddwolven.com