MCP Server Manager

This is an HTTP handler that serves as an MCP (Model Control Protocol) server with tools to create and manage structured MCP server projects.

Features

  • Create new MCP server projects with a structured file organization
  • Add new tools to existing MCP server projects
  • Update files in MCP server projects
  • Get template code for MCP server files

Project Structure

This MCP server manager follows this structure:

project/
├── main.tsx           # Main entry point with MCP handler
├── tools/
│   ├── create-mcp-project.ts  # Tool to create new MCP projects
│   ├── add-tool-to-project.ts # Tool to add tools to projects
│   ├── update-project-file.ts # Tool to update project files
│   └── get-mcp-templates.ts   # Tool to get MCP templates
└── resources/
    ├── mcp-templates.ts       # Templates for MCP server files
    └── val-town-api.ts        # Val Town API utilities

Each MCP server project created by this tool follows this structure:

project/
├── main.tsx           # Main entry point with MCP handler
└── tools/
    ├── echo.ts        # Default echo tool
    └── [toolName].ts  # Additional tools

Tools

1. create_mcp_project

Creates a new MCP server project with a structured file organization.

Parameters:

  • name: Name of the project to create
  • description: Description of the project

2. add_tool_to_project

Adds a new tool to an existing MCP server project.

Parameters:

  • projectId: ID of the project to update
  • toolName: Name of the tool to add
  • toolDescription: Description of the tool
  • inputSchema: Input schema for the tool (e.g., {"message": "z.string().describe(\"Message to process\")"}

3. update_project_file

Updates a file in an MCP server project.

Parameters:

  • projectId: ID of the project
  • filePath: Path of the file to update
  • content: New content for the file

4. get_mcp_templates

Gets the MCP server template code for various files.

Parameters:

  • templateType: Type of template to get (main or tool)

Setup Requirements

This val requires the following environment variables:

  • VAL_TOWN_API_KEY: Your Val Town API key for creating and updating projects
  • REDIS_URL: Redis URL for the MCP server (used by @vercel/mcp-adapter)

Usage

This val is designed to be used as an MCP server endpoint that can be connected to by AI assistants that support the MCP protocol. The assistant can then use the provided tools to create and manage MCP server projects with a structured approach.

File Templates

main.tsx

The main entry point for the MCP server that imports and registers all tools.

tools/[toolName].ts

Each tool is defined in its own file with a consistent structure including:

  • Name
  • Description
  • Input schema
  • Handler function