Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MCP server for solace-tryme-cli

License

NotificationsYou must be signed in to change notification settings

SolaceLabs/solace-tryme-cli-mcp-server

Contributor Covenant

Solace TryMe CLI MCP Server

A Model Context Protocol (MCP) server that exposes Solace Try-Me CLI (STM) functionality to Large Language Models through CLI command wrapping.

Overview

This proof of concept demonstrates how to integrate STM's event feed management capabilities with LLMs via the MCP protocol. The current implementation uses CLI command wrapping for rapid development, with a clear path to direct function integration in future iterations.

Prerequisites

  • Node.js 18+
  • Solace Try-Me CLI (STM) v0.0.83 or later installed and available in PATH
  • MCP Inspector for testing:yarn global add @modelcontextprotocol/inspector

Installation

# Clone the repository with submodulesgit clone --recurse-submodules https://github.com/your-org/solace-tryme-agent.gitcd solace-tryme-agent# Or if already cloned, initialize submodulesgit submodule update --init --recursive# Install dependenciesyarn install# Verify STM is availablestm --version

Note: This project includes the STM CLI source code as a git submodule (atsolace-tryme-cli/) for reference purposes. The submodule is pinned to v0.0.83.

Available Tools

1.stm_help

Get help information about STM CLI commands.

Parameters:

  • command (optional): Specific STM command to get help for

2.stm_feed_list

List available event feeds (local and community).

Parameters:

  • source (optional):"local","community", or"both" (default:"local")

3.stm_feed_generate

Generate a new feed from an AsyncAPI document.

Parameters:

  • source (required): File path or URL to AsyncAPI document
  • feed_name (optional): Name for the generated feed

Note: Currently shows limitation message due to interactive CLI prompts in POC approach.

4.stm_feed_run

Run an event feed to publish messages to Solace broker.

Parameters:

  • feed_name (required): Name of the feed to run
  • count (optional): Number of events to publish (default: 1, 0 for continuous)
  • interval (optional): Time between publishes in milliseconds (default: 1000)
  • event_names (optional): Array of specific event names to publish

Note: Currently shows limitation message due to broker connection requirements and interactive prompts.

5.stm_send

Send/publish messages to Solace broker topics or queues.

Parameters:

  • topic (string): Topic to publish to (mutually exclusive with queue)
  • queue (string): Queue to publish to (mutually exclusive with topic)
  • message (string): Message payload as string
  • message_file (string): Path to file containing message payload
  • count (number): Number of messages to send (default: 1, 0 for continuous)
  • interval (number): Interval between messages in milliseconds (default: 1000)
  • url (string): Broker URL (e.g., ws://localhost:8008)
  • vpn (string): Message VPN name
  • username (string): Client username
  • password (string): Client password
  • delivery_mode (string): DIRECT, PERSISTENT, or NON_PERSISTENT
  • time_to_live (number): Message TTL in milliseconds
  • output_mode (string): DEFAULT, COMPACT, or FULL (default: DEFAULT)
  • lint (boolean): Validate parameters without executing (default: true)

6.stm_receive

Receive/consume messages from Solace broker topics or queues.

Parameters:

  • topic (string): Topic to subscribe to (mutually exclusive with queue)
  • queue (string): Queue to consume from (mutually exclusive with topic)
  • count (number): Number of messages to receive (default: 1, 0 for continuous)
  • timeout (number): Receive timeout in milliseconds (default: 60000)
  • url (string): Broker URL
  • vpn (string): Message VPN name
  • username (string): Client username
  • password (string): Client password
  • output_mode (string): DEFAULT, COMPACT, or FULL (default: DEFAULT)
  • lint (boolean): Validate parameters without executing (default: true)

7.stm_request

Send request messages and wait for replies (request-reply pattern).

Parameters:

  • topic (string, required): Topic to send request to
  • message (string): Request message payload
  • message_file (string): Path to file containing request payload
  • count (number): Number of requests to send (default: 1)
  • timeout (number): Request timeout in milliseconds (default: 5000)
  • url (string): Broker URL
  • vpn (string): Message VPN name
  • username (string): Client username
  • password (string): Client password
  • output_mode (string): DEFAULT, COMPACT, or FULL (default: DEFAULT)
  • lint (boolean): Validate parameters without executing (default: true)

8.stm_reply

Listen for requests and send replies (request-reply pattern responder).

Parameters:

  • topic (string, required): Topic to listen for requests on
  • message (string): Reply message payload
  • message_file (string): Path to file containing reply payload
  • count (number): Number of requests to reply to (default: 1, 0 for continuous)
  • timeout (number): Wait timeout in milliseconds (default: 60000)
  • url (string): Broker URL
  • vpn (string): Message VPN name
  • username (string): Client username
  • password (string): Client password
  • output_mode (string): DEFAULT, COMPACT, or FULL (default: DEFAULT)
  • lint (boolean): Validate parameters without executing (default: true)

Note: All messaging tools default tolint: true for safe parameter validation. Set tofalse to actually execute commands (requires broker connectivity).

Manual Testing with MCP Inspector

The MCP Inspector provides an interactive web interface to test our MCP server tools. Here's how to test each feature:

Setup MCP Inspector

  1. Start the MCP Server:
# In the project directoryyarn start

The server will start and display: "Solace TryMe CLI MCP Server running on stdio"

  1. Start MCP Inspector in a new terminal:
npx @modelcontextprotocol/inspector node src/index.js
  1. Open the Inspector:The inspector will open in your browser (typicallyhttp://localhost:3000)

Test Cases

Test 1: STM Help Command

Purpose: Verify basic STM CLI integration works

  1. In the MCP Inspector, select thestm_help tool

  2. Test basic help:

    • Leave parameters empty
    • Click "Call Tool"
    • Expected Result: STM CLI help output with ASCII art banner and command list
  3. Test specific command help:

    • Setcommand to"feed"
    • Click "Call Tool"
    • Expected Result: Detailed help for thestm feed command

Test 2: Feed Listing

Purpose: Test feed discovery and output formatting

  1. Select thestm_feed_list tool

  2. Test local feeds:

    • Setsource to"local"
    • Click "Call Tool"
    • Expected Result:
    Found X local feed(s):1. **FeedName1** (asyncapi_feed)2. **FeedName2** (asyncapi_feed)
  3. Test default behavior:

    • Leavesource empty (defaults to local)
    • Click "Call Tool"
    • Expected Result: Same as local feeds test
  4. Test both feeds:

    • Setsource to"both"
    • Click "Call Tool"
    • Expected Result: Local feeds + note about community feeds being skipped
  5. Test community feeds (optional):

    • Setsource to"community"
    • Click "Call Tool"
    • Expected Result: Either community feeds list or timeout/error (network dependent)

Test 3: Feed Generation

Purpose: Test parameter validation and limitation documentation

  1. Select thestm_feed_generate tool

  2. Test missing parameters:

    • Leave all parameters empty
    • Click "Call Tool"
    • Expected Result: Error message about requiredsource parameter
  3. Test with file path:

    • Setsource to"test/sample-asyncapi.yaml"
    • Leavefeed_name empty
    • Click "Call Tool"
    • Expected Result: POC limitation message with explanation
  4. Test with feed name:

    • Setsource to"test/sample-asyncapi.yaml"
    • Setfeed_name to"MyTestFeed"
    • Click "Call Tool"
    • Expected Result: POC limitation message including the feed name
  5. Test with non-existent file:

    • Setsource to"/nonexistent/file.yaml"
    • Click "Call Tool"
    • Expected Result: POC limitation message (file validation happens in STM CLI)

Test 4: Feed Execution

Purpose: Test feed execution and broker communication capabilities

  1. Select thestm_feed_run tool

  2. Test missing feed name:

    • Leave all parameters empty
    • Click "Call Tool"
    • Expected Result: Error message about requiredfeed_name parameter
  3. Test with existing feed:

    • Setfeed_name to"DynamicPricingEngine-0" (or another feed from your list)
    • Setcount to1
    • Click "Call Tool"
    • Expected Result: POC limitation message about broker connection requirements
  4. Test with custom parameters:

    • Setfeed_name to"DynamicPricingEngine-0"
    • Setcount to3
    • Setinterval to500
    • Click "Call Tool"
    • Expected Result: POC limitation message with custom parameters shown
  5. Test with non-existent feed:

    • Setfeed_name to"NonExistentFeed"
    • Click "Call Tool"
    • Expected Result: Clear error message that feed was not found

Test 5: End-to-End Workflow

Purpose: Test the complete workflow integration

  1. Run the comprehensive test:
node test/end-to-end-test.js
  1. Expected workflow:
    • Lists existing feeds ✅
    • Attempts feed generation 🚧 (shows limitation)
    • Verifies feed list unchanged ✅
    • Attempts feed execution 🚧 (shows limitation)
    • Provides comprehensive analysis ✅

Expected Test Results Summary

Test CaseStatusExpected Behavior
stm_help (no params)✅ WorkingSTM help output with banner
stm_help (specific command)✅ WorkingCommand-specific help
stm_feed_list (local)✅ WorkingFormatted list of local feeds
stm_feed_list (both)✅ WorkingLocal feeds + community note
stm_feed_list (community)⚠️ Network dependentMay timeout or succeed
stm_feed_generate (missing params)✅ WorkingClear error message
stm_feed_generate (valid params)🚧 POC LimitationInformative limitation message
stm_feed_run (missing params)✅ WorkingClear error message
stm_feed_run (valid params)🚧 POC LimitationBroker connection limitation message
stm_feed_run (invalid feed)✅ WorkingFeed not found error
End-to-end workflow✅ POC CompleteDemonstrates integration + limitations

Troubleshooting

"STM CLI not found" Error

  • Verify STM is installed:stm --version
  • Check PATH includes STM installation directory
  • On macOS with Homebrew:brew install stm

MCP Inspector Connection Issues

  • Ensure the MCP server is running (yarn start)
  • Check that no other process is using the stdio transport
  • Try restarting both server and inspector

Tool Call Timeouts

  • Some STM commands (especially community feeds) may be slow
  • Default timeout is 30 seconds
  • Network-dependent operations may fail in offline environments

Interactive Prompt Issues

  • STM CLI commands with interactive prompts are not supported in POC
  • These are documented as limitations in the tool responses
  • Will be resolved in Phase 2 (direct integration)

Development Testing

Automated Tests

# Run all testsyarntest# Run specific test suitesnode test/feed-list-test.jsnode test/feed-generate-test.jsnode test/mcp-test.js

Manual CLI Testing

# Test STM CLI wrapper directlynode -e"const { executeSTMCommand } = require('./src/stm-cli.js');executeSTMCommand('--help').then(console.log);"# Test server instantiationnode -e"const { STMServer } = require('./src/index.js');const server = new STMServer();console.log('Server created successfully');"

Current POC Status

✅ Working Features

  • Basic MCP Server: Properly configured with stdio transport
  • STM CLI Integration: Robust command execution with error handling
  • Feed Listing: Local feeds discovery with formatted output
  • Parameter Validation: Proper input validation and error messages
  • Documentation: Clear limitation messaging for unsupported features

🚧 Known Limitations (POC)

  • Interactive Commands: STM commands with prompts not supported via CLI wrapping
  • Community Feeds: Network-dependent, may be slow or fail
  • Real-time Feedback: No progress updates for long-running operations
  • Advanced Error Handling: Basic CLI error parsing only

🎯 Next Steps (Phase 3+)

  1. Addstm_feed_run tool - Execute feeds (if non-interactive)
  2. Implement MCP Resources - Expose feed metadata as resources
  3. Enhanced Error Handling - Better CLI output parsing
  4. Phase 2 Planning - Direct STM function integration design

Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐│   LLM Client    │    │   MCP Server    │    │   STM CLI       ││   (Claude)      │◄──►│   (Node.js)     │◄──►│   (Installed)   │└─────────────────┘    └─────────────────┘    └─────────────────┘       │                       │                       │       │ MCP Protocol          │ Child Process         │ Solace Broker       │ (JSON-RPC)            │ Execution             │ Connection       │                       │                       │   ┌─────────┐             ┌─────────┐             ┌─────────┐   │ Natural │             │   CLI   │             │  Event  │   │Language │             │Wrapper  │             │ Feeds   │   │ Queries │             │ Layer   │             │ & Data  │   └─────────┘             └─────────┘             └─────────┘

This POC demonstrates the feasibility of MCP integration with STM while identifying the clear benefits of direct function integration for future development.

Resources

This is not an officially supported Solace product.

For more information try these resources:

Contributing

Contributions are encouraged! Please readCONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

See the list ofcontributors who participated in this project.

License

See theLICENSE file for details.

About

MCP server for solace-tryme-cli

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp