Skip to content

chore: drop express usage in cli.ts #890

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

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

Conversation

Skn0tt
Copy link
Contributor

@Skn0tt Skn0tt commented Aug 20, 2025

Motivation and Context

As discussed on Discord: express is quite a bloated dependency for an SDK of this ubiquity. This PR drops express in cli.ts, a future PR will drop it from the src/server/auth folder.

How Has This Been Tested?

npx tsx src/cli.ts server 3000, then npx @modelcontextprotocol/inspector --server-url http://localhost:3000/sse. Initialization completes successfully.

Breaking Changes

no

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

sibling of #889.
cc @cliffhall

@Skn0tt Skn0tt requested a review from a team as a code owner August 20, 2025 05:52
@Skn0tt Skn0tt requested a review from ihrpr August 20, 2025 05:52
Copy link
Member

@cliffhall cliffhall left a comment

Choose a reason for hiding this comment

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

Straightforward refactor from express to http. Tests run locally. No linter complaints.

Tested with:

mcp-typescript-sdk % npx tsx src/cli.ts server 3000
npx @modelcontextprotocol/inspector --server-url http://localhost:3000/sse --transport sse

Copy link
Member

@cliffhall cliffhall left a comment

Choose a reason for hiding this comment

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

There are unit tests that use express, and in Discord you said you'd be moving that usage to devDependencies, but in this PR I think you need to update all the files in src/examples/server/ that use express as you did for cli.ts, which itself is just an example really.

@Skn0tt
Copy link
Contributor Author

Skn0tt commented Aug 20, 2025

I'll be able to move the package to devDependencies after I updated the usages inside src/server/auth. I was planning to do that in a separate PR, so the PRs don't get too too big. I can also include it in this PR though if you'd like.

@cliffhall
Copy link
Member

I'll be able to move the package to devDependencies after I updated the usages inside src/server/auth. I was planning to do that in a separate PR, so the PRs don't get too too big. I can also include it in this PR though if you'd like.

Seems reasonable to do here.

@Skn0tt Skn0tt requested a review from a team as a code owner August 21, 2025 08:07
@Skn0tt Skn0tt requested a review from ochafik August 21, 2025 08:07
@Skn0tt
Copy link
Contributor Author

Skn0tt commented Aug 21, 2025

I replaced the express.Router usage with my own little hand-rolled router; and the express middlewares with my own little hand-rolled middlewares. Tests are still happy.

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