modelcontextprotocol / modelcontextprotocol/typescript-sdk
`createMcpHonoApp` should support generics for Env (Bindings and Variables)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.4k
- Forks
- 2.2k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 4
Description
NOTE: This issue is a feedback for v2 alpha.
Currently, createMcpHonoApp returns a plain Hono instance with BlankEnv({}).
This makes it difficult to access typed environment variables (like c.env.DB in Cloudflare D1) within MCP handlers without resorting to unsafe type casting.
It would be great if we could pass Env types like:
const app = createMcpHonoApp<Env>();
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/middleware/hono/src/hono.ts at the createMcpHonoApp definition linked in the issue, and inspect how its current plain Hono instance uses BlankEnv. Make the returned app accept an Env generic so bindings and variables such as c.env.DB remain typed when using createMcpHonoApp(); verify the resulting type behavior in the existing Hono middleware context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100