File tree Expand file tree Collapse file tree 6 files changed +700
-0
lines changed Expand file tree Collapse file tree 6 files changed +700
-0
lines changed Original file line number Diff line number Diff line change @@ -631,3 +631,15 @@ int mcp_server_remove_tool(const char *tool_name)
631631 return 0 ;
632632}
633633#endif
634+
635+ #ifdef CONFIG_ZTEST
636+ uint8_t mcp_server_get_client_count (void )
637+ {
638+ return client_registry .client_count ;
639+ }
640+
641+ uint8_t mcp_server_get_tool_count (void )
642+ {
643+ return tool_registry .tool_count ;
644+ }
645+ #endif
Original file line number Diff line number Diff line change 99#include <zephyr/net/mcp/mcp_server.h>
1010#include "mcp_transport.h"
1111
12+ #ifdef CONFIG_ZTEST
13+ int mcp_transport_queue_call_count ;
14+ mcp_response_queue_msg_t mcp_transport_last_queued_msg = {0 };
15+ #endif
16+
1217int mcp_transport_queue_response (mcp_response_queue_msg_t * msg )
1318{
19+ #ifdef CONFIG_ZTEST
20+ /* Store call information for testing */
21+ mcp_transport_queue_call_count ++ ;
22+ if (msg ) {
23+ mcp_transport_last_queued_msg .type = msg -> type ;
24+ mcp_transport_last_queued_msg .data = msg -> data ;
25+ }
26+ #endif
27+
1428 /* queue msg to the correct requests queue */
1529 return 0 ;
1630}
Original file line number Diff line number Diff line change 1+ # SPDX-License-Identifier: Apache-2.0
2+
3+ cmake_minimum_required (VERSION 3.20.0)
4+ find_package (Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} )
5+ project (mcp_tests)
6+ target_sources (app PRIVATE src/main.c)
7+
8+ target_include_directories (app PRIVATE
9+ ${ZEPHYR_BASE} /subsys/net/lib/mcp
10+ ${ZEPHYR_BASE} /include
11+ )
Original file line number Diff line number Diff line change 1+ CONFIG_ZTEST=y
2+ CONFIG_MCP_SERVER=y
3+ CONFIG_MCP_TOOLS_CAPABILITY=y
4+ CONFIG_MCP_MAX_TOOLS=4
5+ CONFIG_MCP_TOOL_NAME_MAX_LEN=32
6+ CONFIG_MCP_TOOL_SCHEMA_MAX_LEN=512
7+ CONFIG_MCP_TOOL_INPUT_ARGS_MAX_LEN=512
8+ CONFIG_MCP_TOOL_RESULT_MAX_LEN=256
9+ CONFIG_HTTP_SERVER_MAX_CLIENTS=3
10+ CONFIG_HTTP_SERVER_MAX_STREAMS=3
11+ CONFIG_MCP_LOG_LEVEL_DBG=y
12+ CONFIG_NETWORKING=y
13+ CONFIG_HTTP_SERVER=y
14+ CONFIG_JSON_LIBRARY=y
15+
16+ # Enable kernel heap for k_malloc/k_free
17+ CONFIG_HEAP_MEM_POOL_SIZE=16384
18+ CONFIG_KERNEL_MEM_POOL=y
19+
20+ # Increase stack sizes to prevent stack overflow
21+ CONFIG_MAIN_STACK_SIZE=4096
22+ CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
23+ CONFIG_TEST_EXTRA_STACK_SIZE=2048
You can’t perform that action at this time.
0 commit comments