Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,11 @@ test: check-go
lint: check-go
@echo "$(BLUE)Running linter...$(NC)"
golangci-lint run ./...

dist:
mkdir -p dist

clean:
rm -rf bin/* dist/*

release: clean lint test build
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ A command-line interface for interacting with MCP (Model Context Protocol) serve
- [Output Formats](#output-formats)
- [Commands](#commands)
- [Interactive Shell](#interactive-shell)
- [Project Scaffolding](#project-scaffolding)
- [Server Aliases](#server-aliases)
- [Server Modes](#server-modes)
- [Mock Server Mode](#mock-server-mode)
Expand All @@ -42,6 +43,7 @@ MCP Tools provides a versatile CLI for working with Model Context Protocol (MCP)
- Create mock servers for testing client applications
- Proxy MCP requests to shell scripts for easy extensibility
- Create interactive shells for exploring and using MCP servers
- Scaffold new MCP projects with TypeScript support
- Format output in various styles (JSON, pretty-printed, table)
- Support all transport methods (HTTP, stdio)

Expand Down Expand Up @@ -96,6 +98,7 @@ Available Commands:
call Call a tool, resource, or prompt on the MCP server
help Help about any command
mock Create a mock MCP server with tools, prompts, and resources
new Create a new MCP project from templates
proxy Proxy MCP tool requests to shell scripts
prompts List available prompts on the MCP server
resources List available resources on the MCP server
Expand Down Expand Up @@ -272,6 +275,50 @@ Special Commands:
/q, /quit, exit Exit the shell
```

### Project Scaffolding

MCP Tools provides a scaffolding feature to quickly create new MCP servers with TypeScript:

```bash
mkdir my-mcp-server
cd my-mcp-server

# Create a project with specific components
mcp new tool:calculate resource:file prompt:greet

# Create a project with a specific SDK (currently only TypeScript/ts supported)
mcp new tool:calculate --sdk=ts

# Create a project with a specific transport type
mcp new tool:calculate --transport=stdio
mcp new tool:calculate --transport=sse
```

The scaffolding creates a complete project structure with:

- Server setup with chosen transport (stdio or SSE)
- TypeScript configuration with modern ES modules
- Component implementations with proper MCP interfaces
- Automatic wiring of imports and initialization

After scaffolding, you can build and run your MCP server:

```bash
# Install dependencies
npm install

# Build the TypeScript code
npm run build

# Test the server with MCP Tools
mcp tools node build/index.js
```

Project templates are stored in either:
- Local `./templates/` directory
- User's home directory: `~/.mcputils/templates/`
- Next to the MCP Tools executable

## Server Aliases

MCP Tools allows you to save and reuse server commands with friendly aliases:
Expand Down
18 changes: 14 additions & 4 deletions cmd/mcptools/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ func main() {
newMockCmd(),
proxyCmd(),
aliasCmd(),
newNewCmd(),
)

if err := rootCmd.Execute(); err != nil {
Expand Down Expand Up @@ -1282,10 +1283,19 @@ func aliasListCmd() *cobra.Command {

func aliasRemoveCmd() *cobra.Command {
return &cobra.Command{
Use: "remove [alias]",
Use: "remove <name>",
Short: "Remove an MCP server alias",
Args: cobra.ExactArgs(1),
RunE: func(_ *cobra.Command, args []string) error {
Long: `Remove a registered alias for an MCP server command.

Example:
mcp alias remove myfs`,
Args: cobra.ExactArgs(1),
RunE: func(thisCmd *cobra.Command, args []string) error {
if len(args) == 1 && (args[0] == flagHelp || args[0] == flagHelpShort) {
_ = thisCmd.Help()
return nil
}

aliasName := args[0]

aliases, err := alias.Load()
Expand All @@ -1294,7 +1304,7 @@ func aliasRemoveCmd() *cobra.Command {
}

if _, exists := aliases[aliasName]; !exists {
return fmt.Errorf("alias '%s' not found", aliasName)
return fmt.Errorf("alias '%s' does not exist", aliasName)
}

delete(aliases, aliasName)
Expand Down
Loading