Skip to content

Conversation

fmenezes
Copy link
Collaborator

@fmenezes fmenezes commented Jul 14, 2025

Proposed changes

Adding streamable http to MCP-42 feature branch.

Note: state management and tests will be added in a future PR.

Checklist

@fmenezes fmenezes changed the base branch from main to MCP-42 July 14, 2025 14:28
@fmenezes fmenezes marked this pull request as ready for review July 14, 2025 14:52
@fmenezes fmenezes requested a review from a team as a code owner July 14, 2025 14:52
@fmenezes fmenezes changed the title feat: add streamable http feat: add streamable http [MCP-55] Jul 14, 2025
README.md Outdated
| `transport` | stdio | Either 'stdio' or 'http'. |
| `httpPort` | 3000 | Port number. |
| `httpHost` | 127.0.0.1 | Host to bind the http server. |
| `logger` | disk,mcp | Comma separated values, possible values are `mcp`, `disk` and `stderr`. |
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: can we expand a little bit here or below in the features the logger purpose and usage examples?

app.use(express.json());
app.enable("trust proxy"); // needed for reverse proxy support
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
Copy link
Collaborator

Choose a reason for hiding this comment

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

[q] do we need to call app.use(express.json()); twice?

"streamableHttpTransport",
`Error handling request: ${error instanceof Error ? error.message : String(error)}`
);
res.sendStatus(400);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: we have a task for this but we'll need to return JSON-RPC response error body, so this is a non-blocker, just in case its too simple to add here

);
});

transport.onclose = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

[q] should we call this in index.ts?

Copy link
Collaborator Author

@fmenezes fmenezes Jul 14, 2025

Choose a reason for hiding this comment

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

no, mcpServer.close() should close the transport

@fmenezes fmenezes requested a review from blva July 14, 2025 15:16
// This function creates a StdioServerTransport and replaces the internal readBuffer with EJsonReadBuffer
// that uses EJson.parse instead.
export function createEJsonTransport(): StdioServerTransport {
export function createStdioTransport(): StdioServerTransport {
Copy link
Collaborator

@blva blva Jul 14, 2025

Choose a reason for hiding this comment

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

nit: why not call stdio.ts if we're under transports folder? same for streamableHttp

);
res.status(400).json({
jsonrpc: "2.0",
error: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

based on the spec we need to also add a request ID field here

Copy link
Collaborator

Choose a reason for hiding this comment

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

(note: feel free to address in the rpc ticket, probably worth just assigning it to you already)

Copy link
Collaborator Author

@fmenezes fmenezes Jul 14, 2025

Choose a reason for hiding this comment

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

jsonrpc: "2.0",
error: {
code: JSON_RPC_ERROR_CODE_PROCESSING_REQUEST_FAILED,
message: `Error handling request: ${error instanceof Error ? error.message : String(error)}`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: should we throw the classic error message and populate any extra info in the error.data optional field?

Copy link
Collaborator

@blva blva left a comment

Choose a reason for hiding this comment

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

non-blocking comments - but need to fix linting

@fmenezes fmenezes merged commit ff982e0 into MCP-42 Jul 14, 2025
14 of 15 checks passed
@fmenezes fmenezes deleted the MCP-55 branch July 14, 2025 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants