Делите путем


Mock tooling server

Important

You need to be part of the Frontier preview program to get early access to Microsoft Agent 365. Frontier connects you directly with Microsoft’s latest AI innovations. Frontier previews are subject to the existing preview terms of your customer agreements. As these features are still in development, their availability and capabilities may change over time.

The Agent 365 CLI includes a mock tooling server for testing and development purposes. This server simulates MCP (Model Context Protocol) server interactions, so you can test your agent's tooling capabilities locally without needing actual server implementations. It doesn't cover any other Agent 365 functionalities.

Benefits of using the mock server

The mock server offers the following benefits for local development and testing:

  • Offline development: Test your agent without internet connectivity or external dependencies.
  • Consistent testing: Receive predictable responses for testing edge cases.
  • Debugging: View all requests and responses in real-time
  • Fast iteration: No need to wait for external API calls or set up complex test environments.

Prerequisites

Before using the mock tooling server, ensure you have the following prerequisites:

  • Agent 365 CLI installed - Use the mock tooling server alongside the CLI. See Agent 365 CLI for installation instructions.
    • You should have at least version 1.1.25-preview to use the mock tooling server.
  • Sample agent project - A local agent project that can connect to MCP servers. See our Agent365-Samples repo for available starting points.

Start the mock tooling server

Use the a365 develop start-mock-tooling-server command to start the mock tooling server.

# Full command
a365 develop start-mock-tooling-server

# Short alias
a365 develop mts

Command options

The mock tooling server supports the following options:

Option Description Default
-p, --port <port> Port number for the mock server 5309
-v, --verbose Enable verbose logging false
-?, -h, --help Show help and usage information -
-bg Run the server on a new terminal -

Examples

The following examples show common ways to start the mock tooling server:

Start with default settings:

a365 develop start-mock-tooling-server

Start on a custom port:

a365 develop start-mock-tooling-server -p 8080

Start with verbose logging:

a365 develop start-mock-tooling-server -v

When you run the command, it:

  1. Starts the mock server on the specified port (default: localhost:5309).
  2. Displays server logs and incoming requests in the terminal.

Use mock server with sample agents

To connect your sample agent to the mock tooling server:

Step 1: Start the mock server

a365 develop start-mock-tooling-server

The server starts and displays output similar to the following example:

info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5309
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.

Step 2: Configure your agent

Set the MCP_PLATFORM_ENDPOINT environment variable in your sample agent to point to the mock server:

MCP_PLATFORM_ENDPOINT=http://localhost:5309

If you use a custom port, replace 5309 with your chosen port number.

Step 3: Run your agent

Start your sample agent as you normally do. The agent now connects to the mock server instead of actual MCP servers.

Step 4: Monitor server activity

The mock server terminal displays:

  • Incoming requests from your agent
  • Mocked responses being sent back
  • Connection status and errors (if any)

Example server logs:

info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 POST http://localhost:5309/agents/servers/mcp_CalendarTools - application/json 351
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
      Executing endpoint 'HTTP: POST /agents/servers/{mcpServerName}'
info: Microsoft.AspNetCore.Http.Result.JsonResult[3]
      Writing value of type '<>f__AnonymousType14`3' as Json.
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
      Executed endpoint 'HTTP: POST /agents/servers/{mcpServerName}'
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 POST http://localhost:5309/agents/servers/mcp_CalendarTools - 200 - application/json;+charset=utf-8 399.1814ms

Stopping the mock server

To stop the mock server, use Ctrl+C` in the terminal where the server is running, or close the terminal window.

Troubleshooting

This section contains information about how to troubleshoot common problems with the mock tooling server.

Mock server fails to start

Symptom:

Error: Address already in use

Cause:

Another process is already using the default port (5309) or your specified port.

Solution:

  • Use a different port.

    a365 develop start-mock-tooling-server -p 8080
    
  • Or stop the process using the port and try again.

Agent can't connect to mock server

Symptom:

Agent logs show connection errors or timeouts when trying to reach the mock server.

Cause:

  • Mock server isn't running.
  • Incorrect MCP_PLATFORM_ENDPOINT environment variable.
  • Firewall or network configuration problems.

Solution:

  1. Verify the mock server is running and shows "Now listening on: http://localhost:5309".
  2. Check the MCP_PLATFORM_ENDPOINT environment variable matches the server address.
  3. Ensure no firewall blocks the connection on the specified port.