packages feed

mcp-server 0.1.0.2 → 0.1.0.3

raw patch · 9 files changed

+147/−508 lines, 9 filesnew-component:exe:complete-examplenew-component:exe:simple-examplePVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

− SPEC.md
@@ -1,201 +0,0 @@--# NOTICE--This file is kept for brevity - but served as my starting specification before writing the library. This may no longer be useful and will be superceded by examples in the examples/ folder.--# Haskell MCP Server Library--Fully featured haskell library for building MCP Servers.--## MCP Specification - Model Context Protocol--The MCP spec is a specialisation of the JSON-RPC specification, exposing a number of requests and responses. This library allows developers to build these servers easily in haskell.--This library is compliant with the following MCP specifications for building MCP Servers which can be found here:--| Item | Spec URL |-| Overview | https://modelcontextprotocol.io/specification/2024-11-05/server |-| Prompts | https://modelcontextprotocol.io/specification/2024-11-05/server/prompts |-| Resources | https://modelcontextprotocol.io/specification/2024-11-05/server/resources |-| Tools | https://modelcontextprotocol.io/specification/2024-11-05/server/tools |--# Library itself--Supports 2 levels of granularity:--## 1. Lowest-level fine grained handling of Prompts, Resources and Tools, e.g.:--Using an example of a grocery shopping MCP server:--```haskell--import MCP.Server.Types (Content(ContentText, ContentImage), Error(InvalidPromptName, MissingRequiredParams, ResourceNotFound, InternalError, UnknownTool), PromptDefinition, ResourceDefinition, ArgumentDefinition, InputSchemaDefinition(..), PaginatedResult(..), Cursor)-import Network.URI (URI(URI))-import qualified Data.Map as Map--type PromptName = Text-type ToolName = Text-type ArgumentName = Text-type ArgumentValue = Text--handleListPrompts :: (Monad m) => Maybe Cursor -> m (PaginatedResult [PromptDefinition])-handleListPrompts cursor =-    pure $ PaginatedResult-        { paginatedItems = -            [ PromptDefinition-                { promptDefinitionName = "recipe"-                , promptDefinitionDescription = "Generate a detailed recipe for a particular idea" -                , promptDefinitionArguments = -                    [ ArgumentDefinition-                        { argumentDefinitionName = "idea"-                        , argumentDefinitionDescription = "inspiring idea for the recipe" -                        , argumentDefinitionRequired = True-                        }-                    ]-                }-            ]-        , paginatedNextCursor = Nothing  -- No more pages-        }--handleListResources :: (Monad m) => Maybe Cursor -> m (PaginatedResult [ResourceDefinition])-handleListResources cursor = -    pure $ PaginatedResult-        { paginatedItems =-            [ ResourceDefinition-                { resourceDefinitionURI = "file:///product_categories"-                , resourceDefinitionName = "product_categories"-                , resourceDefinitionDescription = "List of product categories"-                , resourceDefinitionMimeType = "text/plain"-                }-            ]-        , paginatedNextCursor = Nothing  -- No more pages-        }--handleListTools :: (Monad m) => Maybe Cursor -> m (PaginatedResult [ToolDefinition])-handleListTools cursor = -    pure $ PaginatedResult-        { paginatedItems =-            [ ToolDefinition-                { toolDefinitionName = "search_for_product" -                , toolDefinitionDescription = "Search for products in the catalog"-                , toolDefinitionInputSchema = -                    InputSchemaDefinitionObject-                        { properties = -                            [   ("q"-                                , InputSchemaDefinitionProperty-                                    { type = "string"-                                    , description = "Matching this query, using 'contains' semantics"-                                    }-                                )-                            ,   ("category"-                                , InputSchemaDefinitionProperty-                                    { type = "string"-                                    , description = "Limit to searching within this category (optional)"-                                    }-                                )-                            ]-                        , required = ["q"]-                        }-                }-            ]-        , paginatedNextCursor = Nothing  -- No more pages-        }--handleGetPrompt :: (Monad m) => PromptName -> [(ArgumentName, ArgumentValue)] -> m (Either Error Content)-handleGetPrompt "recipe" args = do-    let idea = Map.lookup "idea" $ Map.fromList args  -- idea is required-     in case idea of-            Just idea' -> pure $ Right $ ContentText $ "Recipe prompt for " <> idea' <> " ..."-            Nothing -> pure $ Left $ MissingRequiredParams "field 'idea' is missing"-handleGetPrompt prompt _ = pure $ Left $ InvalidPromptName $ prompt <> " unknown!"--handleReadResource :: (Monad m) => URI -> m (Either Error Content)-handleReadResource uri = do-    case uriPath uri of-        "/product_categories" -> pure $ Right $ ContentText $ "category 1, category 2"-        unknown -> pure $ Left $ ResourceNotFound $ "Resouce " <> unknown <> " not found!"--handleCallTool :: (Monad m) => ToolName -> [(ArgumentName, ArgumentValue)] -> m (Either Error Content)-handleCallTool "search_for_product" args = do-    let q = Map.lookup "q" $ Map.fromList args                  -- q is required-    let category = Map.lookup "category" $ Map.fromList args    -- category is optional-     in case q of-            Nothing -> pure $ Left $ MissingRequiredParams "field 'q' is missing"-            Just q' -> pure $ Right $ ContentText $ "product 1, product 2"-handleCallTool tool _ = pure $ Left $ UnknownTool $ tool <> " unknown!"---- Running the MCP server using STDIO--main :: IO ()-main =-    runMcpServerStdIn-        McpServerInfo-            { serverName = "Products available at your Grocery Store"-            , serverVersion = "0.1.0"-            , serverInstructions = "Use these tools to fetch information about products available at your grocery store, including prices, ingredients, descriptions etc."-            }-        McpServerHandlers-            { prompts = Just (handleListPrompts, handleGetPrompt)-            , resources = Just (handleListResources, handleReadResource)-            , tools = Just (handleListTools, handleCallTool)-            }--```--## 2. High-level derived interfaces for simpler definitions--High level MCP server definitions take advantage of Template Haskell for generating all the boilerplate of the low-level definitions, but allow for much simpler and type safe definitions such as in the example below.--```haskell--import MCP.Server.Types (Content(ContentText, ContentImage))--data MyPrompt-    = Recipe { idea :: Text }-    | Shopping { description :: Text }--data MyResource-    = ProductCategories-    | SaleItems-    | HeadlineBannerAd--data MyTool-    = SearchForProduct { q :: Text, category :: Maybe Text }-    | AddToCart { sku :: Text }-    | Checkout--handlePrompt :: (MonadIO m) => MyPrompt -> m Content-handlePrompt (Recipe idea) =-    pure $ ContentText "Recipe prompt goes here..."-handlePrompt (Shopping description) =-    pure $ ContentText "Shopping prompt goes here..."--handleResource :: (MonadIO m) => MyResource -> m Content-handleResource ProductCategories = pure $ ContentText "category 1, category 2"-handleResource SaleItems = pure $ ContentText "item 1, item 2, item 3"-handleResource HeadlineBannerAd = pure $ ContentImage { mimeType = "image/png", data = "..." }--handleTool :: (MonadIO m) => MyTool -> m Content-handleTool (SearchForProduct q category) = pure $ ContentText "search results..."-handleTool (AddToCart sku) = pure $ ContentText "Item added to cart!"-handleTool Checkout = pure $ ContentText "checkout completed!"--main =-    -- Derive the handlers-    let prompts = $(derivePromptHandler ''MyPrompt 'handlePrompt)-        resources = $(deriveResourceHandler ''MyResource 'handleResource)-        tools = $(deriveToolHandler ''MyTool 'handleTool)-     in runMcpServerStdIn-        McpServerInfo-            { serverName = "Products available at your Grocery Store"-            , serverVersion = "0.1.0"-            , serverInstructions = "Use these tools to fetch information about products available at your grocery store, including prices, ingredients, descriptions etc."-            }-        McpServerHandlers-            { prompts = Just prompts-            , resources = Just resources-            , tools = Just tools-            }--```-
+ examples/Complete/Main.hs view
@@ -0,0 +1,56 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell   #-}++module Main where++import           MCP.Server+import           MCP.Server.Derive+import           System.IO         (hPutStrLn, stderr)+import           Types++-- High-level handler functions++handlePrompt :: MyPrompt -> IO Content+handlePrompt (Recipe idea) =+    pure $ ContentText $ "Recipe prompt for " <> idea <> ": Start by gathering fresh ingredients..."+handlePrompt (Shopping description) =+    pure $ ContentText $ "Shopping prompt for " <> description <> ": Create a detailed shopping list..."++handleResource :: MyResource -> IO Content+handleResource ProductCategories = pure $ ContentText "Fresh Produce, Dairy, Bakery, Meat & Seafood, Frozen Foods"+handleResource SaleItems = pure $ ContentText "Organic Apples $2.99/lb, Free Range Eggs $4.50/dozen, Artisan Bread $3.25/loaf"+handleResource HeadlineBannerAd = pure $ ContentText "🛒 Weekly Special: 20% off all organic produce! 🥕🥬🍎"++handleTool :: MyTool -> IO Content+handleTool (SearchForProduct q category) =+    case category of+        Nothing -> pure $ ContentText $ "Search results for '" <> q <> "': Found 15 products across all categories"+        Just cat -> pure $ ContentText $ "Search results for '" <> q <> "' in " <> cat <> ": Found 8 products"+handleTool (AddToCart sku) = pure $ ContentText $ "Added item " <> sku <> " to your cart. Cart total: 3 items"+handleTool Checkout = pure $ ContentText "Checkout completed! Order #12345 confirmed. Thank you for shopping with us!"+handleTool (ComplexTool field1 field2 field3 field4 field5) =+    pure $ ContentText $ "Complex tool called with: " <> field1 <> ", " <> field2 <>+                        maybe "" (", " <>) field3 <> ", " <> field4 <>+                        maybe "" (", " <>) field5++main :: IO ()+main = do+    hPutStrLn stderr "Starting Template Haskell MCP Server..."+    hPutStrLn stderr "Using automatic Template Haskell derivation!"+    hPutStrLn stderr "Ready for JSON-RPC communication"++    -- Derive the handlers using Template Haskell+    let prompts = $(derivePromptHandler ''MyPrompt 'handlePrompt)+        resources = $(deriveResourceHandler ''MyResource 'handleResource)+        tools = $(deriveToolHandler ''MyTool 'handleTool)+     in runMcpServerStdIn+        McpServerInfo+            { serverName = "Template Haskell MCP Server"+            , serverVersion = "0.3.0"+            , serverInstructions = "MCP server using Template Haskell for automatic handler derivation"+            }+        McpServerHandlers+            { prompts = Just prompts+            , resources = Just resources+            , tools = Just tools+            }
+ examples/Complete/Types.hs view
@@ -0,0 +1,25 @@+{-# LANGUAGE OverloadedStrings #-}++module Types where++import           Data.Text (Text)++-- High-level data type definitions from SPEC.md++data MyPrompt+    = Recipe { idea :: Text }+    | Shopping { description :: Text }+    deriving (Show, Eq)++data MyResource+    = ProductCategories+    | SaleItems+    | HeadlineBannerAd+    deriving (Show, Eq)++data MyTool+    = SearchForProduct { q :: Text, category :: Maybe Text }+    | AddToCart { sku :: Text }+    | Checkout+    | ComplexTool { field1 :: Text, field2 :: Text, field3 :: Maybe Text, field4 :: Text, field5 :: Maybe Text }+    deriving (Show, Eq)
− examples/HighLevel.hs
@@ -1,214 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--module Main where--import qualified Data.Map    as Map-import           Data.Text   (Text)-import qualified Data.Text   as T-import           MCP.Server-import           Network.URI (URI)-import           System.IO   (hPutStrLn, stderr)---- High-level data type definitions from SPEC.md--data MyPrompt-    = Recipe { idea :: Text }-    | Shopping { description :: Text }-    deriving (Show, Eq)--data MyResource-    = ProductCategories-    | SaleItems-    | HeadlineBannerAd-    deriving (Show, Eq)--data MyTool-    = SearchForProduct { q :: Text, category :: Maybe Text }-    | AddToCart { sku :: Text }-    | Checkout-    deriving (Show, Eq)---- High-level handler functions--handlePrompt :: MyPrompt -> IO Content-handlePrompt (Recipe idea) =-    pure $ ContentText $ "Recipe prompt for " <> idea <> ": Start by gathering fresh ingredients..."-handlePrompt (Shopping description) =-    pure $ ContentText $ "Shopping prompt for " <> description <> ": Create a detailed shopping list..."--handleResource :: MyResource -> IO Content-handleResource ProductCategories = pure $ ContentText "Fresh Produce, Dairy, Bakery, Meat & Seafood, Frozen Foods"-handleResource SaleItems = pure $ ContentText "Organic Apples $2.99/lb, Free Range Eggs $4.50/dozen, Artisan Bread $3.25/loaf"-handleResource HeadlineBannerAd = pure $ ContentText "🛒 Weekly Special: 20% off all organic produce! 🥕🥬🍎"--handleTool :: MyTool -> IO Content-handleTool (SearchForProduct q category) =-    case category of-        Nothing -> pure $ ContentText $ "Search results for '" <> q <> "': Found 15 products across all categories"-        Just cat -> pure $ ContentText $ "Search results for '" <> q <> "' in " <> cat <> ": Found 8 products"-handleTool (AddToCart sku) = pure $ ContentText $ "Added item " <> sku <> " to your cart. Cart total: 3 items"-handleTool Checkout = pure $ ContentText "Checkout completed! Order #12345 confirmed. Thank you for shopping with us!"---- Manual derivation (we'll replace this with Template Haskell later)--promptListHandler :: Maybe Cursor -> IO (PaginatedResult [PromptDefinition])-promptListHandler _ = pure $ PaginatedResult-    { paginatedItems =-        [ PromptDefinition-            { promptDefinitionName = "recipe"-            , promptDefinitionDescription = "Generate a detailed recipe for a particular idea"-            , promptDefinitionArguments =-                [ ArgumentDefinition-                    { argumentDefinitionName = "idea"-                    , argumentDefinitionDescription = "inspiring idea for the recipe"-                    , argumentDefinitionRequired = True-                    }-                ]-            }-        , PromptDefinition-            { promptDefinitionName = "shopping"-            , promptDefinitionDescription = "Create a shopping list"-            , promptDefinitionArguments =-                [ ArgumentDefinition-                    { argumentDefinitionName = "description"-                    , argumentDefinitionDescription = "description of what to shop for"-                    , argumentDefinitionRequired = True-                    }-                ]-            }-        ]-    , paginatedNextCursor = Nothing-    }--promptGetHandler :: PromptName -> [(ArgumentName, ArgumentValue)] -> IO (Either Error Content)-promptGetHandler "recipe" args = do-    case Map.lookup "idea" (Map.fromList args) of-        Nothing -> pure $ Left $ MissingRequiredParams "field 'idea' is missing"-        Just idea -> do-            content <- handlePrompt (Recipe idea)-            pure $ Right content-promptGetHandler "shopping" args = do-    case Map.lookup "description" (Map.fromList args) of-        Nothing -> pure $ Left $ MissingRequiredParams "field 'description' is missing"-        Just desc -> do-            content <- handlePrompt (Shopping desc)-            pure $ Right content-promptGetHandler name _ = pure $ Left $ InvalidPromptName $ "Unknown prompt: " <> name--resourceListHandler :: Maybe Cursor -> IO (PaginatedResult [ResourceDefinition])-resourceListHandler _ = pure $ PaginatedResult-    { paginatedItems =-        [ ResourceDefinition-            { resourceDefinitionURI = "resource://productcategories"-            , resourceDefinitionName = "productcategories"-            , resourceDefinitionDescription = Just "Fresh produce, dairy, and other categories"-            , resourceDefinitionMimeType = Just "text/plain"-            }-        , ResourceDefinition-            { resourceDefinitionURI = "resource://saleitems"-            , resourceDefinitionName = "saleitems"-            , resourceDefinitionDescription = Just "Current sale items and discounts"-            , resourceDefinitionMimeType = Just "text/plain"-            }-        , ResourceDefinition-            { resourceDefinitionURI = "resource://headlinebannerad"-            , resourceDefinitionName = "headlinebannerad"-            , resourceDefinitionDescription = Just "Weekly promotional banner"-            , resourceDefinitionMimeType = Just "text/plain"-            }-        ]-    , paginatedNextCursor = Nothing-    }--resourceReadHandler :: URI -> IO (Either Error Content)-resourceReadHandler uri = do-    case show uri of-        "resource://productcategories" -> Right <$> handleResource ProductCategories-        "resource://saleitems" -> Right <$> handleResource SaleItems-        "resource://headlinebannerad" -> Right <$> handleResource HeadlineBannerAd-        unknown -> pure $ Left $ ResourceNotFound $ "Resource not found: " <> T.pack unknown--toolListHandler :: Maybe Cursor -> IO (PaginatedResult [ToolDefinition])-toolListHandler _ = pure $ PaginatedResult-    { paginatedItems =-        [ ToolDefinition-            { toolDefinitionName = "searchforproduct"-            , toolDefinitionDescription = "Search for products in the catalog"-            , toolDefinitionInputSchema =-                InputSchemaDefinitionObject-                    { properties =-                        [ ("q", InputSchemaDefinitionProperty-                            { propertyType = "string"-                            , propertyDescription = "Search query"-                            })-                        , ("category", InputSchemaDefinitionProperty-                            { propertyType = "string"-                            , propertyDescription = "Optional category filter"-                            })-                        ]-                    , required = ["q"]-                    }-            }-        , ToolDefinition-            { toolDefinitionName = "addtocart"-            , toolDefinitionDescription = "Add an item to shopping cart"-            , toolDefinitionInputSchema =-                InputSchemaDefinitionObject-                    { properties =-                        [ ("sku", InputSchemaDefinitionProperty-                            { propertyType = "string"-                            , propertyDescription = "Product SKU"-                            })-                        ]-                    , required = ["sku"]-                    }-            }-        , ToolDefinition-            { toolDefinitionName = "checkout"-            , toolDefinitionDescription = "Complete the checkout process"-            , toolDefinitionInputSchema =-                InputSchemaDefinitionObject-                    { properties = []-                    , required = []-                    }-            }-        ]-    , paginatedNextCursor = Nothing-    }--toolCallHandler :: ToolName -> [(ArgumentName, ArgumentValue)] -> IO (Either Error Content)-toolCallHandler "searchforproduct" args = do-    case Map.lookup "q" (Map.fromList args) of-        Nothing -> pure $ Left $ MissingRequiredParams "field 'q' is missing"-        Just q -> do-            let category = Map.lookup "category" (Map.fromList args)-            content <- handleTool (SearchForProduct q category)-            pure $ Right content-toolCallHandler "addtocart" args = do-    case Map.lookup "sku" (Map.fromList args) of-        Nothing -> pure $ Left $ MissingRequiredParams "field 'sku' is missing"-        Just sku -> do-            content <- handleTool (AddToCart sku)-            pure $ Right content-toolCallHandler "checkout" _ = do-    content <- handleTool Checkout-    pure $ Right content-toolCallHandler name _ = pure $ Left $ UnknownTool $ "Unknown tool: " <> name--main :: IO ()-main = do-    hPutStrLn stderr "Starting High-Level Grocery Store MCP Server..."-    hPutStrLn stderr "Using manually derived handlers (Template Haskell coming soon!)"-    hPutStrLn stderr "Ready for JSON-RPC communication"--    runMcpServerStdIn-        McpServerInfo-            { serverName = "High-Level Grocery Store MCP Server"-            , serverVersion = "0.2.0"-            , serverInstructions = "Advanced grocery store server with type-safe high-level handlers"-            }-        McpServerHandlers-            { prompts = Just (promptListHandler, promptGetHandler)-            , resources = Just (resourceListHandler, resourceReadHandler)-            , tools = Just (toolListHandler, toolCallHandler)-            }
+ examples/Simple/Main.hs view
@@ -0,0 +1,47 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell   #-}++module Main where++import           Data.IORef+import           Data.Text         (Text)+import           MCP.Server+import           MCP.Server.Derive+import           System.IO         (hPutStrLn, stderr)+import           Types++main :: IO ()+main = do+    hPutStrLn stderr "Starting Simple MCP Server..."++    -- Create a simple in-memory store+    store <- newIORef []++    let handleTool :: SimpleTool -> IO Content+        handleTool (GetValue k) = do+            pairs <- readIORef store+            case lookup k pairs of+                Nothing -> pure $ ContentText $ "Key '" <> k <> "' not found"+                Just v  -> pure $ ContentText v+        handleTool (SetValue k v) = do+            pairs <- readIORef store+            let newPairs = (k, v) : filter ((/= k) . fst) pairs+            writeIORef store newPairs+            pure $ ContentText $ "Set '" <> k <> "' to '" <> v <> "'"++    hPutStrLn stderr "Using Template Haskell derivation for tools"+    hPutStrLn stderr "Ready for JSON-RPC communication"++    -- Derive the tool handlers using Template Haskell+    let tools = $(deriveToolHandler ''SimpleTool 'handleTool)+     in runMcpServerStdIn+        McpServerInfo+            { serverName = "Simple Key-Value MCP Server"+            , serverVersion = "1.0.0"+            , serverInstructions = "A simple key-value store with GetValue and SetValue tools"+            }+        McpServerHandlers+            { prompts = Nothing+            , resources = Nothing+            , tools = Just tools+            }
+ examples/Simple/Types.hs view
@@ -0,0 +1,10 @@+{-# LANGUAGE OverloadedStrings #-}++module Types where++import           Data.Text (Text)++data SimpleTool+    = GetValue { key :: Text }+    | SetValue { key :: Text, value :: Text }+    deriving (Show, Eq)
− examples/TemplateHaskell.hs
@@ -1,56 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell   #-}--module Main where--import           MCP.Server-import           MCP.Server.Derive-import           System.IO         (hPutStrLn, stderr)-import           Types---- High-level handler functions--handlePrompt :: MyPrompt -> IO Content-handlePrompt (Recipe idea) =-    pure $ ContentText $ "Recipe prompt for " <> idea <> ": Start by gathering fresh ingredients..."-handlePrompt (Shopping description) =-    pure $ ContentText $ "Shopping prompt for " <> description <> ": Create a detailed shopping list..."--handleResource :: MyResource -> IO Content-handleResource ProductCategories = pure $ ContentText "Fresh Produce, Dairy, Bakery, Meat & Seafood, Frozen Foods"-handleResource SaleItems = pure $ ContentText "Organic Apples $2.99/lb, Free Range Eggs $4.50/dozen, Artisan Bread $3.25/loaf"-handleResource HeadlineBannerAd = pure $ ContentText "🛒 Weekly Special: 20% off all organic produce! 🥕🥬🍎"--handleTool :: MyTool -> IO Content-handleTool (SearchForProduct q category) =-    case category of-        Nothing -> pure $ ContentText $ "Search results for '" <> q <> "': Found 15 products across all categories"-        Just cat -> pure $ ContentText $ "Search results for '" <> q <> "' in " <> cat <> ": Found 8 products"-handleTool (AddToCart sku) = pure $ ContentText $ "Added item " <> sku <> " to your cart. Cart total: 3 items"-handleTool Checkout = pure $ ContentText "Checkout completed! Order #12345 confirmed. Thank you for shopping with us!"-handleTool (ComplexTool field1 field2 field3 field4 field5) = -    pure $ ContentText $ "Complex tool called with: " <> field1 <> ", " <> field2 <> -                        maybe "" (", " <>) field3 <> ", " <> field4 <> -                        maybe "" (", " <>) field5--main :: IO ()-main = do-    hPutStrLn stderr "Starting Template Haskell MCP Server..."-    hPutStrLn stderr "Using automatic Template Haskell derivation!"-    hPutStrLn stderr "Ready for JSON-RPC communication"--    -- Derive the handlers using Template Haskell-    let prompts = $(derivePromptHandler ''MyPrompt 'handlePrompt)-        resources = $(deriveResourceHandler ''MyResource 'handleResource)-        tools = $(deriveToolHandler ''MyTool 'handleTool)-     in runMcpServerStdIn-        McpServerInfo-            { serverName = "Template Haskell MCP Server"-            , serverVersion = "0.3.0"-            , serverInstructions = "MCP server using Template Haskell for automatic handler derivation"-            }-        McpServerHandlers-            { prompts = Just prompts-            , resources = Just resources-            , tools = Just tools-            }
− examples/Types.hs
@@ -1,25 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}--module Types where--import           Data.Text (Text)---- High-level data type definitions from SPEC.md--data MyPrompt-    = Recipe { idea :: Text }-    | Shopping { description :: Text }-    deriving (Show, Eq)--data MyResource-    = ProductCategories-    | SaleItems-    | HeadlineBannerAd-    deriving (Show, Eq)--data MyTool-    = SearchForProduct { q :: Text, category :: Maybe Text }-    | AddToCart { sku :: Text }-    | Checkout-    | ComplexTool { field1 :: Text, field2 :: Text, field3 :: Maybe Text, field4 :: Text, field5 :: Maybe Text }-    deriving (Show, Eq)
mcp-server.cabal view
@@ -15,7 +15,7 @@ -- PVP summary:     +-+------- breaking API changes --                  | | +----- non-breaking API additions --                  | | | +--- code changes with no API change-version: 0.1.0.2+version: 0.1.0.3 -- A short (one-line) description of the package. synopsis: Library for building Model Context Protocol (MCP) servers -- A longer description of the package.@@ -47,8 +47,7 @@   README.md  -- Extra source files to be distributed with the package, such as examples, or a tutorial module.-extra-source-files: SPEC.md-+-- extra-source-files: SPEC.md -- Source repository information source-repository head   type: git@@ -109,33 +108,31 @@   -- Base language which the package is written in.   default-language: GHC2024 -executable high-level-example+executable simple-example   -- Import common warning flags.   import: warnings   -- .hs or .lhs file containing the Main module.-  main-is: HighLevel.hs+  main-is: Main.hs   -- Modules included in this executable, other than Main.-  -- other-modules:+  other-modules: Types   -- LANGUAGE extensions used by modules in this package.   -- other-extensions:   -- Other library packages from which modules are imported.   build-depends:     base ^>=4.20.0.0,-    containers >=0.6 && <0.8,     mcp-server,-    network-uri >=2.6 && <2.8,     text >=1.2 && <3.0,    -- Directories containing source files.-  hs-source-dirs: examples+  hs-source-dirs: examples/Simple   -- Base language which the package is written in.   default-language: GHC2024 -executable template-haskell-example+executable complete-example   -- Import common warning flags.   import: warnings   -- .hs or .lhs file containing the Main module.-  main-is: TemplateHaskell.hs+  main-is: Main.hs   -- Modules included in this executable, other than Main.   other-modules: Types   -- LANGUAGE extensions used by modules in this package.@@ -147,7 +144,7 @@     text >=1.2 && <3.0,    -- Directories containing source files.-  hs-source-dirs: examples+  hs-source-dirs: examples/Complete   -- Base language which the package is written in.   default-language: GHC2024