home / mcp / agent mcp server

Agent MCP Server

Provides an MCP server exposing data fetch and sandbox execution as tools, plus a REST API for manual interactions.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "ariascarlet132-sandbox_mcp": {
      "url": "http://127.0.0.1:8000",
      "headers": {
        "APP_ID": "agent/agent",
        "MCP_HOST": "0.0.0.0",
        "MCP_PORT": "9000",
        "REST_HOST": "127.0.0.1",
        "REST_PORT": "8000",
        "APP_SECRET": "YOUR_SECRET",
        "SANDBOX_DIR": "/path/to/sandbox_storage"
      }
    }
  }
}

Agent Data Bridge is a lightweight service that bridges data sources with an execution sandbox and exposes capabilities as MCP tools. It lets agents fetch data from a remote data source via a secure two-step OAuth flow, parses results into a convenient data frame, and provides a sandboxed Python execution entrypoint for running scripts in a controlled sandbox directory. Its MCP transport makes these capabilities accessible to MCP clients as standard tools.

How to use

You will interact with the MCP server through an MCP client to fetch data and run sandboxed code. Start by calling the data fetch capability to retrieve results or generate a parquet snapshot for large results, then use the sandbox tool to execute Python code in the sandbox environment. When you fetch data, you provide the remote host, user identity, SQL, and dataset; you will receive either a full Markdown table or a summarized parquet-based preview depending on the result size. You can chain these tools by first generating a parquet and then loading it locally for quick inspection.

Key workflows you will use include: 1) fetching data from a remote host and obtaining a structured preview or a dataset snapshot, 2) running a Python script inside the sandbox with a fixed working directory, respecting timeouts and output limits, and 3) listing or loading the sandboxed files for inspection. Each tool is exposed as an MCP endpoint, so you can compose them within your MCP client workflows.

How to install

Prerequisites you need before installation: Python 3.12 or newer and a tool to manage dependencies (recommended: uv). Ensure your environment has network access to pull dependencies and run the FastAPI app and MCP server.

Step-by-step setup to run the HTTP API and optional MCP server in parallel:

uv sync

# Start the HTTP API (FastAPI) only
uv run -- uvicorn app.main:app --reload --app-dir src

# Start both REST API and MCP server in one command
uv run -- python -m app.run_all

MCP server start options

If you prefer to expose the server as an MCP service over SSE, you can run the MCP server component separately. The MCP server listens by default on 0.0.0.0:9000 and communicates via SSE. Use the following approach to start it with the appropriate environment and path settings.

For Windows PowerShell users, set the Python path and start the MCP server with the runtime command:

$env:PYTHONPATH = "src"
uv run -- python -m app.mcp_server

Configuration and security

Configuration is driven by environment variables. Commonly used variables include REST_HOST, REST_PORT for the REST API, MCP_HOST, MCP_PORT for the MCP SSE endpoint, and APP_ID / APP_SECRET for OAuth2 client credentials. The sandbox directory and related paths can be customized through SANDBOX_DIR and related settings. The OAuth2 client credentials are read from APP_ID and APP_SECRET, with defaults set to agent/agent in the implementation.

Sandbox execution is designed to be lightweight and non-isolated. It fixes the working directory to SANDBOX_DIR and enforces timeouts and output-length truncation to mitigate long-running or verbose executions. Do not expose the sandbox execution endpoint to untrusted public networks without proper access control.

Notes and examples

The data-fetch flow extracts the first Markdown table from the remote data response and formats it as a DataFrame. If the table has 15 rows or fewer, you receive the full Markdown; if it has more than 15 rows, a parquet file is saved to SANDBOX_DIR and a summary is returned.

The available MCP tools include: fetch_data, sandbox_run, and sandbox_list_files. You can use fetch_data to generate a parquet file name, then read the parquet file with a local data analysis tool to preview your data.

Troubleshooting tips

If you encounter a module import error when starting the MCP server in Windows, ensure you set PYTHONPATH to the src directory before launching the server.

If the REST API fails to start or you do not see the expected endpoints, verify that the app is launched with the correct app directory and that the environment variables (REST_HOST, REST_PORT, MCP_HOST, MCP_PORT) are set as intended.

Available tools

fetch_data

Fetches data from a specified host using given SQL and dataset, handles markdown parsing and either returns a markdown table for small results or saves large results as parquet in the sandbox and returns a summary.

sandbox_run

Executes Python code inside the sandbox directory with optional filename, returning exit code, stdout, and stderr.

sandbox_list_files

Lists files available in the sandbox storage.