pty-mcp-server 0.0.2.0 → 0.0.3.0
raw patch · 4 files changed
+51/−19 lines, 4 filesdep +pms-infra-cmdrundep +pms-infra-watchdep +pms-ui-notification
Dependencies added: pms-infra-cmdrun, pms-infra-watch, pms-ui-notification
Files
- CHANGELOG.md +4/−0
- README.md +13/−10
- app/Main.hs +27/−5
- pty-mcp-server.cabal +7/−4
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for pty-mcp-server +## 0.0.3.0 -- 2025-06-22++* Added file change monitoring for tools-list.json.+ ## 0.0.2.0 -- 2025-06-15 * Updated the README.
README.md view
@@ -56,15 +56,15 @@ Supports argument passing and live code interaction. - **`Scriptable CLI Integration`** - The `pty-mcp-server` supports execution of shell scripts associated with registered tools defined in `tools-list.json`. Each tool must be registered by name, and a corresponding shell script (`.sh`) should exist in the configured `scripts/` directory.+ The `pty-mcp-server` supports execution of shell scripts associated with registered tools defined in `tools-list.json`. Each tool must be registered by name, and a corresponding shell script (`.sh`) should exist in the configured `tools/` directory. This design supports AI-driven workflows by exposing tool interfaces through a predictable scripting mechanism. The AI can issue tool invocations by name, and the server transparently manages execution and interaction. To add a new tool:- 1. Create a shell script named `your-tool.sh` in the `scripts/` directory.+ 1. Create a shell script named `your-tool.sh` in the `tools/` directory. 2. Add an entry in `tools-list.json` with the name `"your-tool"` and appropriate metadata. 3. No need to recompile or modify the server — tools are dynamically resolved by name. - This separation of tool definitions (`tools-list.json`) and implementation (`scripts/your-tool.sh`) ensures clean decoupling and simplifies extensibility.+ This separation of tool definitions (`tools-list.json`) and implementation (`tools/your-tool.sh`) ensures clean decoupling and simplifies extensibility. ### Example Use Cases@@ -180,7 +180,7 @@ - `logLevel`: Sets the logging level. Examples include `"Debug"`, `"Info"`, and `"Error"`. -- `scriptsDir`: +- `toolsDir`: Directory containing script files (shell scripts named after tool names, e.g., `ping.sh`). If a script matching the tool name exists here, it will be executed when the tool is called. This directory must also contain the `tools-list.json` file, which defines the available public tools and their metadata. @@ -286,10 +286,10 @@ In this file, register bash-mcp-server as an MCP server. Specify the command as pty-mcp-server and pass the configuration file config.yaml as an argument. 2. Settings in config.yaml -The config.yaml file defines the log directory, the directory for scripts, and prompt detection patterns. +The config.yaml file defines the log directory, the directory for tools, and prompt detection patterns. These settings establish the environment for the AI to interact with bash through the PTY.-3. Place tools-list.json in the scriptsDir -You need to place tools-list.json in the directory specified by scriptsDir. +3. Place tools-list.json in the toolsDir +You need to place tools-list.json in the directory specified by toolsDir. This file declares the tools available to the AI, including pty-bash and pty-message. 4. AI Connects to Bash and Selects Commands Autonomously The AI connects to bash through the pseudo terminal and @@ -305,11 +305,11 @@ 1. mcp.json Configuration Starts the pty-mcp-server in stdio mode, passing config.yaml as an argument. 2. Overview of config.yaml -Specifies log directory, scripts directory, and prompt strings. -The tools-list.json in scriptsDir defines which tools are exposed.+Specifies log directory, tools directory, and prompt strings. +The tools-list.json in toolsDir defines which tools are exposed. 3. Role of tools-list.json Lists available script tools, with only the script_add tool registered here.-4. Role and Naming Convention of the scripts Folder +4. Role and Naming Convention of the tools Folder Stores executable shell scripts called via the mcp server. The tool names in tools-list.json match the shell script filenames in this folder. 5. Execution from VSCode GitHub Copilot @@ -362,7 +362,10 @@ This package depends on the following packages: - [`pms-ui-request`](https://github.com/phoityne/pms-ui-request) - [`pms-ui-response`](https://github.com/phoityne/pms-ui-response)+- [`pms-ui-notification`](https://github.com/phoityne/pms-ui-notification) - [`pms-infrastructure`](https://github.com/phoityne/pms-infrastructure)+- [`pms-infra-cmdrun`](https://github.com/phoityne/pms-infra-cmdrun)+- [`pms-infra-watch`](https://github.com/phoityne/pms-infra-watch) - [`pms-application-service`](https://github.com/phoityne/pms-application-service) - [`pms-domain-service`](https://github.com/phoityne/pms-domain-service) - [`pms-domain-model`](https://github.com/phoityne/pms-domain-model)
app/Main.hs view
@@ -1,22 +1,29 @@+{-# LANGUAGE MultilineStrings #-}+ module Main where import System.IO import System.Exit import Options.Applicative import qualified Control.Exception.Safe as E+import Paths_pty_mcp_server (version)+import Data.Version (showVersion) import qualified PMS.Application.Service.App.Control as A import qualified PMS.Application.Service.DM.Type as A import qualified PMS.UI.Request.App.Control as URQ import qualified PMS.UI.Response.App.Control as URS+import qualified PMS.UI.Notification.App.Control as UNO import qualified PMS.Infrastructure.App.Control as INF+import qualified PMS.Infra.CmdRun.App.Control as ICR+import qualified PMS.Infra.Watch.App.Control as IWA import qualified PMS.Domain.Service.App.Control as DSR -- | -- main :: IO () main = getArgs >>= \args -> do- let apps = [URQ.run, URS.run, INF.run, DSR.run]+ let apps = [URQ.run, URS.run, UNO.run, INF.run, ICR.run, IWA.run, DSR.run] flip E.catchAny exception $ flip E.finally finalize $ A.run args apps@@ -44,12 +51,27 @@ -- | -- parseInfo :: ParserInfo A.ArgData-parseInfo = info options $ mconcat+parseInfo = info (helper <*> verOpt <*> options) $ mconcat [ fullDesc- , header "This is app program."- , footer "Copyright 2025. All Rights Reserved."- , progDesc "This is app program description."+ , header "pty-mcp-server - Pseudo-terminal MCP Server"+ , footer "Copyright (c) 2025 phoityne. All rights reserved."+ , progDesc """+ A minimal PTY-based server for running shell commands in MCP style. + Designed for AI to control interactive programs like GHCi or bash.+ """ ]++-- |+--+verOpt :: Parser (a -> a)+verOpt = infoOption msg $ mconcat+ [ short 'v'+ , long "version"+ , help "Show version"+ ]+ where+ msg = "pty-mcp-server-" ++ showVersion version+ -- | --
pty-mcp-server.cabal view
@@ -20,7 +20,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.0.2.0+version: 0.0.3.0 -- A short (one-line) description of the package. synopsis: pty-mcp-server@@ -55,14 +55,14 @@ -- extra-source-files: executable pty-mcp-server- ghc-options: -Wall -static+ ghc-options: -Wall -static -threaded -- .hs or .lhs file containing the Main module. main-is: Main.hs -- Modules included in this executable, other than Main.- -- other-modules:-+ other-modules: Paths_pty_mcp_server+ autogen-modules: Paths_pty_mcp_server -- LANGUAGE extensions used by modules in this package. -- other-extensions: @@ -72,7 +72,10 @@ optparse-applicative, pms-ui-request, pms-ui-response,+ pms-ui-notification, pms-infrastructure,+ pms-infra-cmdrun,+ pms-infra-watch, pms-application-service, pms-domain-service, pms-domain-model