Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detailed Stats page + HTTP Support #227

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

QuantGeekDev
Copy link

This adds a detailed stats page to the stats tab of the inspector.
You can try it out today with npx mcp-debug for the inspector
This also adds experimental (direct from client, and streamable from server) support for the http specificatio

You can try creating a http server with mcp-framework if you don't have an implementation to test it with yet (mcp create serverNameHere --http --cors --port 1337

Motivation and Context

The MCP specification now includes the Streamable HTTP transport protocol, but the inspector currently lacks direct support for it. This PR adds an experimental implementation of the Streamable HTTP transport client, allowing developers to connect directly to MCP servers using this protocol without requiring a proxy. The main way to do this is via DIRECT (no proxy) connection, a new checkbox for this has been added to the UI.

This is being submitted as an experimental feature for now - I can provide a more thorough implementation and testing plan if this is something the team sees as valuable and would like to incorporate into the main codebase.

How Has This Been Tested?

The implementation has been tested with basic request/response patterns and SSE streaming connections against HTTP MCP servers built with mcp-framework. I will re-test it against the official SDK once it is available.

The debugging UI provides insights into the connection state, helping identify protocol compliance issues.

Breaking Changes

None. This implementation is additive and doesn't change existing functionality. Users can continue using existing transport methods.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

This implementation focuses on the client-side of the Streamable HTTP transport protocol. The implementation includes:

  1. Direct HTTP transport client following the MCP Streamable HTTP specification
  2. Session management with automatic reconnection
  3. Support for SSE streaming for server-to-client messages
  4. Enhanced debugging UI with detailed connection stats

The debugging UI provides visibility into:

  • Connection state and metrics
  • HTTP status code tracking
  • Tool call monitoring
  • SSE stream events
  • Protocol compliance checks

This is being submitted as an experimental implementation to gauge interest. If the team finds value in this approach, I'd be happy to provide a more robust implementation with comprehensive testing and documentation.

@QuantGeekDev
Copy link
Author

QuantGeekDev commented Mar 29, 2025

I'd love to get some feedack. Please let me know if this would make sense and if I should keep iterating on this to make this merge ready, I can move pretty fast

@pulkitsharma07
Copy link
Contributor

Why not add support for streamable transport first in the SDK modelcontextprotocol/typescript-sdk#220 and then use it here ? Check this #221 as well

Should a new transport implementation be part of the inspector ?

@QuantGeekDev
Copy link
Author

Why not add support for streamable transport first in the SDK modelcontextprotocol/typescript-sdk#220 and then use it here ? Check this #221 as well

Should a new transport implementation be part of the inspector ?

Thanks for your response! I just assumed it was already being worked on so I rolled it up quickly and will patch it once the official sdk is updated. I posted a comment in the related issue you sent offering to implement it into the official sdk

```

The inspector runs both a client UI (default port 5173) and an MCP proxy server (default port 3000). Open the client UI in your browser to use the inspector. You can customize the ports if needed:

```bash
CLIENT_PORT=8080 SERVER_PORT=9000 npx @modelcontextprotocol/inspector node build/index.js
CLIENT_PORT=8080 SERVER_PORT=9000 npx @modelcontextprotocol/inspector-server node build/index.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔙

@@ -64,7 +64,7 @@ async function main() {
const CLIENT_PORT = process.env.CLIENT_PORT ?? "5173";
const SERVER_PORT = process.env.SERVER_PORT ?? "3000";

console.log("Starting MCP inspector...");
console.log("Starting MCP Debug inspector...");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔙

@@ -102,7 +102,7 @@ async function main() {
await Promise.any([server, client, delay(2 * 1000)]);
const portParam = SERVER_PORT === "3000" ? "" : `?proxyPort=${SERVER_PORT}`;
console.log(
`\n🔍 MCP Inspector is up and running at http://127.0.0.1:${CLIENT_PORT}${portParam} 🚀`,
`\n🔍 MCP Debug Inspector is up and running at http://127.0.0.1:${CLIENT_PORT}${portParam} 🚀`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔙

"name": "@modelcontextprotocol/inspector-client",
"version": "0.7.0",
"description": "Client-side application for the Model Context Protocol inspector",
"name": "mcp-debug-client",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔙 all this file

@@ -29,8 +29,8 @@ import { version } from "../../../package.json";

interface SidebarProps {
connectionStatus: "disconnected" | "connected" | "error";
transportType: "stdio" | "sse";
setTransportType: (type: "stdio" | "sse") => void;
transportType: "stdio" | "sse" | "streamableHttp";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"stdio" | "sse" | "http";

@@ -0,0 +1,58 @@
import * as React from "react";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@@ -0,0 +1,36 @@
import * as React from "react";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@seuros
Copy link
Contributor

seuros commented Mar 31, 2025

This can be split into 2 PRs. The Stats page and the new SDK spec.

The stats page should have a screenshoot of the page in the PR.

@cliffhall cliffhall added enhancement New feature or request waiting on submitter Waiting for the submitter to provide more info labels Mar 31, 2025
@cliffhall
Copy link
Contributor

cliffhall commented Mar 31, 2025

This can be split into 2 PRs. The Stats page and the new SDK spec.
The stats page should have a screenshoot of the page in the PR.

I agree, this is a big PR and a lot of it just needs to be backed out as it stands. Reducing this to just adding a stats page will make it much easier to review and have confidence in. Also it would be good if you could include a screenshot of this stats page so we can see the scope of it before pulling down your branch to test locally.

@idyll
Copy link

idyll commented Apr 2, 2025

I've tested this PR with my streaming server... I very much appreciate it @QuantGeekDev

I did notice that when my server returned the new protocol version 2025-03-26 it refused to connect.
(Which would make sense for the SSE but not for the new Streaming...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request waiting on submitter Waiting for the submitter to provide more info
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants