Skip to main content

FlyMoon Python Package for MCP (Mission Control Protocol) clients

Project description

MCP Server Client

A Python client library for interacting with the MCP Server. This library provides a simple wrapper around the MCP Server API to register agents, move them around, and observe the environment.

Table of Contents

Installation

Option 1: Install from PyPI (Recommended)

pip install flymoon

Option 2: Install from Source

  1. Clone this repository:
git clone https://github.com/Tanishqpy/FlyMoon
cd FlyMoon
pip install -e .
  1. Install the required dependencies:
pip install -r requirements.txt
  1. (Optional) Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

Usage

Basic Usage

from flymoon import MCPClient

# Create a client instance
client = MCPClient(
    server_url="http://localhost:8000",
    agent_id="explorer_bot",
    agent_type="scout"
)

# Register the agent
registration_result = client.register()
print(f"Registration result: {registration_result}")

# Move the agent
move_result = client.move(x=10, y=5)
print(f"Move result: {move_result}")

# Observe surroundings
observation = client.observe()
print(f"Observation: {observation}")

Automated Agent Loop

The client also includes a simple automation function:

# Run a simple agent loop (5 steps by default)
client = MCPClient(agent_id="explorer_bot", agent_type="scout")
client.run_simple_loop(steps=5, delay=1)

API Reference

MCPClient

Constructor

  • MCPClient(server_url="http://localhost:8000", agent_id=None, agent_type=None)

Methods

  • register(agent_id=None, agent_type=None): Register an agent with the server
  • move(x, y): Move the agent to the specified coordinates
  • observe(): Observe the surroundings
  • run_simple_loop(steps=5, delay=1): Run an automated agent loop

Project Structure

  • mcp_client.py: Main client library class
  • agent_client.py: Example implementation without using the wrapper
  • main.py: FastAPI server implementation
  • mcp_env.py: Environment definition and functionality
  • launch_mcp.sh: Script to start the server with ngrok tunneling
  • requirements.txt: Project dependencies

Example Agent

See agent_client.py for a simple example of directly using the API without the wrapper.

Troubleshooting

Common Issues

  1. Connection refused errors

    • Make sure the MCP server is running on the specified port
    • Check if the server URL is correct
    • Verify network connectivity
  2. Authentication failures

    • Ensure you're using a valid agent_id
    • Try re-registering your agent
  3. Movement limitations

    • Agents can't move outside the environment boundaries
    • Check observation results for valid movement ranges

Server Setup

To start the server locally:

# Start the FastAPI server
uvicorn main:app --reload

# Or use the provided launch script
./launch_mcp.sh

Contributing

Contributions are welcome! Here's how you can contribute:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Commit your changes (git commit -m 'Add some amazing feature')
  5. Push to the branch (git push origin feature/amazing-feature)
  6. Open a Pull Request

Please make sure to update tests as appropriate.

License

MIT License

Copyright (c) 2025 Tanishq

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flymoon-0.1.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flymoon-0.1.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file flymoon-0.1.1.tar.gz.

File metadata

  • Download URL: flymoon-0.1.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for flymoon-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f6d562f17e7e401be691ed93f37c3bcef2ba7ad0498dbecf9e0cc157b3f4d05a
MD5 13a40ea2c496a25d745959d09c1446aa
BLAKE2b-256 54131816cbbeba7d25814d9f73359e43914552ff960a8850dbf52257930f6c15

See more details on using hashes here.

File details

Details for the file flymoon-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: flymoon-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for flymoon-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0cf0cb0cbce193ee25c4535ffea058ee97508ddc64cc4b22a6bebdc2b4d13a12
MD5 c29f3c84aa9888ebde8db43b41ffbb6d
BLAKE2b-256 b2386bd664e07536a89454032bca1228df11b6cb62ae55d615dacf4a71e7cee1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page