1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635
|
From: Philip Hands <phil@hands.com>
Date: Mon, 1 Dec 2025 18:32:44 +0100
Subject: Revert "Add MCP support as an optional feature"
Forwarded: not-needed
This reverts commit e162f155e355d68d50e35a2158650a63ffca4a1d.
This is just to allow building while MCP is not yet in Debian.
---
dist/rpm/openQA.spec | 4 +-
docs/WritingTests.asciidoc | 75 -----------
etc/openqa/openqa.ini | 9 --
lib/OpenQA/Schema/ResultSet/Workers.pm | 23 ----
lib/OpenQA/Setup.pm | 3 -
lib/OpenQA/WebAPI/Controller/Admin/Workers.pm | 17 ++-
lib/OpenQA/WebAPI/Plugin/MCP.pm | 175 --------------------------
t/api/17-mcp.t | 161 ------------------------
t/config.t | 2 -
t/data/17-mcp/openqa.ini | 2 -
10 files changed, 12 insertions(+), 459 deletions(-)
delete mode 100644 lib/OpenQA/Schema/ResultSet/Workers.pm
delete mode 100644 lib/OpenQA/WebAPI/Plugin/MCP.pm
delete mode 100644 t/api/17-mcp.t
delete mode 100644 t/data/17-mcp/openqa.ini
diff --git a/dist/rpm/openQA.spec b/dist/rpm/openQA.spec
index 3b62160..91bfb12 100644
--- a/dist/rpm/openQA.spec
+++ b/dist/rpm/openQA.spec
@@ -222,7 +222,7 @@ Summary: Additional MCP package for AI support in openQA
Requires: %{mcp_requires}
%description mcp
-This package contains a plugin for AI support in openQA.
+This package contains additional resources for AI support in openQA.
%package client
Summary: Client tools for remote openQA management
@@ -644,7 +644,6 @@ fi
%{_datadir}/openqa/lib/OpenQA/Scheduler/
%{_datadir}/openqa/lib/OpenQA/Schema/
%{_datadir}/openqa/lib/OpenQA/WebAPI/
-%exclude %{_datadir}/openqa/lib/OpenQA/WebAPI/Plugin/MCP.pm
%{_datadir}/openqa/lib/OpenQA/WebSockets/
%{_datadir}/openqa/templates
%{_datadir}/openqa/public
@@ -865,6 +864,5 @@ fi
%endif
%files mcp
-%{_datadir}/openqa/lib/OpenQA/WebAPI/Plugin/MCP.pm
%changelog
diff --git a/docs/WritingTests.asciidoc b/docs/WritingTests.asciidoc
index 67d56cd..6be8c1f 100644
--- a/docs/WritingTests.asciidoc
+++ b/docs/WritingTests.asciidoc
@@ -1919,81 +1919,6 @@ SUSE distribution's serial terminal utility library). However some programs
ignore this, but piping there output into `tee` is usually enough to stop them
outputting non-printable characters.
-=== MCP Support
-
-The https://modelcontextprotocol.io/[Model Context Protocol] (MCP) is a standard
-that allows Large Language Models (LLMs) to interact with web services. MCP is
-supported natively by openQA, but still considered experimental, and therefore
-needs to be enabled manually in `openqa.ini`.
-
-[source,ini]
-----
-[global]
-mcp_enabled = read-only
-----
-
-Once enabled the experimental MCP endpoint becomes available under the path
-`/experimental/mcp`. At the moment all implemented MCP tools are read-only,
-that means LLMs can review infomation provided by openQA, but are unable to
-make changes or trigger actions. Once write operations become available
-with future updates, they will have to be enabled with a different setting
-in `openqa.ini` for security reasons.
-
-Most MCP clients today support Bearer token authentication, so that is what
-openQA relies on as well. More authentication mechanisms will be added as
-the technology evolves.
-
-This example configuration in the `mcp.json` format, which is commonly used
-by MCP clients, shows how to include an openQA personal access token by
-setting the `Authorization` HTTP header:
-
-[source,json]
-----
-{
- "mcpServers": {
- "openqa": {
- "url": "http://127.0.0.1:9526/experimental/mcp",
- "headers": {
- "Authorization": "Bearer USER:KEY:SECRET"
- }
- }
- }
-}
-----
-
-==== 3rd Party MCP Clients
-===== gemini-cli
-
-Once you have installed and set up
-https://github.com/google-gemini/gemini-cli[gemini-cli], you can use the
-`gemini mcp` command to add openQA:
-
-[source,shell]
-----
-gemini mcp add openqa http://127.0.0.1:9526/experimental/mcp -H 'Authorization: Bearer USER:KEY:SECRET' -t http
-----
-
-After restarting gemini-cli, it will automatically discover available openQA
-tools and make use of them on its own:
-
-[source]
-----
-╭────────────────────────────────────────────────────╮
-│ > give me a brief summary for openQA job 5265754 │
-╰────────────────────────────────────────────────────╯
-
- ╭───────────────────────────────────────────────────────────────────╮
- │ ✔ openqa_get_job_info (openqa MCP Server) openqa_get_job_info... │
- │ │
- │ ... │
- ╰───────────────────────────────────────────────────────────────────╯
-✦ Job 5265754 was a passed test named opensuse-Tumbleweed-DVD-x86_64-
- Build20250825-ltp_net_features@64bit. It ran on August 26, 2025,
- and took about 21 minutes to complete. The job tested the
- ltp_net_features test suite on the x86_64 architecture. Most of the
- tests passed, with a few being skipped.
-----
-
== Test Development tricks
=== Trigger new tests by modifying settings from existing test runs
diff --git a/etc/openqa/openqa.ini b/etc/openqa/openqa.ini
index d497547..c4909ba 100644
--- a/etc/openqa/openqa.ini
+++ b/etc/openqa/openqa.ini
@@ -41,12 +41,6 @@
## So don't enable this plugin in production.
#monitoring_enabled = 0
-## Set to read-only to enable MCP support
-## * A Model Context Protocol endpoint will be available to all users under
-## /experimental/mcp route.
-## * Do not enable this feature for openQA instances with special security requirements!
-#mcp_enabled = no
-
## space-separated list of extra plugins to load; plugin must be under
## OpenQA::WebAPI::Plugin and correctly-cased module name given here,
## this example loads OpenQA::WebAPI::Plugin::AMQP
@@ -326,9 +320,6 @@ concurrent = 0
#worker_limit_retry_delay = 900
## Maximum number of retries with exponential back-off for GruJobs to wait for a GruTask to appear in the database
#wait_for_grutask_retries = 6
-## Maximum size of MCP results in bytes (to prevent performance issues)
-# mcp_max_result_size = 500000
-## To encourage job scenarios with shorter runtime: If MAX_JOB_TIME is greater than
## DEFAULT_MAX_JOB_TIME, MAX_JOB_TIME divided by this number is added to the
## job priority. Can be 0 to disable and negative to prioritize long running job
## scenarios.
diff --git a/lib/OpenQA/Schema/ResultSet/Workers.pm b/lib/OpenQA/Schema/ResultSet/Workers.pm
deleted file mode 100644
index 399e7d8..0000000
--- a/lib/OpenQA/Schema/ResultSet/Workers.pm
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright SUSE LLC
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-package OpenQA::Schema::ResultSet::Workers;
-use Mojo::Base 'DBIx::Class::ResultSet', -signatures;
-
-sub stats ($self) {
- my $total = $self->count;
- my $total_online = grep { !$_->dead } $self->all();
- my $free_active_workers = grep { !$_->dead } $self->search({job_id => undef, error => undef})->all();
- my $free_broken_workers = grep { !$_->dead } $self->search({job_id => undef, error => {'!=' => undef}})->all();
- my $busy_workers = grep { !$_->dead } $self->search({job_id => {'!=' => undef}})->all();
-
- return {
- total => $total,
- total_online => $total_online,
- free_active_workers => $free_active_workers,
- free_broken_workers => $free_broken_workers,
- busy_workers => $busy_workers,
- };
-}
-
-1;
diff --git a/lib/OpenQA/Setup.pm b/lib/OpenQA/Setup.pm
index 00c33ba..8ccf07f 100644
--- a/lib/OpenQA/Setup.pm
+++ b/lib/OpenQA/Setup.pm
@@ -77,7 +77,6 @@ sub read_config ($app) {
max_rss_limit => 0,
profiling_enabled => 0,
monitoring_enabled => 0,
- mcp_enabled => 'no',
plugins => undef,
hide_asset_types => 'repo',
file_security_policy => 'download-prompt',
@@ -238,7 +237,6 @@ sub read_config ($app) {
max_online_workers => 1000,
wait_for_grutask_retries => 6, # exponential, ~4 minutes
worker_limit_retry_delay => ONE_HOUR / 4,
- mcp_max_result_size => 500000,
max_job_time_prio_scale => 100,
scheduled_product_min_storage_duration => 34,
},
@@ -414,7 +412,6 @@ sub load_plugins ($server, $monitoring_root_route = undef, %options) {
push @{$server->plugins->namespaces}, 'OpenQA::WebAPI::Plugin';
$server->plugin($_) for qw(Helpers MIMETypes CSRF REST Gru YAML);
$server->plugin('AuditLog') if $server->config->{global}{audit_enabled};
- $server->plugin('MCP') if $server->config->{global}{mcp_enabled} eq 'read-only';
# Load arbitrary plugins defined in config: 'plugins' in section
# '[global]' can be a space-separated list of plugins to load, by
# module name under OpenQA::WebAPI::Plugin::
diff --git a/lib/OpenQA/WebAPI/Controller/Admin/Workers.pm b/lib/OpenQA/WebAPI/Controller/Admin/Workers.pm
index 7eeef14..a0e0115 100644
--- a/lib/OpenQA/WebAPI/Controller/Admin/Workers.pm
+++ b/lib/OpenQA/WebAPI/Controller/Admin/Workers.pm
@@ -29,7 +29,12 @@ sub _extend_info ($w) {
sub index ($self) {
my $workers_db = $self->schema->resultset('Workers');
- my $worker_stats = $workers_db->stats;
+ my $total_online = grep { !$_->dead } $workers_db->all();
+ my $total = $workers_db->count;
+ my $free_active_workers = grep { !$_->dead } $workers_db->search({job_id => undef, error => undef})->all();
+ my $free_broken_workers
+ = grep { !$_->dead } $workers_db->search({job_id => undef, error => {'!=' => undef}})->all();
+ my $busy_workers = grep { !$_->dead } $workers_db->search({job_id => {'!=' => undef}})->all();
my %workers;
while (my $w = $workers_db->next) {
@@ -37,11 +42,11 @@ sub index ($self) {
$workers{$w->name} = _extend_info($w);
}
$self->stash(
- workers_online => $worker_stats->{total_online},
- total => $worker_stats->{total},
- workers_active_free => $worker_stats->{free_active_workers},
- workers_broken_free => $worker_stats->{free_broken_workers},
- workers_busy => $worker_stats->{busy_workers},
+ workers_online => $total_online,
+ total => $total,
+ workers_active_free => $free_active_workers,
+ workers_broken_free => $free_broken_workers,
+ workers_busy => $busy_workers,
is_admin => !!$self->is_admin,
workers => \%workers
);
diff --git a/lib/OpenQA/WebAPI/Plugin/MCP.pm b/lib/OpenQA/WebAPI/Plugin/MCP.pm
deleted file mode 100644
index 81ab014..0000000
--- a/lib/OpenQA/WebAPI/Plugin/MCP.pm
+++ /dev/null
@@ -1,175 +0,0 @@
-# Copyright SUSE LLC
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-package OpenQA::WebAPI::Plugin::MCP;
-use Mojo::Base 'Mojolicious::Plugin', -signatures;
-
-use MCP::Server;
-use Mojo::Template;
-use Mojo::Loader qw(data_section);
-use Mojo::File qw(path);
-
-sub register ($self, $app, $config) {
- my $mcp = MCP::Server->new;
- $mcp->name('openQA');
- $mcp->version('1.0.0');
-
- $mcp->tool(
- name => 'openqa_get_info',
- description => 'Get information about the openQA server, connected workers and the current user',
- code => \&tool_openqa_get_info
- );
-
- $mcp->tool(
- name => 'openqa_get_job_info',
- description => 'Get information about a specific openQA job',
- input_schema => {
- type => 'object',
- properties => {job_id => {type => 'integer', minimum => 1}},
- required => ['job_id'],
- },
- code => \&tool_openqa_get_job_info
- );
-
- $mcp->tool(
- name => 'openqa_get_log_file',
- description => 'Get the content of a specific log file for an openQA job',
- input_schema => {
- type => 'object',
- properties => {
- job_id => {type => 'integer', minimum => 1},
- file_name => {type => 'string', minLength => 1}
- },
- required => ['job_id', 'file_name'],
- },
- code => \&tool_openqa_get_log_file
- );
-
- my $mcp_auth = $app->routes->under('/')->to('Auth#auth')->name('mcp_ensure_user');
- $mcp_auth->any('/experimental/mcp' => $mcp->to_action)->name('mcp');
-}
-
-sub tool_openqa_get_info ($tool, $args) {
- my $c = _get_controller($tool);
- my $user = _get_user($tool);
- my $schema = _get_schema($tool);
-
- my $worker_stats = $schema->resultset('Workers')->stats;
- my $vars = {
- app_name => $c->stash->{appname},
- app_version => $c->stash->{current_version} // 'n/a',
- user_name => $user->name,
- user_id => $user->id,
- is_admin => $user->is_admin ? 'yes' : 'no',
- is_operator => $user->is_operator ? 'yes' : 'no',
- workers_total => $worker_stats->{total},
- workers_total_online => $worker_stats->{total_online},
- workers_offline => $worker_stats->{total} - $worker_stats->{total_online},
- active_workers => $worker_stats->{free_active_workers},
- broken_workers => $worker_stats->{free_broken_workers},
- busy_workers => $worker_stats->{busy_workers},
- };
- return _render_from_data_section('openqa_get_info.txt.ep', $vars);
-}
-
-sub tool_openqa_get_job_info ($tool, $args) {
- my $job_id = $args->{job_id};
-
- my $schema = _get_schema($tool);
- return $tool->text_result('Job does not exist', 1)
- unless my $job = $schema->resultset('Jobs')->find(int($job_id));
- my @comments = map { $_->extended_hash } $job->search_related(comments => {})->all;
-
- my $info = $job->to_hash(assets => 1, check_assets => 1, deps => 1, details => 1, parent_group => 1);
- return _render_from_data_section('openqa_get_job_info.txt.ep', {job => $info, comments => \@comments});
-}
-
-sub tool_openqa_get_log_file ($tool, $args) {
- my $job_id = $args->{job_id};
- my $file_name = $args->{file_name};
-
- # Prevent directory traversal attacks
- return $tool->text_result('Invalid file name', 1) unless $file_name =~ /^[\w.\-]+$/;
-
- # Only text logs for now
- return $tool->text_result('File type not yet supported via MCP', 1) if $file_name !~ /\.txt$/;
-
- my $schema = _get_schema($tool);
- return $tool->text_result('Job does not exist', 1)
- unless my $job = $schema->resultset('Jobs')->find(int($job_id));
-
- my $dir = $job->result_dir;
- my $file = path($dir, $file_name);
- return $tool->text_result('Log file does not exist', 1) unless -r $file;
-
- my $c = _get_controller($tool);
- my $max = $c->app->config->{misc_limits}{mcp_max_result_size};
- return $tool->text_result('File too large to be transmitted via MCP', 1) if -s $file > $max;
- return $tool->text_result($file->slurp);
-}
-
-sub _get_controller ($tool) { $tool->context->{controller} }
-sub _get_schema ($tool) { _get_controller($tool)->schema }
-sub _get_user ($tool) { _get_controller($tool)->stash->{current_user}{user} }
-
-sub _render_from_data_section ($template_name, $vars) {
- my $template = data_section(__PACKAGE__, $template_name);
- return Mojo::Template->new->vars(1)->render($template, $vars);
-}
-
-1;
-__DATA__
-@@ openqa_get_info.txt.ep
-Server: <%= $app_name %> (<%= $app_version %>)
-Current User: <%= $user_name %> (id: <%= $user_id %>, admin: <%= $is_admin %>, operator: <%= $is_operator %>)
-Workers: <%= $workers_total %>
- - online: <%= $workers_total_online %>
- - offline: <%= $workers_offline %>
- - idle: <%= $active_workers %>
- - busy: <%= $busy_workers %>
- - broken: <%= $broken_workers %>
-
-@@ openqa_get_job_info.txt.ep
-Job ID: <%= $job->{id} // 'Unknown' %>
-Name: <%= $job->{name} // 'Unknown' %>
-Group: <%= $job->{group} // 'Unknown' %>
-Priority: <%= $job->{priority} // 'Unknown' %>
-State: <%= $job->{state} // 'Unknown' %>
-Result: <%= $job->{result} // 'Unknown' %>
-Started: <%= $job->{t_started} // 'Never' %>
-Finished: <%= $job->{t_finished} // 'Never' %>
-
-Test Results:
-% if (@{$job->{testresults}}) {
- % for my $result (@{$job->{testresults}}) {
- - <%= $result->{name} %>: <%= $result->{result} %>
- % }
-% }
-% else {
- No test results available yet
-% }
-
-Test Settings:
-% for my $setting (sort keys %{$job->{settings}}) {
- - <%= $setting %>: <%= $job->{settings}{$setting} %>
-% }
-
-Available Logs:
-% if (@{$job->{logs}}) {
- % for my $log (@{$job->{logs}}) {
- - <%= $log %>
- % }
-% }
-% else {
- No logs available
-% }
-
-Comments:
-% if (@$comments) {
- % for my $comment (@$comments) {
- - <%= $comment->{userName} %> (<%= $comment->{created} %>): <%= $comment->{renderedMarkdown} %>
- % }
-% }
-% else {
- No comments yet
-% }
diff --git a/t/api/17-mcp.t b/t/api/17-mcp.t
deleted file mode 100644
index e373da0..0000000
--- a/t/api/17-mcp.t
+++ /dev/null
@@ -1,161 +0,0 @@
-#!/usr/bin/env perl
-
-# Copyright SUSE LLC
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-use Test::Most;
-use utf8;
-use FindBin;
-use lib "$FindBin::Bin/../lib", "$FindBin::Bin/../../external/os-autoinst-common/lib";
-use Mojo::Base -signatures;
-use Test::Mojo;
-use Test::Warnings ':report_warnings';
-use Test::MockModule;
-use OpenQA::Test::TimeLimit '30';
-use OpenQA::Test::Case;
-use OpenQA::Test::Client 'client';
-use MCP::Client;
-
-OpenQA::Test::Case->new(config_directory => "$FindBin::Bin/../data/17-mcp")
- ->init_data(fixtures_glob => '01-jobs.pl 02-workers.pl 03-users.pl');
-
-my $PERSONAL_ACCESS_TOKEN = 'lance:LANCELOTKEY01:MANYPEOPLEKNOW';
-
-my $t = Test::Mojo->new('OpenQA::WebAPI');
-my $client = MCP::Client->new(ua => $t->ua, url => $t->ua->server->url->path('/experimental/mcp'));
-
-subtest 'Authentication' => sub {
- $t->get_ok('/experimental/mcp')->status_is(403)->json_is({error => 'no api key'});
-
- $t->ua->on(start => sub ($ua, $tx) { $tx->req->headers->authorization("Bearer $PERSONAL_ACCESS_TOKEN") });
- $t->get_ok('/experimental/mcp')->status_is(405);
-};
-
-subtest 'Start session' => sub {
- is $client->session_id, undef, 'no session id';
- my $result = $client->initialize_session;
- is $result->{serverInfo}{name}, 'openQA', 'server name';
- is $result->{serverInfo}{version}, '1.0.0', 'server version';
- ok $result->{capabilities}, 'has capabilities';
- ok $client->session_id, 'session id set';
-};
-
-subtest 'List tools' => sub {
- my $result = $client->list_tools;
- is scalar @{$result->{tools}}, 3, 'three tools available';
- is $result->{tools}[0]{name}, 'openqa_get_info', 'right tool name';
- is $result->{tools}[1]{name}, 'openqa_get_job_info', 'right tool name';
- is $result->{tools}[2]{name}, 'openqa_get_log_file', 'right tool name';
-};
-
-subtest 'openqa_get_info tool' => sub {
- my $result = $client->call_tool('openqa_get_info');
- ok !$result->{isError}, 'not an error';
- my $text = $result->{content}[0]{text};
- like $text, qr/Server: openQA \(.+\)/, 'openQA server';
- like $text, qr/Current User: lance \(id: 99902, admin: no, operator: no\)/, 'current user';
- like $text, qr/Workers: 2/, 'total workers';
- like $text, qr/- online: 0/, 'online workers';
- like $text, qr/- offline: 2/, 'offline workers';
- like $text, qr/- idle: 0/, 'idle workers';
- like $text, qr/- busy: 0/, 'busy workers';
- like $text, qr/- broken: 0/, 'broken workers';
-};
-
-subtest 'openqa_get_job_info tool' => sub {
- subtest 'Failed job' => sub {
- my $result = $client->call_tool('openqa_get_job_info', {job_id => 99938});
- ok !$result->{isError}, 'not an error';
- my $text = $result->{content}[0]{text};
- like $text, qr/Job ID: +99938/, 'has job id';
- like $text, qr/Name: +opensuse-Factory-DVD-x86_64-Build0048-doc\@64bit/, 'has name';
- like $text, qr/Group: +opensuse/, 'has group';
- like $text, qr/Priority: +36/, 'has priority';
- like $text, qr/State: +done/, 'has state';
- like $text, qr/Result: +failed/, 'has result';
- like $text, qr/Started: +\d+-\d+-\d+T\d+:\d+:\d+/, 'has started time';
- like $text, qr/Finished: +\d+-\d+-\d+T\d+:\d+:\d+/, 'has finished time';
- like $text, qr/- autoinst-log\.txt/s, 'has log files listed';
- like $text, qr/No test results available yet/s, 'no test results yet';
- like $text, qr/DISTRI: opensuse/, 'settings are present';
- like $text, qr/VERSION: Factory/, 'settings are present';
- like $text, qr/No comments yet/, 'no comments yet';
- };
-
- subtest 'Passed job' => sub {
- subtest 'Add comment to test job' => sub {
- $t->post_ok("/api/v1/jobs/99764/comments" => form => {text => 'Just a test comment'})->status_is(200);
- };
-
- my $result = $client->call_tool('openqa_get_job_info', {job_id => 99764});
- ok !$result->{isError}, 'not an error';
- my $text = $result->{content}[0]{text};
- like $text, qr/Job ID: +99764/, 'has job id';
- like $text, qr/Name: +opensuse-13.1-DVD-x86_64-Build0091-console_tests\@64bit/, 'has name';
- like $text, qr/Group: +Unknown/, 'unknown group';
- like $text, qr/Priority: +35/, 'has priority';
- like $text, qr/State: +done/, 'has state';
- like $text, qr/Result: +passed/, 'has result';
- like $text, qr/Started: +\d+-\d+-\d+T\d+:\d+:\d+/, 'has started time';
- like $text, qr/Finished: +\d+-\d+-\d+T\d+:\d+:\d+/, 'has finished time';
- like $text, qr/No logs available/s, 'no log files listed';
- like $text, qr/No test results available yet/s, 'no test results yet';
- like $text, qr/DISTRI: opensuse/, 'settings are present';
- like $text, qr/VERSION: 13\.1/, 'settings are present';
- like $text, qr/lance.+Just a test comment/, 'has comments';
- };
-
- subtest 'Input validation failed' => sub {
- eval { $client->call_tool('openqa_get_job_info', {job_id => 'abc'}) };
- like $@, qr/Error -32602: Invalid arguments/, 'right error message';
- };
-};
-
-subtest 'openqa_get_log_file tool' => sub {
- subtest 'Failed job' => sub {
- my $result = $client->call_tool('openqa_get_log_file', {job_id => 99938, file_name => 'autoinst-log.txt'});
- ok !$result->{isError}, 'not an error';
- my $text = $result->{content}[0]{text};
- like $text, qr/starting: \/usr\/bin\/qemu-kvm/, 'has log content from start';
- like $text, qr/test logpackages died/, 'has log content from end';
- };
-
- subtest 'Input validation failed' => sub {
- eval { $client->call_tool('openqa_get_log_file', {job_id => 'abc', file_name => 'autoinst-log.txt'}) };
- like $@, qr/Error -32602: Invalid arguments/, 'right error message';
- eval { $client->call_tool('openqa_get_log_file', {job_id => 99938, file_name => ''}) };
- like $@, qr/Error -32602: Invalid arguments/, 'right error message';
- };
-
- subtest 'Path traversal attack' => sub {
- my $result = $client->call_tool('openqa_get_log_file', {job_id => 99938, file_name => '../../etc/passwd'});
- ok $result->{isError}, 'is an error';
- my $text = $result->{content}[0]{text};
- like $text, qr/Invalid file name/, 'error message';
- };
-
- subtest 'Job does not exist' => sub {
- local $t->app->config->{misc_limits}{mcp_max_result_size} = 100;
- my $result = $client->call_tool('openqa_get_log_file', {job_id => 999999999, file_name => 'autoinst-log.txt'});
- ok $result->{isError}, 'is an error';
- my $text = $result->{content}[0]{text};
- like $text, qr/Job does not exist/, 'error message';
- };
-
- subtest 'Unsupported file type' => sub {
- my $result = $client->call_tool('openqa_get_log_file', {job_id => 99938, file_name => 'video.ogv'});
- ok $result->{isError}, 'is an error';
- my $text = $result->{content}[0]{text};
- like $text, qr/File type not yet supported via MCP/, 'error message';
- };
-
- subtest 'File too large' => sub {
- local $t->app->config->{misc_limits}{mcp_max_result_size} = 100;
- my $result = $client->call_tool('openqa_get_log_file', {job_id => 99938, file_name => 'autoinst-log.txt'});
- ok $result->{isError}, 'is an error';
- my $text = $result->{content}[0]{text};
- like $text, qr/File too large to be transmitted via MCP/, 'error message';
- };
-};
-
-done_testing();
diff --git a/t/config.t b/t/config.t
index af3bc4f..7086d16 100644
--- a/t/config.t
+++ b/t/config.t
@@ -52,7 +52,6 @@ subtest 'Test configuration default modes' => sub {
max_rss_limit => 0,
profiling_enabled => 0,
monitoring_enabled => 0,
- mcp_enabled => 'no',
hide_asset_types => 'repo',
file_security_policy => 'download-prompt',
recognized_referers => [],
@@ -190,7 +189,6 @@ subtest 'Test configuration default modes' => sub {
max_online_workers => 1000,
wait_for_grutask_retries => 6,
worker_limit_retry_delay => ONE_HOUR / 4,
- mcp_max_result_size => 500000,
max_job_time_prio_scale => 100,
scheduled_product_min_storage_duration => 34,
},
diff --git a/t/data/17-mcp/openqa.ini b/t/data/17-mcp/openqa.ini
deleted file mode 100644
index cb0eca2..0000000
--- a/t/data/17-mcp/openqa.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[global]
-mcp_enabled = read-only
|