Skip to main content
This guide covers advanced testing scenarios for FrontMCP applications, including testing plugins, hooks, caching behavior, and authorization logic.
Prerequisites:

What You’ll Learn

  • Testing cache plugin behavior (hits and misses)
  • Testing authorization plugins
  • Testing hook execution order
  • Multi-client testing scenarios
  • Mocking external dependencies

Testing Cache Plugin

The Cache plugin stores tool results and returns them on subsequent calls. Test both cache hits and misses.

Setup

Testing Cache Miss (First Call)

Testing Cache Hit (Subsequent Calls)

Testing Cache with Different Inputs


Testing Authorization Plugin

Test that your authorization plugin correctly filters tools based on user roles.

Setup with Authentication

Testing Role-Based Tool Filtering

Testing Tool Execution Authorization


Testing Site-Scoped Authorization

Test multi-tenant access control.

Multi-Client Testing

Test scenarios involving multiple concurrent users.

Mocking External HTTP Calls

Test tools that call external APIs without making real requests.

Testing Hook Behavior

Test that hooks execute in the correct order and modify behavior as expected.

Testing Rate Limiting

If you have rate limiting plugins:

Best Practices

Never make real API calls in tests. Use httpMock.interceptor() to mock all external HTTP requests.
  • User with no roles
  • User with multiple roles
  • Expired tokens
  • Invalid tokens
  • Missing claims

Next Steps

HTTP Mocking

Advanced HTTP mocking techniques

Interceptors

Mock MCP protocol responses

Authentication

Complete auth testing reference

API Reference

Full testing API documentation