Coder Social home page Coder Social logo

mcconsoleapi's Introduction

MCConsoleAPI

MCConsoleAPI is an HTTP API wrapper for Minecraft servers that gives you the power to create automation and tools for minecraft servers without needing to know a specific programming language. Make simple HTTP requests to the backend and accomplish any task you want in any language you want!

Note

This project is a WIP and is not guaranteed to be secure in any way. Steps have been taken to mitigate some attack vectors, but no application is 100% safe. This software is provided AS IS without warranty of any kind. Any issues you have, please report them on the issues page with any relevant information.

Setup and Installation

Pre-requisites

  1. Install Python (>=Python 3.8 tested on 3.12.3)
    • This project uses FastAPI which requires Python 3.8+
  2. Download the project
    • You can do this by cloning the repo or clicking this link
    • If you downloaded it as a ZIP file, please extract it to a folder somewhere logical
  3. Install Requirements
    • Open a command prompt or terminal (google it)
    • Change to the directory of the program: cd /path/to/extracted/download/ (or P:\ath\to\extracted\download\ on windows)
    • Windows: python -m pip install -r requirements.txt
    • Unix: pip3 install -r requirements.txt

Configuration

  1. Copy config_template.toml and place it into the root directory of your server (where server.properties and the server jar are located) and rename it to config.toml
  2. Open the newly copied and renamed config.toml in your text editor of choice, verify all the settings are set how you would like.
    • Things should be commented as well as I can (and if you need clarification, please create an issue and ask)
    • The main things to check here are the server host and the port, these are the IP and Port the API will use to serve HTTP requests. This is also the info you need to develop any tools around it
    • After that, ensure the java_path, server_jar and jvm_args have anything you need setup for your instance.

As of now, there isn't a convenient way to run the program other than from the main program folder.

This will change in the future as development continues.

For now, you can start a server using this command:

  • Windows: python main.py --path 'C:\path\to\server\root'
  • Linux: python3 main.py --path '/path/to/server/root'

Getting your Admin API key

When you first run the program, you will see a section print out in the console that looks like this:

================
ADMIN API KEY: ADMIN-API-KEY
================

Copy this somewhere, if you lose it you will need to regenerate it. This API key is also the only API key that can issue a new API key, so you need it if you would like to authorize other clients to use your server's API.

The Admin (and any other API keys) are server specific. If you decide to host more than one server, you will need to run more than one instance of MCConsoleAPI. The API keys are stored in an SQLite3 database file in the server root (api_keys.db). If you ever lose your admin API key, or you need to regenerate your API keys in the event of a breach, just delete this file.

See the next section on viewing the API documentation where you can also see the endpoint for creating a new API key. It is recommended you do this immediately and DO NOT use the Admin API key for every day tasks.

Reading the API docs

Once you have started the program and it starts your minecraft server, open your web browser and navigate to the host and port that was printed into the console.

You should see a page saying: {"line":"Connected to MCConsoleAPI! You can read the server output at '/output'"}, this means everything is working correctly!

To get to the docs, you just need to go to the /docs endpoint, these are automatically generated by the program and will update for every change that is made to the routes for the program.

mcconsoleapi's People

Contributors

column01 avatar rioghander2te avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.