spring-projects / spring-projects/spring-ai

MCP Server using STDIO - Attempting to user JSON RPC from Windows command line with partial success

Open
#3,972 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Bug description
Created an MCP server. Added it to VSCode. The server is recognized and the 3 tools defined appear and work. On occasion, the 1 defined resource may appear in one of the VSCode windows but more times than not, selecting the resource results in a VS Code window showing an indeterminate progress bar until I restart VSCode.

What I would like to do is test the MCP server using JSON RPC. Here are the commands I sent using PowerShell and the results. It seems the only successful command that works is the initialization command. Not sure if the way I am attempting to test this is valid. resource or tool list command will return an error if the syntax is wrong, but will not display information when it is correct

echo '{"jsonrpc":"2.0", "id":1, "method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{"roots":{"listChanged":true}, "sampling":{}}, "clientInfo":{"name":"test-client","version":"1.0.0"}}}' | java -jar mcp-server-0.0.1-SNAPSHOT.jar
:::::::::{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2024-11-05","capabilities":{"completions":{},"logging":{},"prompts":{"listChanged":true},"resources":{"subscribe":false,"listChanged":true},"tools":{"listChanged":true}},"serverInfo":{"name":"sds-mcp-server","version":"1.0.0"}}}
:
echo '{"jsonrpc":"2.0", "id":1, "method":"list/tools","params":{}}' | java -jar mcp-server-0.0.1-SNAPSHOT.jar
::::::::{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Method not found: list/tools"}}
:
echo '{"jsonrpc":"2.0", "id":1, "method":"tools/list","params":{}}' | java -jar mcp-server-0.0.1-SNAPSHOT.jar
:::::::::
echo '{"jsonrpc":"2.0", "id":1, "method":"tools/resources","params":{}}' | java -jar mcp-server-0.0.1-SNAPSHOT.jar
::::::::{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Method not found: tools/resources"}}
:
echo '{"jsonrpc":"2.0", "id":1, "method":"list/resources","params":{}}' | java -jar mcp-server-0.0.1-SNAPSHOT.jar
::::::::{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Method not found: list/resources"}}
:
echo '{"jsonrpc":"2.0", "id":1, "method":"resources/list","params":{}}' | java -jar mcp-server-0.0.1-SNAPSHOT.jar
:::::::::

Environment
Windows 11
properties file
spring.application.name=mcp-server

spring.ai.mcp.server.type=SYNC
spring.ai.mcp.server.name=my-mcp-server
spring.ai.mcp.server.version=1.0.0

spring.ai.mcp.server.stdio=true
spring.main.web-application-type=none
spring.main.banner-mode=off
logging.pattern.console=:
logging.file.name=./log/mcp-server.log

Steps to reproduce
Build the MCP server with a few tools and a resource
Run JSON RPC commands from the command line

Expected behavior
Could be developer error here

Minimal Complete Reproducible example
Example above

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the STDIO launch command and compare the initialize, tools/list, and resources/list requests with the MCP JSON-RPC transport expectations. Check the server log alongside each request, then verify that valid list calls return responses and that selecting the resource in VS Code no longer remains indefinitely busy.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.