Live data from Hacker News

Trading with Claude, and writing your own MCP server

dangelov.com

61–70 of 90 posts

Re: Trading with Claude, and writing your own MCP server

#61

Earlier quoted context omitted.

It may not hallucinate yours to zero, or mine, or franks, or Mary's, but at some point it will do it to someone. That's the issue I have with these approaches *at scale*. I'm sure one day we'll get 100.00% reliable outputs such that autonomous agents can do this, however that's not today.

The way this is done at scale is legalized front-running. You buy order flow from "free" retail brokers like Robin Hood (as a market maker) and then literally front run ALL trades. You then tell everybody you're giving them the best price (also the only price), lol. In other words: legalized crime.

If somebody wants to buy an orange for $2 and I sell them one for $1.98, that's "legalized crime"?

I don't think you understand how this works. It's not about front-running them, it's about that they have no clue what they are doing, so it's extremely unlikely their trade will be profitable, thus you gain by being the other side.

That $0.02 of price improvement is the price you pay for the privilege of giving a better price to clueless people.

Re: Trading with Claude, and writing your own MCP server

#62

I’m trying to wrap my head around mcp but auth and security is still the confusing thing to me. In this case, I get there is an oauth redirect happening, but where is the token being stored? How would that work in an enterprise or saas environment where you want to expose an mcp for users but ensure they can only get “their” data? How does the LLm reliably tell the mcp who the current user is?

Yeah, I wished you could somehow pass the user's id token to the MCP server when you are calling a tool when implementing an AI model. You could then either let the mcp server fetch a token using the `token-exchange` endpoint. So that it can fetch the user info (e.g. user id)

For example, when you try to integrate with AI model that supports function calling in the backend and want to use MCP server to enhance the model.

I haven't figured that out yet. Maybe you would need to use Client-Initiated Backchannel Authentication Flow ?

Re: Trading with Claude, and writing your own MCP server

#63
post #38

Earlier quoted context omitted.

Well, the JS in the name is for JavaScript :)

Yeah, although I'm surprised that not more languages have designed data interaction to be more JSON like. In JS it just feels like I'm interacting with JSON directly. Most other languages have some layer of "weirdness"/indirection between the language runtime and the data. Like in Go I have to define field names twice. Once for the Go field and once for the field name in the actual JSON structure. Not even Python all…

[deleted]

Re: Trading with Claude, and writing your own MCP server

#64
Designer and vibe coder here... I also had trouble getting Claude to create an MCP server. What I finally realized was I could just point it at one of the Typescript demo repos from Anthropic. Then it easily cranked out what I was asking for. Maybe not an issue now with Claude 4.

Re: Trading with Claude, and writing your own MCP server

#65
post #46

I think many firms already have (faster) 'sentiment' tools that parse news messages and automatically trade on those. I don't think a LLM can compete on speed which such tools. But a LLM could build a knowledge graph that parses niche news messages and tries to understand the entire picture and make bigger predictions.

I didn't get the impression this was about competing on speed.

Re: Trading with Claude, and writing your own MCP server

#66

Earlier quoted context omitted.

The way this is done at scale is legalized front-running. You buy order flow from "free" retail brokers like Robin Hood (as a market maker) and then literally front run ALL trades. You then tell everybody you're giving them the best price (also the only price), lol. In other words: legalized crime.

What does this mean? Sorry, not up on stock lingo. Is this effectively like having the results of a race a minute early or something?

Yea that's a decent analogy. You see the incoming trades before they are actually executed, and you can react accordingly.

Re: Trading with Claude, and writing your own MCP server

#67
post #14
post #12

Earlier quoted context omitted.

Interesting, Go is actually a language I tend to reach for when dealing with JSON.

I feel the same way, but to defend GP, if you're dealing with unknown JSON, the experience of deserializing `any` (or `map[string]any` if you know the top-level entity is an object) can be extremely tedious. For things like structured API requests/responses, Go's struct tags are basically exactly how I want my JSON ser/de to look.

It looks like there are a few Golang implementations of MCP. The one used in the article doesn't use tags but mcp-golang does. Tags are great! I love tags.

- https://github.com/metoro-io/mcp-golang

Re: Trading with Claude, and writing your own MCP server

#68
post #6

Sometimes Go can get under my skin. The MCP SDK makes you jump through all these hoops to configure tools according to a JSON schema, but when it comes to handling the actual request you need to deal with parsing everything again out of a `map[string]any`. It's such a pain to need to reach for codegen all the time.

Yeah it's not ideal, but it mostly works - at least in this case. I think each MCP tool works best when it can be kept lean and needs only a small number of arguments.

Check out https://github.com/metoro-io/mcp-golang - looks like they support strongly typed tool arguments.

Re: Trading with Claude, and writing your own MCP server

#69
post #11
post #4

I also did this a few months ago using a custom MCP server I built for the Alpaca API, the yfinance MCP server, and a reddit MCP server, and the "sequential thinking" mcp server. I hade claude write a prompt that combined them all together starting with checking r/pennystocks for any news, looking up the individual ticker symbols with alpaca and yfinance, checking account balance and making a trade only if a very par…

Did you benchmark it against holding the same value in S&P 500 or similar ETF over the same period?

Something like Russell 2k would be a better comparison if GP is trading pennystocks.

Re: Trading with Claude, and writing your own MCP server

#70

I’m trying to wrap my head around mcp but auth and security is still the confusing thing to me. In this case, I get there is an oauth redirect happening, but where is the token being stored? How would that work in an enterprise or saas environment where you want to expose an mcp for users but ensure they can only get “their” data? How does the LLm reliably tell the mcp who the current user is?

I've built a remote mcp with oauth2 auth from scratch just last week. The standard has a page on authorization[0], though it's not particularly easy to read for someone not well-versed with OAuth. In short, MCP just uses plain boring oauth, like any other oauth authorization. Like when you authorize an app to access your google calendar. The only difference is that instead of accessing your normal API, they access yo…

> When you add an MCP server to your Claude organization, you just add the MCP server. Each user will have to go through the integration's OAuth2 authorization flow separately.

Check out https://aaronparecki.com/2025/05/12/27/enterprise-ready-mcp - there are some great ideas there on how this can be simplified even more in the future.

Post reply on HN