Generic MCP Server

by shcallaway

184 downloads
Not rated
GitHub

Description

# Generic MCP Server A generic Model Context Protocol (MCP) server scaffold that can be extended with custom tools and functionality. ## Installation 1. Clone this repository: ```bash git clone <your-repo-url> cd <repo-directory> ``` 2. Install dependencies: ```bash pnpm install…

About

# Generic MCP Server A generic Model Context Protocol (MCP) server scaffold that can be extended with custom tools and functionality. ## Installation 1. Clone this repository: ```bash git clone <your-repo-url> cd <repo-directory> ``` 2. Install dependencies: ```bash pnpm install ``` 3. Build the project: ```bash pnpm…

Details

Author
shcallaway
Downloads
184
Categories
Other

- Custom tool scaffolding with Zod schema validation
- Integrates natively with Claude Desktop via MCP
- TypeScript-based project structure for type safety
- Supports arbitrary environment variables for API keys
- Pre‑configured build, watch, and prepare scripts

Clone the repository, install dependencies with pnpm install, build with pnpm run build, then configure Claude Desktop by editing its claude_desktop_config.json to point to the built server executable and provide required environment variables.

Generic MCP Server

A generic Model Context Protocol (MCP) server scaffold that can be extended with custom tools and functionality.

Installation

1. Clone this repository:

git clone <your-repo-url>
cd <repo-directory>

2. Install dependencies:

pnpm install

3. Build the project:

pnpm run build

Setting up with Claude Desktop

To use this MCP server with Claude Desktop, you need to add it to Claude's configuration file. Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

1. Open the configuration file:

open ~/Library/Application\ Support/Claude/claude_desktop_config.json

2. Add the following configuration to the mcpServers object:

{
  "mcpServers": {
    "datadog-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/your/dist/index.js"],
      "env": {
        "DD_API_KEY": "your_api_key",
        "DD_APP_KEY": "your_app_key",
        "DD_HOST": "https://api.datadoghq.eu",
        "NODE_ENV": "production"
      },
      "disabled": false,
      "alwaysAllow": true
    }
  }
}

Make sure to:

1. Replace /absolute/path/to/your with the actual absolute path to your project's dist directory
2. Set your Datadog API key in DD_API_KEY
3. Set your Datadog application key in DD_APP_KEY
4. Adjust the DD_HOST if you're using a different Datadog region

Note: Keep your API keys secure and never commit them to version control.

Development

Project Structure

- index.ts: Main server file containing the MCP server implementation
- tsconfig.json: TypeScript configuration
- package.json: Project dependencies and scripts

Adding New Tools

1. Define your tool's schema using Zod:

const MyToolSchema = z.object({
  // your tool's parameters
});

2. Add your tool to the ListToolsRequestSchema handler:

{
  name: "my_tool",
  description: "Description of what your tool does",
  inputSchema: zodToJsonSchema(MyToolSchema) as ToolInput,
}

3. Implement your tool in the CallToolRequestSchema handler:

case "my_tool": {
  const parsed = MyToolSchema.safeParse(args);
  if (!parsed.success) {
    throw new Error(Invalid arguments for my_tool: ${parsed.error});
  }
  // Your tool's implementation
  return {
    content: [{ type: "text", text: "Your tool's response" }],
  };
}

Scripts

- pnpm run build: Build the TypeScript project
- pnpm run prepare: Run build before publishing
- pnpm run watch: Watch for changes and rebuild

Dependencies

- @modelcontextprotocol/sdk: MCP server SDK
- zod: Schema validation
- zod-to-json-schema: Convert Zod schemas to JSON Schema
- TypeScript and related development tools

License

MIT

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.