@forgedevstack/forge-mcp

@forgedevstack/forge-mcp

Tiny helper for building API-key-protected stdio MCP servers. Wraps the official @modelcontextprotocol/sdk so you define tools with plain JSON schemas — no zod, no boilerplate — and get a working server with one call.

Category
Visit Server

README

@forgedevstack/forge-mcp

Tiny helper for building API-key-protected stdio MCP servers. Wraps the official @modelcontextprotocol/sdk so you define tools with plain JSON schemas — no zod, no boilerplate — and get a working server with one call.

Part of the ForgeStack family of libraries.

Install

npm install @forgedevstack/forge-mcp

A working MCP server in under 20 lines

import { createMcpServer, textResult } from '@forgedevstack/forge-mcp';

const { start } = createMcpServer({
  name: 'my-server',
  version: '1.0.0',
  apiKey: { envVar: 'MY_API_KEY' },
  tools: [
    {
      name: 'echo',
      description: 'Echo a message',
      inputSchema: { type: 'object', properties: { message: { type: 'string' } }, required: ['message'] },
      handler: (args) => textResult(String(args.message)),
    },
  ],
});

start();

API

createMcpServer(options): ForgeMcpServer

Option Type Description
name string Server name reported to MCP clients
version string Server version reported to MCP clients
tools McpToolDefinition[] Tools exposed via tools/list and tools/call
apiKey ApiKeyConfig (optional) API key resolution; omit if no key is needed

Returns { server, apiKey, start }:

  • server — the underlying SDK Server instance for advanced use
  • apiKey — the resolved API key (pass it to your API clients inside handlers)
  • start() — connects a StdioServerTransport and begins serving

The API key is resolved eagerly, so a misconfigured server fails fast at startup instead of on the first tool call.

Tool definition

interface McpToolDefinition {
  name: string;
  description: string;
  inputSchema: JsonSchema;
  handler: (args: Record<string, unknown>) => Promise<McpToolResult> | McpToolResult;
}

inputSchema is a plain JSON schema object (type, properties, required, items, enum, ...). Handler exceptions are caught and returned as isError results, and calls to unknown tool names return an isError result instead of crashing the server.

API key config

interface ApiKeyConfig {
  envVar?: string;
  value?: string;
  required?: boolean;
}

Precedence: value first, then process.env[envVar] (default env var: MCP_API_KEY). When apiKey is passed and the key is missing, createMcpServer throws unless required: false.

Helpers

  • textResult(text) — { content: [{ type: 'text', text }] }
  • errorResult(text) — same, with isError: true
  • resolveApiKey(config) — standalone key resolution, same rules as above
  • DEFAULT_API_KEY_ENV_VAR — 'MCP_API_KEY'

Wiring into an MCP client

Point your MCP client (Cursor, Claude Desktop, etc.) at your server script and pass the key through env:

{
  "mcpServers": {
    "my-server": {
      "command": "node",
      "args": ["/path/to/my-server.js"],
      "env": { "MY_API_KEY": "your-key-here" }
    }
  }
}

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured