# Mcp Light

> An extremely lightweight MCP server implementation for Java applications.

- **Type:** MCP server
- **Install:** `agentstack add mcp-scorbo2-mcp-light`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [scorbo2](https://agentstack.voostack.com/s/scorbo2)
- **Installs:** 0
- **Category:** [Integrations](https://agentstack.voostack.com/c/integrations)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [scorbo2](https://github.com/scorbo2)
- **Source:** https://github.com/scorbo2/mcp-light

## Install

```sh
agentstack add mcp-scorbo2-mcp-light
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# mcp-light

## What is this?

This is an academic/hobby project meant to help learn about the MCP protocol and how it works.

### Project goals:

- produce an extremely lightweight MCP server implementation for Java applications.
- minimal third party dependencies! Only Jackson for the JSON handling.
- implement a reasonable percentage of the MCP spec (enough to gain a better understanding of the protocol)
- produce an actual, working, extensible MCP server that could actually be used in a real application.
- at an absolute bare minimum, it should be possible to connect with MCP Inspector, read resources, and call tools.

## Basic usage

The generated jar file is executable, and comes with a very simple built-in example server implementation.
To run it, simply clone the project, build with Maven/Java 25, and run the generated jar:

```shell
git clone https://github.com/scorbo2/mcp-light.git
cd mcp-light
mvn clean package
java -jar target/mcp-light-1.1.jar

# Or, start on a different port (default 8080):
java -jar target/mcp-light-1.1.jar 9090
```

This will start a very simple MCP server with the following features:

- a tool called `exampleTool` that takes two dummy arguments and returns a fixed string.
- a static resource at `example://example/resource` that returns a fixed string.
- a templated resource at `example://example/template/{id}` that returns a string containing the id you provided.
- an example prompt that accepts a topic argument
- support for OPTIONS requests, allowing you to connect from browser-based clients such as `llama-ui`.
- support for MCP "ping" requests.

Once the server is up and running, you should be able to connect to it from
[MCP Inspector](https://github.com/modelcontextprotocol/inspector) to list the tools and resources. Or, you
can wire up the server to some other MCP client.

### Example connection: OpenCode

You can modify your `~/.config/opencode/opencode.json` file to include a connection to your local MCP server:

```json
{
  // existing opencode config here...
    
  "mcp": {
    "mcp-light": {
      "type": "remote",
      "url": "http://localhost:8080/mcp"
    }
  }
}
```

Now, when you start OpenCode, it should connect to your server. You can ask it to invoke tools, as in this example:

```
Prompt: Please call the `mcp-light_exampleTool` with an arg1 value of `hello` and report the results.                    

Thought: 388ms                                                                                                   
                                                                                                                  
The user wants me to call the mcp-light_exampleTool with arg1="hello".                                           
                                                                                                                  
⚙ mcp-light_exampleTool [arg1=hello]                                                                             
                                                                                                                  
Thought: 295ms                                                                                                   
                                                                                                                  
The tool executed successfully but didn't return much detail. Let me report the result to the user.              
                                                                                                                  
The mcp-light_exampleTool executed successfully. The tool returned a message: "Successfully executed the         
example tool!"
```   

## Using in code

The library is available in Maven Central, so you can just add it as a dependency in your project:

```xml

    ca.corbett
    mcp-light
    1.1

```

Once the library is imported into your Java project, you can implement the following interfaces as needed:

- [McpTool](src/main/java/ca/corbett/mcp/McpTool.java) to define tools that can be called by clients.
- [McpResource](src/main/java/ca/corbett/mcp/McpResource.java) to expose resources that clients can read.
- [McpPrompt](src/main/java/ca/corbett/mcp/McpPrompt.java) to define prompts that clients can call.

Then, you can create an instance of [McpServer](src/main/java/ca/corbett/mcp/McpServer.java) and register your
tools and resources to it before starting the server:

```java
McpServer server = new McpServer();
server.registerTool(new MyTool());
server.registerResource(new MyResource());
server.registerPrompt(new MyPrompt());
server.start();
```

You should add code to ensure your server is stopped correctly. An easy way to do this is to add a shutdown hook:

```java
Runtime.getRuntime().addShutdownHook(new Thread(server::stop));
```

## Manual testing

While your server is up, you can use any REST client (like Bruno, Postman, or even curl) to send JSON-RPC requests
to it, by manually specifying the request body. For example, to send an `initialize` request via curl:

```shell
curl -X POST http://localhost:8080/mcp \
  -H "Content-Type: application/json" \
  -d '{
        "jsonrpc": "2.0",
        "id": 1,
        "method": "initialize",
        "params": {
          "protocolVersion": "2024-11-05",
          "capabilities": {
            "roots": {
              "listChanged": true
            },
            "sampling": {}
          },
          "clientInfo": {
            "name": "ExampleClient",
            "version": "1.0.0"
          }
        }
      }'
```

This approach allows you to see the raw responses directly from your server, if you want to get a better
look at what's happening under the hood.

But generally, testing with an actual client like MCP Inspector is just easier.

## Is this production-grade?

No. This is a hobby project. Use it for fun and learning!

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## More info

- GitHub repo: https://github.com/scorbo2/mcp-light
- Issues page: https://github.com/scorbo2/mcp-light/issues
- MCP spec: https://modelcontextprotocol.io/specification/

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [scorbo2](https://github.com/scorbo2)
- **Source:** [scorbo2/mcp-light](https://github.com/scorbo2/mcp-light)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** yes
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-scorbo2-mcp-light
- Seller: https://agentstack.voostack.com/s/scorbo2
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
