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 particular set of criteria was met. I used claude code instead of desktop so that I could run it as a cron job, and it all works! I mostly built it to see if I could, not for any financial gain. I had it paper trading for a few months and it made a 2% profit on 100k. I really think someone that knows more about trading could do quite well with a setup like this, but it's not for me.
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 your MCP http endpoint. Each connection to that endpoint will pass the Authorisation header with an oauth token, which you can resolve to a user on your side. Same as you would with normal OAuth.
One cool bit is that MCP providers are supposed to support OAuth2 Dynamic Client Registration, which means that e.g. Claude can provision an OAuth2 client in your app programmatically (and get a client_id/client_secret that it can use for authorization flows).
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.
It does an oauth redirect flow and the client stores the access token and sends it with requests after.
I have built a couple using the spec from a month ago. It works alright.
A lot of bad decisions are in the official implementations. For instance not using native Request / Response types in node, so you’re forced to write a bunch of garbage code to convert it, or install express just to use an mcp server.
If I had the time I’d really make my own mcp implementation in typescript at least.
I find most of the implementations to be so over engineered and abstracted on what could be simple function calls on top of the built in language
For simple stuff like a json file that returns the location of your auth routes, you need to add a “middleware”
When in reality you can just make a route and explicitly return that information.
Every piece is some new abstraction it feels vibe coded.
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 ?
There's basically a couple of different ways to implement an MCP server - for this demo it's a local binary that communicates over stdio, so no OAuth process is taking place. It's only meant to run on your local machine.
To make the demo simpler to explore and understand, the binary loads it's configuration (SnapTrade API client id, secret, and username and secret) from a .env file that you populate with your credentials which allows it to fetch the right data.
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.
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.
Great writeup! I was just working at Alpaca --- if you're interested in using Alpaca via MCP (or another way of integrating with LLMs), reach out with your usecase and I'd be happy to put you in touch with the right people.
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.
I’ve been doing this as well it also works well when you hook it up to Edgar or feed in investor relations documents or earnings transcripts. You can extract a lot of data at scale for regressions using small models with few shot prompts running locally.
This sounds like hell on earth to me. Automating the "boring" stuff does not sound healthy.
Two stories:
When my father was in Japan in the 1970s, he was strutting around like a rooster in an obnoxious, white suit and crossed paths with a Zen monk quietly sweeping a path. The monk looked up at him and my father felt, he said, about six inches tall. The dignity and focus of the monk put my father to shame.
I was once in Princeton, NJ, waiting to cross a crosswalk at a streetlight. Someone extremely famous (I think) and certainly incredibly wealthy was in a car at an intersection, waiting for the car in front of her to turn so she could proceed. She was beside herself -- honking, screaming, practically crying. Being asked to wait for someone else was more than she could stand.
Obviously these experiences relied on a lot of assumptions and interpretation on my and my father's part. I'm sure there were other ways of reading the monk and driver.
Regardless, when I imagine the world you're describing, what I see is a combination of my father in the white suit and the driver: spoiled, incompetent, impatient, egocentric people incapable of enduring the indignity of having to make any decisions for themselves, wait for anything, or stoop to the humiliating depths of thinking about the boring stuff. In a weird, backwards way, what you're describing also sounds like subservience to me.
Smartphones are bad for people. This sounds much, much, much worse. I hope I die before/if the technology "matures."
For speeding up chores it can be useful but removing the actual fun part of experiences, the research, the looking into, the figuring out, to instead only get the result of it sounds like a quick path into unfulfilling experiences.
But to be honest, I don't think it will get to the state you dream about, just like smart homes never got close and are more of a hassle than an actual life improvement. Unless it is almost 100% perfect it will error out in ways that are extremely annoying, ordering the wrong groceries, booking the wrong trip, etc. It's really hard to cross over the point where it's absolutely helpful without hiccups.
> It's next level society. Like, immediately, I want it to order me some groceries based on what it sees in my fridge and what I cook. And to remind me to change my air filters. Or book my vacation for me, knowing I like a mediterranean vibe and Bistecco Florentine.
This thing already exists though, it’s called a personal assistant. And since you’re already not willing to spend $400 a month on getting one, likely reveals that this is not really a thing that you really need in your life. It’s a made-up preference, I am afraid.
Given some of the caveats I mentioned towards the end of the article I'd be a bit wary putting too much trust in LLMs for this use case at this stage. But the field is moving so fast that I don't doubt it will soon be less error prone than a human doing it.
algo trading already there for decades but addition with AI that can process corporate performance, trends etc can make it to another level
but if we do this, does this good for market??? since if everyone have access to this tool. meaning that market would get optimized to the ground and what happen to daily trader etc ???
does that mean everyone just win/lose money equally???
means the market becomes more efficient (assuming that the models are better at pricing assets compared to humans) as it's been getting more and more efficient as more people trade, information becomes more democratized.
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 have an example of this with Databento market data. The MCP server was a proof-of-concept and needs improvement, but certainly a good base from fashioning your own specific MCP Tool [1].
This week I'm adding a SQL-based MCP server to my DataBento Golang Tutorial, but it's not there yet. [2]. That step will follow an MCP implementation like this, where it will just give a "sql" endpoint along with other tools to fill the database [3].
Its very verbose, it writes a lot of code, but I just caught it, hard coding some replies to an API I was creating an introspection for. All this like in the middle of many hundreds of innocent lines of code.
Go and review every single line of code. This is a pro developer colleague that will fail you when you least expect. Frankly the time savings are minimal for professional quality code.
Some will say it was a problem with the prompt, but I would say it was mimicking the behavior I have seen professional developers do under a deadline. :-)
dokka|9 months ago
duggan|9 months ago
cedws|9 months ago
shireboy|9 months ago
cube2222|9 months ago
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 your MCP http endpoint. Each connection to that endpoint will pass the Authorisation header with an oauth token, which you can resolve to a user on your side. Same as you would with normal OAuth.
One cool bit is that MCP providers are supposed to support OAuth2 Dynamic Client Registration, which means that e.g. Claude can provision an OAuth2 client in your app programmatically (and get a client_id/client_secret that it can use for authorization flows).
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.
[0]: https://modelcontextprotocol.io/specification/2025-03-26/bas...
zackify|9 months ago
I have built a couple using the spec from a month ago. It works alright.
A lot of bad decisions are in the official implementations. For instance not using native Request / Response types in node, so you’re forced to write a bunch of garbage code to convert it, or install express just to use an mcp server.
If I had the time I’d really make my own mcp implementation in typescript at least.
I find most of the implementations to be so over engineered and abstracted on what could be simple function calls on top of the built in language
For simple stuff like a json file that returns the location of your auth routes, you need to add a “middleware”
When in reality you can just make a route and explicitly return that information.
Every piece is some new abstraction it feels vibe coded.
wdb|9 months ago
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 ?
dangelov|9 months ago
There's basically a couple of different ways to implement an MCP server - for this demo it's a local binary that communicates over stdio, so no OAuth process is taking place. It's only meant to run on your local machine.
To make the demo simpler to explore and understand, the binary loads it's configuration (SnapTrade API client id, secret, and username and secret) from a .env file that you populate with your credentials which allows it to fetch the right data.
monai|9 months ago
drob518|9 months ago
Incipient|9 months ago
I'm sure one day we'll get 100.00% reliable outputs such that autonomous agents can do this, however that's not today.
maxwellg|9 months ago
UltraSane|9 months ago
dangelov|9 months ago
peterldowns|9 months ago
pglevy|9 months ago
foxes|9 months ago
Here [0] is a funny paper where a group of llms attempt to manage a vending machine. It ended with them trying to contact the fbi.
[0] https://arxiv.org/pdf/2502.15840
DougN7|9 months ago
faizshah|9 months ago
whinvik|9 months ago
vFunct|9 months ago
Like, immediately, I want it to order me some groceries based on what it sees in my fridge and what I cook.
And to remind me to change my air filters. Or book my vacation for me, knowing I like a mediterranean vibe and Bistecco Florentine.
I am absolutely excited for all of this. It really is as big as the iPhone.
globnomulous|9 months ago
Two stories:
When my father was in Japan in the 1970s, he was strutting around like a rooster in an obnoxious, white suit and crossed paths with a Zen monk quietly sweeping a path. The monk looked up at him and my father felt, he said, about six inches tall. The dignity and focus of the monk put my father to shame.
I was once in Princeton, NJ, waiting to cross a crosswalk at a streetlight. Someone extremely famous (I think) and certainly incredibly wealthy was in a car at an intersection, waiting for the car in front of her to turn so she could proceed. She was beside herself -- honking, screaming, practically crying. Being asked to wait for someone else was more than she could stand.
Obviously these experiences relied on a lot of assumptions and interpretation on my and my father's part. I'm sure there were other ways of reading the monk and driver.
Regardless, when I imagine the world you're describing, what I see is a combination of my father in the white suit and the driver: spoiled, incompetent, impatient, egocentric people incapable of enduring the indignity of having to make any decisions for themselves, wait for anything, or stoop to the humiliating depths of thinking about the boring stuff. In a weird, backwards way, what you're describing also sounds like subservience to me.
Smartphones are bad for people. This sounds much, much, much worse. I hope I die before/if the technology "matures."
piva00|9 months ago
But to be honest, I don't think it will get to the state you dream about, just like smart homes never got close and are more of a hassle than an actual life improvement. Unless it is almost 100% perfect it will error out in ways that are extremely annoying, ordering the wrong groceries, booking the wrong trip, etc. It's really hard to cross over the point where it's absolutely helpful without hiccups.
nlitened|9 months ago
This thing already exists though, it’s called a personal assistant. And since you’re already not willing to spend $400 a month on getting one, likely reveals that this is not really a thing that you really need in your life. It’s a made-up preference, I am afraid.
worldsayshi|9 months ago
I'm not categorically against the development, but I want to categorically confirm bank transactions.
dangelov|9 months ago
glowiefedposter|9 months ago
flakeoil|9 months ago
tonyhart7|9 months ago
but if we do this, does this good for market??? since if everyone have access to this tool. meaning that market would get optimized to the ground and what happen to daily trader etc ???
does that mean everyone just win/lose money equally???
life_enjoyer|9 months ago
whazor|9 months ago
But a LLM could build a knowledge graph that parses niche news messages and tries to understand the entire picture and make bigger predictions.
kachapopopow|9 months ago
The market is unfortunately not really efficient. Or well... too efficient at times (insider information).
rco8786|9 months ago
shibayu36|9 months ago
vonnik|9 months ago
neomantra|9 months ago
This week I'm adding a SQL-based MCP server to my DataBento Golang Tutorial, but it's not there yet. [2]. That step will follow an MCP implementation like this, where it will just give a "sql" endpoint along with other tools to fill the database [3].
[1] https://github.com/NimbleMarkets/dbn-go/blob/main/cmd/dbn-go...
[2] https://github.com/NimbleMarkets/dbn-duckduck-goose
[3] https://github.com/AgentDank/dank-mcp/blob/main/data/us/ct/m...
belter|9 months ago
Its very verbose, it writes a lot of code, but I just caught it, hard coding some replies to an API I was creating an introspection for. All this like in the middle of many hundreds of innocent lines of code.
Go and review every single line of code. This is a pro developer colleague that will fail you when you least expect. Frankly the time savings are minimal for professional quality code.
Some will say it was a problem with the prompt, but I would say it was mimicking the behavior I have seen professional developers do under a deadline. :-)
RyanShook|9 months ago
atlgator|9 months ago
Theodoreelissa|9 months ago
[deleted]
Stem0037|9 months ago
[deleted]
varelse|9 months ago
[deleted]
fadsiooie3|9 months ago
[deleted]
fdsafaefew|9 months ago
[deleted]