Skip to content

idjohnson/cobolMCP

Repository files navigation

COBOL MCP Server

A basic "Hello World" Model Context Protocol (MCP) server written in COBOL (GnuCOBOL).

Overview

This server implements a subset of the MCP specification over HTTP (JSON-RPC 2.0). It provides a single tool: hello_world.

Requirements

  • Docker

Building

To build the Docker image:

docker build -t cobol-mcp .

Running

To run the server on port 8090:

docker run -p 8090:8090 cobol-mcp

Testing

There is a provided test.sh script that launches the container and runs a test suite against it.

./test.sh

Manual Testing

You can send a POST request with curl:

curl -X POST http://localhost:8090/mcp \
     -H "Content-Type: application/json" \
     -d '{
           "jsonrpc": "2.0",
           "method": "tools/call",
           "params": {
               "name": "hello_world",
               "arguments": {
                   "name": "Developer"
               }
           },
           "id": 1
         }'

Implementation Details

  • Language: COBOL (GnuCOBOL)
  • Transport: HTTP (TCP Sockets)
  • Files:
    • server.cbl: Main TCP server loop.
    • mcp-handler.cbl: Request parser and response generator.
    • socket-defs.cpy, http-structs.cpy: Data structures.

Http Streamable Docker

Run it in docker, e.g.

$ docker run --name cobol-mcp-server -p 8090:8090 idjohnson/cobolmcp:latest

Copilot settings

You can use the MCP server add UI to add an HTTP server for http://localhost:8090 or add this block in the mcp.json file:

		"cobolMCP": {
			"url": "http://localhost:8090/mcp",
			"type": "http"
		}

Gemini CLI settings

Using in either ~/.gemini/settings.json or a local .gemini/settings.json, access the httpStreamable server:

  "mcpServers": {
    "cobolMCP": {
      "httpUrl": "http://localhost:8090",
      "timeout": 5000
    }
  },

Installing into Kubernetes

There is a local chart in /charts you can use.

For instance, I set this up with my local Kubernetes and a proper TLS ingress using the following values file:

# Default values for cobolmcp.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
  repository: idjohnson/cobolmcp
  pullPolicy: Always
  # Overrides the image tag whose default is the chart appVersion.
  tag: "latest"

ingress:
  enabled: true
  className: "nginx"
  annotations:
    cert-manager.io/cluster-issuer: gcpleprod2
    ingress.kubernetes.io/proxy-body-size: "0"
    ingress.kubernetes.io/ssl-redirect: "true"
    kubernetes.io/tls-acme: "true"
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
  hosts:
    - host: cobolmcp.steeped.icu
      paths:
        - path: /
          pathType: ImplementationSpecific
  tls:
   - secretName: cobolmcpgcp-tls
     hosts:
       - cobolmcp.steeped.icu

resources:
  limits:
    cpu: 250m
    memory: 256Mi
  requests:
    cpu: 100m
    memory: 128Mi

autoscaling:
  enabled: true
  minReplicas: 1
  maxReplicas: 10
  targetCPUUtilizationPercentage: 80

Then installed:

$ helm upgrade --install cobolmcp -f ./values.yaml ./charts/cobolmcp
Release "cobolmcp" has been upgraded. Happy Helming!
NAME: cobolmcp
LAST DEPLOYED: Thu Jan  8 14:15:41 2026
NAMESPACE: default
STATUS: deployed
REVISION: 3
NOTES:
1. Get the application URL by running these commands:
  https://cobolmcp.steeped.icu/

If you opt not to use a public ingress, it will create a ClusterIP service you could use with port-forward

$ kubectl get svc | grep cobol
cobolmcp                                                ClusterIP   10.43.183.219   <none>        8090/TCP                                                      18m

$ kubectl port-forward svc/cobolmcp 8099:8090
Forwarding from 127.0.0.1:8099 -> 8090
Forwarding from [::1]:8099 -> 8090

License

MIT

About

A functioning httpStreamable GNU COBOL based MCP server.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published