Skip to content

Commit f84de29

Browse files
author
Akangsha Goel
committed
refactor(mcp-readability): fold endpoint_url into tools_source
Per review: an endpoint's source is now defined entirely by tools_source — the http URL lives in tools_source.url. Drop the top-level endpoint_url fallback from the http fetch (and its docstring/test); identity is (product_name, endpoint_type).
1 parent a21ec5e commit f84de29

3 files changed

Lines changed: 19 additions & 17 deletions

File tree

datasets/mcp_readability/endpoints.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ endpoints:
2020
endpoint_type: DEV
2121
tools_source:
2222
type: stdio
23+
# MCP Toolbox for Databases, run over stdio via its npm wrapper.
2324
command: "npx"
24-
args: ["-y", "<toolbox-package>", "--prebuilt", "bigquery", "--stdio"]
25-
# env: { ... } # optional process env (creds, config)
25+
args: ["-y", "@toolbox-sdk/server", "--prebuilt=bigquery", "--stdio"]
26+
# Needs BigQuery credentials in the environment (ADC + project), e.g.:
27+
# env:
28+
# BIGQUERY_PROJECT: "your-gcp-project"
2629

2730
- product_name: "Sample (offline)"
2831
endpoint_type: DEV

evalbench/generators/models/mcp_tools.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
The source is pluggable per endpoint via ``tools_source.type``. The type names
99
the *transport*, not the protocol -- ``http`` and ``stdio`` both speak MCP:
1010
- ``http``: live MCP ``tools/list`` over Streamable HTTP using the official
11-
``mcp`` Python SDK. The fetch URL is ``tools_source.url`` (falling back to
12-
the endpoint's ``endpoint_url``). No authentication is configured -- the
13-
public endpoints are reached unauthenticated; auth can be added back later
14-
if a future endpoint requires it.
11+
``mcp`` Python SDK. The fetch URL is ``tools_source.url``. No authentication
12+
is configured -- the public endpoints are reached unauthenticated; auth can
13+
be added back later if a future endpoint requires it.
1514
- ``stdio``: launch a local MCP server via a command and speak MCP over its
1615
stdio pipes (official ``mcp`` SDK). The process is started before fetching,
1716
``tools/list`` is called, then it is shut down. For local / command-launched
@@ -74,7 +73,7 @@ def fetch_tools(self, endpoint: dict) -> tuple[list[mcp_types.Tool], str]:
7473
if source_type == "file":
7574
tools = self._from_file(source)
7675
elif source_type == "http":
77-
tools = self._from_http(source, endpoint)
76+
tools = self._from_http(source)
7877
elif source_type == "stdio":
7978
tools = self._from_stdio(source)
8079
else:
@@ -112,12 +111,10 @@ def sanitize_url(url: str) -> str:
112111
# ------------------------------------------------------------------
113112
# http source (official SDK over Streamable HTTP, no auth)
114113
# ------------------------------------------------------------------
115-
def _from_http(self, source: dict, endpoint: dict) -> list[mcp_types.Tool]:
116-
raw_url = source.get("url") or endpoint.get("endpoint_url")
114+
def _from_http(self, source: dict) -> list[mcp_types.Tool]:
115+
raw_url = source.get("url")
117116
if not raw_url:
118-
raise McpToolsError(
119-
"tools_source.type 'http' requires a 'url' (or endpoint_url)"
120-
)
117+
raise McpToolsError("tools_source.type 'http' requires a 'url'")
121118
url = self.sanitize_url(raw_url)
122119
try:
123120
return anyio.run(functools.partial(self._async_fetch_tools, url))

evalbench/test/mcp_tools_test.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,20 @@ def test_sanitize_url_preserves_existing_mcp_suffix(self):
107107
)
108108

109109
# ---- http source (mocked, no network) -----------------------------
110-
def test_http_source_defaults_url_to_endpoint_url(self):
110+
def test_http_source_uses_tools_source_url(self):
111111
captured = {}
112112

113-
def fake_from_http(source, endpoint):
114-
captured["url"] = source.get("url") or endpoint.get("endpoint_url")
113+
def fake_from_http(source):
114+
captured["url"] = source.get("url")
115115
return [
116116
mcp_types.Tool(name="t", description="d", inputSchema={})
117117
]
118118

119119
endpoint = {
120-
"endpoint_url": "https://svc.googleapis.com/mcp",
121-
"tools_source": {"type": "http"},
120+
"tools_source": {
121+
"type": "http",
122+
"url": "https://svc.googleapis.com/mcp",
123+
},
122124
}
123125
with patch.object(self.gen, "_from_http", side_effect=fake_from_http):
124126
tools, man_page = self.gen.fetch_tools(endpoint)

0 commit comments

Comments
 (0)