hasmcp/hasmcp-ce

By hasmcp

Updated 6 months ago

HasMCP Community Edition https://docs.hasmcp.com/self-hosted

Image
Languages & frameworks
API management
Developer tools
0

1.2K

hasmcp/hasmcp-ce repository overview

HasMCP Community Edition with Docker

Prepare the environment

mkdir hasmcp
cd hasmcp
touch .env
touch Makefile
mkdir -p _certs _storage # creates folders
chmod 0777 _certs
chmod 0777 _storage

Copy the following .env file into hasmcp(main project) folder and modify the env values per your requirements:

ENV=production

HASMCP_API_ACCESS_TOKEN=test # this is your api login secret have a very long strong one
HASMCP_API_AUTH_ENABLED=true
HASMCP_API_CORS_HOSTNAME=*
HASMCP_API_JWT_SECRET=75EFC11969D7E13D39235C4E4D4E22A022E608180FB479F6992FFDB072C9985F # you can generate one using hexdump -vn32 -e'4/4 "%08X" 1 "\n"' /dev/urandom
HASMCP_API_LOGGER_ENABLED=true
HASMCP_API_RATELIMIT_ENABLED=true
HASMCP_API_RATELIMIT_MAX_PER_IP=1000 # Put a lower value in production
HASMCP_API_RATELIMIT_WINDOW=60s

HASMCP_ENCRYPTION_KEY=AABA9166CFA48C92C1C12B8EC51510C5961CBB93CECF3D7CB183734952096655 # you can generate one using hexdump -vn32 -e'4/4 "%08X" 1 "\n"' /dev/urandom
HASMCP_ENCRYPTION_HASH_SALT=gXaFk6iVt3zzjw # a salt for hash

HASMCP_MCP_CORS_HOSTNAME=localhost
HASMCP_MCP_JWT_SECRET=C7B30E17FE8CBBDE6CC74D54549CB3D99F3B7DDC95113BAE927C8AE17862B1AC # you can generate one using hexdump -vn32 -e'4/4 "%08X" 1 "\n"' /dev/urandom
HASMCP_MCP_LOGGER_ENABLED=true
HASMCP_MCP_RATELIMIT_ENABLED=true
HASMCP_MCP_RATELIMIT_MAX_PER_IP=60
HASMCP_MCP_RATELIMIT_WINDOW=60s

HASMCP_OAUTH2_CORS_HOSTNAME=localhost
HASMCP_OAUTH2_LOGGER_ENABLED=true
HASMCP_OAUTH2_MCP_PROVIDER_HTTP_SCHEME=http # https for production is recommended
HASMCP_OAUTH2_MCP_PROVIDER_JWT_SECRET=5B712508B6A090723A0A8B6D0D0C07DB # you can generate one using hexdump -vn16 -e'4/4 "%08X" 1 "\n"' /dev/urandom
HASMCP_OAUTH2_RATELIMIT_ENABLED=true
HASMCP_OAUTH2_RATELIMIT_MAX_PER_IP=60
HASMCP_OAUTH2_RATELIMIT_WINDOW=60s

# server config
# to enable auto ssl with let's encrypt
HASMCP_SERVER_DOMAIN_NAME=mcp.example.com
[email protected]
HASMCP_SERVER_MAX_BODY_SIZE_IN_BYTES=10000000
HASMCP_SERVER_SSL_ENABLED=true # set this to true to enable auto ssl with let's encrypt
HASMCP_SERVER_SSL_PORT=443
PORT=80

# idgen node id 0-255 (usually last section of IP would be a good choice, leave 0 to assigning randomly on server start)
MONOFLAKE_NODE=0

# sqlite db connection details, needed only when enabled
SQLITE_ENABLED=true # set to false if you are using postgres

# postgres db connection details, needed only when enabled
POSTGRES_ENABLED=false # set true to use postgres as production db
POSTGRES_TIMEZONE=UTC
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DBNAME=postgres

Create a Makefile with the following content:

# Define the version/tag for your Docker image
HASMPC_VERSION ?= latest

# Define the full image name
IMAGE_NAME = hasmcp/hasmcp-ce

# Combine them for the full reference
DOCKER_IMAGE = $(IMAGE_NAME):$(HASMPC_VERSION)


stats:
	docker stats hasmcp-ce

logs:
	docker logs -f hasmcp-ce

setup:
	docker pull $(DOCKER_IMAGE); \
	docker run --env-file .env -p 80:80 -p 443:443 --name hasmcp-ce -v ./_certs:/_certs -v ./_storage:/_storage -d --restart always $(DOCKER_IMAGE)

update:
	docker stop hasmcp-ce || true; \
	docker rm hasmcp-ce || true; \
	docker pull $(DOCKER_IMAGE); \
	docker run --env-file .env -p 80:80 -p 443:443 --name hasmcp-ce -v ./_certs:/_certs -v ./_storage:/_storage -d --restart always $(DOCKER_IMAGE)

restart:
	docker stop hasmcp-ce; \
	docker rm hasmcp-ce; \
	docker run --env-file .env -p 80:80 -p 443:443 --name hasmcp-ce -v ./_certs:/_certs -v ./_storage:/_storage -d --restart always $(DOCKER_IMAGE)

Run the following command to run the server with latest version:

make update

More details: https://docs.hasmcp.com/self-hosted

If you are having trouble to run self-hosted, the Cloud version has also free tier, available at: https://hasmcp.com

Tag summary

Content type

Image

Digest

sha256:233caa28f

Size

18.4 MB

Last updated

6 months ago

docker pull hasmcp/hasmcp-ce