Skip to content
/ xsmcp Public

๐Ÿค–๐Ÿ“Ž extra-small MCP SDK for quick client/server builds.

License

Notifications You must be signed in to change notification settings

moeru-ai/xsmcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

36 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

xsMCP

extra-small MCP SDK for quick client/server builds.

About

๐Ÿšง This project is under active development, stay tuned!

Why is there this project?

@modelcontextprotocol/sdk is large and has dependencies on libraries like zod, express, etc. that you probably don't even want to use.

Like xsAI, xsMCP does not force you to use a particular server or schema library and is very small.

Roadmap

Our current target is Streamable HTTP Client / Server, Stdio have lower priority.

Compatibility

xsMCP v0.1 is targeted to be compatible with the 2025-03-26 revision and is not backward compatible.

HTTP Server Structure

@xsmcp/server-http is based on Web Standards, not Express.

import { createServerAdapter } from '@whatwg-node/server'
import { createHttpServer } from '@xsmcp/server-http'
import { createServer } from 'node:http'

const server = createHttpServer({ ...options })

// (req: Request) => Promise<Response>
type ServerFetch = typeof server.fetch

// node.js
const httpServer = createServer(createServerAdapter(server.fetch))
httpServer.listen(3000)

// next.js
export const POST = router.fetch

// cloudflare workers, bun
export default server

It can be used as a server on its own or with hono, elysia and itty-router for more features:

import { createHttpServer } from '@xsmcp/server-http'
import { Elysia } from 'elysia'
import { Hono } from 'hono'
import { AutoRouter } from 'itty-router'

const server = createHttpServer({ ...options })

// hono
new Hono()
  .post('/mcp', ({ req }) => server.fetch(req.raw))

// elysia
new Elysia()
  .post('/mcp', ({ request }) => server.fetch(request))

// itty-router
AutoRouter()
  .post('/mcp', req => server.fetch(req))

At the same time, it does not depends on any server framework thus minimizing the size.

For simplicity reasons, this server only returns JSON Response, not SSE.

License

MIT

Third Party Licenses

This project partially copies code from the following projects:

Project License
modelcontextprotocol/specification MIT
modelcontextprotocol/servers MIT
modelcontextprotocol/typescript-sdk MIT
crouchcd/pkce-challenge MIT
denoland/std MIT

About

๐Ÿค–๐Ÿ“Ž extra-small MCP SDK for quick client/server builds.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published