Skip to content

Introduce initial mcp-bench Python package with MCP benchmarking API and CLI - #1

Draft
haesleinhuepf with Copilot wants to merge 2 commits into
mainfrom
copilot/create-mcp-bench-package
Draft

Introduce initial mcp-bench Python package with MCP benchmarking API and CLI#1
haesleinhuepf with Copilot wants to merge 2 commits into
mainfrom
copilot/create-mcp-bench-package

Conversation

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown

This PR bootstraps mcp-bench as a pip-installable package with both a Python API and a CLI for benchmarking MCP-driven tool-calling via OpenAI-compatible endpoints (including local Ollama). It adds structured benchmark outputs that capture full run traces (chat history, tool calls, arguments, and tool results), plus repeat/temperature experiment controls and dataframe conversion utilities.

  • Packaging and distribution

    • Added pyproject.toml-based packaging (mcp-bench), src/ layout, and CLI entrypoint:
      • mcp-bench = mcp_bench.cli:main
    • Added optional dataframe extra dependency:
      • mcp-bench[dataframe]pandas
  • Core benchmarking API

    • Added MCPConfig + load_mcp_config(...) to load MCP JSON configs and normalize function/tool specs into OpenAI tool format.
    • Added MCPBenchRunner with:
      • run_prompt(prompt, repeats, temperature)
      • run_experiment(prompts, repeats, temperature)
    • Added structured result models:
      • PromptRunResult (prompt/model/temperature/final response/chat history/tool calls)
      • ToolCallRecord (function name/arguments/result)
    • Added robust handling for malformed tool-call argument JSON and non-JSON-serializable tool results.
  • CLI surface

    • Added CLI for running experiments from MCP config:
      • --config, --model, repeated --prompt, --repeats, --temperature, --base-url, --api-key, --output
    • Emits benchmark results as JSON (stdout or file).
  • Dataframe utility

    • Added results_to_dataframe(results) to convert benchmark runs into analysis-friendly tabular output, including serialized tool-call records.
from mcp_bench import MCPBenchRunner, load_mcp_config, results_to_dataframe

config = load_mcp_config("mcp-config.json")
runner = MCPBenchRunner(model="llama3.1", config=config)
results = runner.run_prompt("What is 1+2?", repeats=5, temperature=0.2)
df = results_to_dataframe(results)
Original prompt

I need a pip-installable python package (having a pyproject.toml) for a new software named mcp-bench .
It has a command line interface and a Python API. It allows loading a Model-Context-Protocol JSON configuration and uses the openai Python API to call language models (locally, using ollama) and makes function calls to the functions defined in the MCP config. Overall goal is benchmarking how often a given LLM calls the correct functions. Hence, when the user prompts something and my tool calls some functions via MCP, we need a result object not just containing the final result of the LLM but also the chat history, called functions, parameters and the results of these calls. The user can also define how often to test a given prompt, temperature etc. Hence the result of such a prompt-experiment is a list of result objects as explained above. For convenience we have utility function for convrting such a list of results to a pandas dataframe.

Copilot AI changed the title [WIP] Add mcp-bench Python package with CLI and API Introduce initial mcp-bench Python package with MCP benchmarking API and CLI Jul 17, 2026
Copilot AI requested a review from haesleinhuepf July 17, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants