mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-18 19:44:19 +02:00
Reorder testing docs (MCPJam first, Postman second) and minimize instructions
- Reorder sections to put MCPJam Inspector before Postman - Minimize instructions and reference official documentation - Verify all claims against official sources - Update CORS section to correctly list MCPJam as browser-based - Reduce MCPJam section from ~40 to ~15 lines - Reduce Postman section from ~65 to ~25 lines Co-authored-by: Bill Easton <strawgate@users.noreply.github.com>
This commit is contained in:
parent
b1549b090a
commit
c42f2aee83
2 changed files with 40 additions and 127 deletions
|
|
@ -154,9 +154,9 @@ CORS (Cross-Origin Resource Sharing) is needed when JavaScript running in a web
|
|||
|
||||
Browser-based MCP clients that need CORS include:
|
||||
|
||||
- **MCPJam Inspector** - Local browser-based tool for testing MCP servers (see [Testing guide](/patterns/testing#testing-with-mcpjam-inspector))
|
||||
- **MCP Inspector** - Browser-based debugging tool for testing MCP servers
|
||||
- **MCPJam Inspector** - Browser-based tool for testing and debugging MCP servers (see [Testing guide](/patterns/testing#testing-with-mcpjam-inspector))
|
||||
- **Custom browser-based MCP clients** - If you're building a web app that directly connects to MCP servers
|
||||
- **Custom browser-based MCP clients** - Web apps that directly connect to MCP servers
|
||||
|
||||
For these scenarios, add CORS middleware with the specific headers required for MCP protocol:
|
||||
|
||||
|
|
|
|||
|
|
@ -103,154 +103,67 @@ async def test_add(
|
|||
The [FastMCP Repository contains thousands of tests](https://github.com/jlowin/fastmcp/tree/main/tests) for the FastMCP Client and Server. Everything from connecting to remote MCP servers, to testing tools, resources, and prompts is covered, take a look for inspiration!
|
||||
</Tip>
|
||||
|
||||
## Testing with Postman
|
||||
|
||||
Postman now provides native support for the Model Context Protocol, allowing you to interactively test and debug your FastMCP servers through its visual interface. This is particularly useful for manual testing, exploring your server's capabilities, and validating behavior during development.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
To test your FastMCP server with Postman, you'll need:
|
||||
|
||||
1. **A running FastMCP server over HTTP** - Postman connects to servers via HTTP transport. See the [HTTP Deployment guide](/deployment/http) for setup instructions.
|
||||
|
||||
2. **Postman desktop application** - MCP support is available in the Postman desktop app. [Download Postman](https://www.postman.com/downloads/) if you haven't already.
|
||||
|
||||
### Setting Up Postman
|
||||
|
||||
Deploy your FastMCP server with HTTP transport:
|
||||
|
||||
```python server.py
|
||||
from fastmcp import FastMCP
|
||||
|
||||
mcp = FastMCP("My Server")
|
||||
|
||||
@mcp.tool
|
||||
def process_data(input: str) -> str:
|
||||
"""Process data on the server"""
|
||||
return f"Processed: {input}"
|
||||
|
||||
if __name__ == "__main__":
|
||||
mcp.run(transport="http", host="0.0.0.0", port=8000)
|
||||
```
|
||||
|
||||
Start your server:
|
||||
```bash
|
||||
python server.py
|
||||
```
|
||||
|
||||
Your server is now accessible at `http://localhost:8000/mcp`.
|
||||
|
||||
### Making MCP Requests
|
||||
|
||||
Postman's MCP request feature allows you to:
|
||||
|
||||
- **List available tools, resources, and prompts** - Discover what your server exposes
|
||||
- **Call tools with arguments** - Test tool execution with different inputs
|
||||
- **Read resources** - Verify resource content and templates
|
||||
- **Execute prompts** - Test prompt responses
|
||||
- **Debug server responses** - Inspect request/response details and error messages
|
||||
|
||||
In Postman, create a new MCP request and point it to your server's URL (`http://localhost:8000/mcp`). Use the Postman interface to interact with your server's capabilities.
|
||||
|
||||
For detailed instructions on using Postman's MCP features, see [Postman's MCP documentation](https://learning.postman.com/docs/postman-ai/mcp-requests/overview).
|
||||
|
||||
### When to Use Postman vs Pytest
|
||||
|
||||
**Use Postman when:**
|
||||
- Exploring your server's capabilities interactively
|
||||
- Manually testing specific scenarios during development
|
||||
- Debugging unexpected behavior or error messages
|
||||
- Demonstrating server functionality to team members
|
||||
- Working on a server that's already deployed remotely
|
||||
|
||||
**Use Pytest when:**
|
||||
- Building automated test suites for CI/CD pipelines
|
||||
- Testing multiple scenarios with parameterized inputs
|
||||
- Ensuring consistent behavior across code changes
|
||||
- Writing regression tests for bug fixes
|
||||
- Validating complex assertions on response data
|
||||
|
||||
Both approaches are complementary. Use Postman for interactive exploration and debugging, and Pytest for automated, repeatable testing as part of your development workflow.
|
||||
|
||||
## Testing with MCPJam Inspector
|
||||
|
||||
MCPJam Inspector is a local-first developer tool that provides a visual interface for testing, debugging, and inspecting MCP servers. It functions like "Postman for MCP" and is particularly useful for exploring server capabilities, testing tools with different parameters, and debugging protocol-level interactions.
|
||||
[MCPJam Inspector](https://www.mcpjam.com/) is a browser-based developer tool for testing and debugging MCP servers locally. It supports all transport protocols (STDIO, HTTP, and SSE), provides protocol-level inspection, and includes an LLM Playground for testing your server with real AI models.
|
||||
|
||||
### Prerequisites
|
||||
### Getting Started
|
||||
|
||||
To test your FastMCP server with MCPJam Inspector, you'll need:
|
||||
Install and run MCPJam Inspector locally:
|
||||
|
||||
1. **A running FastMCP server** - MCPJam Inspector supports all transport protocols (STDIO, HTTP, and SSE). See the [HTTP Deployment guide](/deployment/http) for HTTP transport setup.
|
||||
|
||||
2. **MCPJam Inspector running locally** - The inspector runs as a local web application at `http://127.0.0.1:6274` in your browser. Visit [MCPJam](https://www.mcpjam.com/) to get started.
|
||||
|
||||
### Setting Up MCPJam Inspector
|
||||
|
||||
Deploy your FastMCP server with your preferred transport. For HTTP:
|
||||
|
||||
```python server.py
|
||||
from fastmcp import FastMCP
|
||||
|
||||
mcp = FastMCP("My Server")
|
||||
|
||||
@mcp.tool
|
||||
def process_data(input: str) -> str:
|
||||
"""Process data on the server"""
|
||||
return f"Processed: {input}"
|
||||
|
||||
if __name__ == "__main__":
|
||||
mcp.run(transport="http", host="0.0.0.0", port=8000)
|
||||
```
|
||||
|
||||
Start your server:
|
||||
```bash
|
||||
python server.py
|
||||
npx @mcpjam/inspector@latest
|
||||
```
|
||||
|
||||
Your server is now accessible at `http://localhost:8000/mcp`.
|
||||
The inspector runs at `http://127.0.0.1:6274` and requires Node.js 20+. For detailed setup and usage instructions, see the [official MCPJam documentation](https://docs.mcpjam.com/).
|
||||
|
||||
### Connecting to Your Server
|
||||
### Key Features
|
||||
|
||||
In MCPJam Inspector:
|
||||
- **Protocol Support** - Connect via STDIO, HTTP, or SSE transport
|
||||
- **Server Testing** - Browse and execute tools, resources, and prompts
|
||||
- **LLM Playground** - Test your server integrated with real AI models (Claude, GPT, Ollama)
|
||||
- **OAuth Debugging** - Debug OAuth flows with detailed protocol inspection
|
||||
- **JSON-RPC Logs** - View real-time protocol messages for debugging
|
||||
|
||||
1. Navigate to the local dashboard at `http://127.0.0.1:6274`
|
||||
2. Click the "Add Server" button
|
||||
3. Select your connection type (STDIO, HTTP, or SSE)
|
||||
4. Enter your server name and connection details (URL, credentials if needed)
|
||||
5. Confirm to establish the connection
|
||||
## Testing with Postman
|
||||
|
||||
For HTTP servers with authentication, include your credentials in the connection setup. MCPJam Inspector supports OAuth debugging for OAuth-protected servers.
|
||||
[Postman](https://www.postman.com/) provides native support for the Model Context Protocol, allowing you to test MCP servers through its visual interface. Postman is particularly useful when integrating MCP servers into API workflows or collaborating with teams already using Postman for API testing.
|
||||
|
||||
### Testing Server Capabilities
|
||||
### Getting Started
|
||||
|
||||
MCPJam Inspector provides several testing features:
|
||||
1. Open Postman and create a new workspace
|
||||
2. Select **New** > **MCP**
|
||||
3. Choose your transport (STDIO or HTTP)
|
||||
4. Enter your server connection details
|
||||
5. Click **Load Methods** to discover available capabilities
|
||||
|
||||
- **Tools Tab** - Browse available tools, fill in parameter values, execute calls, and review structured response data
|
||||
- **Resources Tab** - Inspect and browse available resources and resource templates
|
||||
- **Prompts Tab** - Test prompt templates with different inputs
|
||||
- **LLM Playground** - Connect your server to real AI models (Claude, GPT, Ollama) and test full conversational flows
|
||||
- **JSON-RPC Logs** - View real-time protocol messages between the inspector and your server for low-level debugging
|
||||
For complete instructions, see [Postman's MCP documentation](https://learning.postman.com/docs/postman-ai/mcp-requests/overview).
|
||||
|
||||
The LLM Playground is particularly powerful—it lets you test how your MCP server behaves when integrated with actual language models, helping you validate tool descriptions, parameter schemas, and response formats in realistic scenarios.
|
||||
### Key Features
|
||||
|
||||
### When to Use MCPJam Inspector vs Other Tools
|
||||
- **Interactive Testing** - Browse and execute tools, resources, and prompts
|
||||
- **Collection Support** - Save and organize MCP requests in collections
|
||||
- **Export Configurations** - Export server configs for Claude Desktop, VS Code, or Cursor
|
||||
- **Team Collaboration** - Share MCP requests and collections with your team
|
||||
|
||||
### When to Use Each Tool
|
||||
|
||||
**Use MCPJam Inspector when:**
|
||||
- Testing protocol-level interactions and debugging JSON-RPC messages
|
||||
- Validating server behavior across different transport protocols (STDIO, HTTP, SSE)
|
||||
- Testing OAuth authentication flows and debugging authorization issues
|
||||
- Exploring how your server integrates with different LLM models
|
||||
- Working locally without deploying to a remote environment
|
||||
- Testing locally with protocol-level debugging
|
||||
- Validating OAuth flows and authentication
|
||||
- Testing with real LLM models in the playground
|
||||
- Working with any transport (STDIO, HTTP, SSE)
|
||||
|
||||
**Use Postman when:**
|
||||
- Testing remote HTTP servers that are already deployed
|
||||
- Sharing test requests with team members via Postman collections
|
||||
- Working in an environment where you're already using Postman for API testing
|
||||
- Integrating MCP testing into existing API workflows
|
||||
- Collaborating with teams using Postman
|
||||
- Managing MCP requests in collections
|
||||
- Exporting configurations for MCP clients
|
||||
|
||||
**Use Pytest when:**
|
||||
- Building automated test suites for CI/CD pipelines
|
||||
- Building automated test suites for CI/CD
|
||||
- Testing multiple scenarios with parameterized inputs
|
||||
- Ensuring consistent behavior across code changes
|
||||
- Writing regression tests for bug fixes
|
||||
- Ensuring consistent behavior across code changes
|
||||
|
||||
All three approaches are complementary. Use MCPJam Inspector for local, protocol-level testing and LLM integration validation; Postman for remote HTTP testing and collaboration; and Pytest for automated, repeatable testing in your development workflow.
|
||||
All three approaches are complementary. Use MCPJam Inspector for local protocol-level testing, Postman for API workflow integration, and Pytest for automated testing.
|
||||
Loading…
Add table
Add a link
Reference in a new issue