moikas-code/mcp_server
If you are the rightful owner of mcp_server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
This is a minimal Model Context Protocol (MCP) server using Bun, TypeScript, and the `@modelcontextprotocol/sdk` package.
Bun-based MCP Server
This is a minimal Model Context Protocol (MCP) server using Bun, TypeScript, and the @modelcontextprotocol/sdk package. It demonstrates:
- StdioServerTransport for local testing
- A basic example tool (
add) that adds two numbers - Dynamic tool loading from a (mocked) PostgreSQL database
- Strict TypeScript and ESLint configuration
Setup
- Install Bun.
- Install dependencies:
bun install
Usage
Start the server:
bun run src/index.ts
The server will listen for MCP requests via stdio.
Tool Loading
The function load_tools_from_db simulates loading tool definitions and handlers from a PostgreSQL database. Replace this with real database logic as needed.
Example Tool
The add tool takes two numbers (a and b) and returns their sum as result.
Linting
bun run lint
Type Checking
bun run tsc
File Structure
src/index.ts: Main server entry pointtsconfig.json: TypeScript configuration.eslintrc.json: ESLint configurationpackage.json: Project metadata and scripts