使用说明
@eliware/mcp-server
Pure-ESM Node.js MCP server with automatic tool discovery, Streamable HTTP and stdio transports, TLS, Zod schemas, injectable context, bearer authentication, and generic OAuth2 support.
Table of Contents
- Features
- Requirements
- Setup
- Usage
- Development
- Testing
- Troubleshooting
- Security
- API
- Packaging
- Examples
- Support
- Links
- License
Features
Create MCP servers with Streamable HTTP or stdio, discovered tool modules, Zod input schemas, shared context, and optional authentication.
Requirements
Use Node.js 26 or later. Use an MCP client that supports protocol revision 2026-07-28 and the selected transport.
Setup
Install the package with npm install @eliware/mcp-server. Read the setup guide before you create a server.
Usage
Create a server with mcpServer() and add tool modules in tools/. Read the usage guide, configuration guide, and authentication guide.
Browse the documentation index, specifications index, and release notes.
Tools
Add one .mjs module for each tool in tools/. Read the tool guide for registration and context details.
Resources
The package does not scan resource files. Add resources to the SDK server inside a tool module. Read the tool guide.
Prompts
The package does not scan prompt files. Add prompts to the SDK server inside a tool module. Read the tool guide.
Transport
Use Streamable HTTP or stdio. The package does not support HTTP with SSE. Read the protocol requirements.
Authentication
Select no authentication, a static bearer token, bearer passthrough, or OAuth2 introspection. Use HTTPS for OAuth endpoints. Read the authentication guide.
Schemas
Import z from @eliware/mcp-server to define tool input schemas. Read the tool guide.
Development
Run npm ci to install locked dependencies. Run npm run format to format files. Run npm run format:check to check file formatting.
Run npm run lint for lint checks. Run npm run audit for dependency checks. Run npm run typecheck to check TypeScript declarations.
Testing
Run npm test for aggregate validation. Run npm run pack to check package contents.
Troubleshooting
Read the troubleshooting guide for setup and runtime issues.
Security
Keep tokens, OAuth client secrets, and TLS keys in environment variables or secret files. Use HTTPS and explicit authentication for remote access.
API
Read the API reference for exports, options, and result types.
Packaging
The npm package includes src/, docs/, README.md, AGENTS.md, LICENSE, RELEASE_NOTES.md, examples/, specs/, and .env.example.
Use numeric MAJOR.MINOR.PATCH versions and a v<version> tag for each release. Run npm run pack to check package contents. The npm workflow publishes approved tagged releases.
Examples
Read examples/README.md for server and tool examples.
Support
For help, questions, or to chat with the author and community, visit:
