Scott Keck-Warren
0:05
Hello developers, and welcome to the PHP Architect Community Corner, where we have conversations with members of the web development community. I'm your host, Scott Keck Warren, and today we're talking with Kieran Obiakwua about his work with PHP MCP servers. And I do want to say there were some technical issues that we had with our, with our recording. Um, I wanted to release it because of all the important information that we, that we had. Um, you know, so I apologize for, for any sort of technical issue that you may have, but here's the interview. Keren Obiquala is a backend developer at Astaro and an open source builder with a fast growing footprint in the PHP ecosystem. He's the creator of projects like TransformerPHP, which brings modern AI and machine learning models into PHP, WhisperPHP, ChromeDBPHP, JiraPHP, and the PHP MCP suite. tools that have collectively powered over 100,000 downloads worldwide. He's also part of the ongoing collaboration between the PHP Foundation, Symfony, and Anthropic to build the official PHP MCP SDK. Beyond code, Kieran is passionate about teaching and community. He's co-founder of STEMnovaNG, a STEM education initiative in southeastern Nigeria. and Fortis Labs, a virtual science lab that won global recognition at Stanford University's Longevity Design Challenge. At his core, Kieran sees himself as a curious builder who's constantly asking, what if PHP could do this too? His work focuses on pushing PHP beyond its traditional boundaries into areas like AI, developer tooling, and new workflows. Thank you so much for finding some time to talk to us. You seem super busy with all of that stuff going on.
Yeah, thank you so much for having me, Scott. Um, so a quick snippet, he calls it Jira. It's Jinja PHP, right? So Jinja is, is a templating language similar to Twig and Blade, right? So, but mostly used in the Python ecosystem. So I just built a parser for it or a renderer for it when I was working on Transformers PHP.
Scott Keck-Warren
2:10
Oh, okay. Okay. Sorry about that. Yeah. So there was a, there was a lot of like vocab words in that, in that, in your bio. So it was a bit of a challenge for me. Yeah. So, so you've kind of come into my, um, into my, like, I don't know, like window, I guess, in the last couple of months, because you've been doing a lot of stuff with, um, MTP and PHP. And can you kind of talk like just to, to those of our listeners who don't know what an MTP server is, can you kind of talk to us about what, what that is and what and a solution that provides?
Yeah. So MCP stands for Model Context Protocol, right? I'm not going to go into the textbook definition because if you search up MCP, you're going to see a lot of articles, but it's an open standard proposed by Anthropic that defines a standard on how to connect AI applications to external services. So a very simple way to understand this is It's a standard for before MCP came out. We could always allow LLMs, that is large language models, to connect to external services. But then before then, to connect it, you have to use things like tools and then define custom functions. And for example, OpenAI has their own way of defining their tools. Anthropic has their own way of defining their tools. Claude, if you're using Cursor, there are different LLM applications and Yes, you can define tools, but there is no way for the end user to provide these tools easily. So you have to wait for Kusura to, you know, maybe provide an integration to Figma or an integration to Slack or an integration to your Google Drive, right? So Anthropic came up with the Model Context Protocol. It's that standard that defines, oh, there is an LLM client that wants to connect to an external service. An external service can be just resources. It can be static data. It can be to perform an action, right? So it's, it's, it's an interface. Once you build your service or you expose your application. So in most cases, the people that are going to benefit from the MCP protocol are people who have services. So you have a service, you have an existing service. Of course you can build something new, but you have an existing service and you want to expose it no longer to humans in this case, but to LLMs. Of course, we have APIs, and for some people, MCP sounds like a wrapper around APIs because of course APIs expose your application to external, you know, anyone can interact with your APIs. But then one cool thing about, you know, the MCP standard is it's well-defined. It's backed by the JSON schema. So for example, you have a tool and you define exactly, these are the inputs. This is the shape of the data for the inputs. Description, every other information including annotations on what is expected. And with the latest version of this protocol, you can also define the shape of the output. So you take all this information and you can give it to any client. Any large language model client that implements the MCP client can interact with any application that implements the MCP server interface. So that standard, it bridges that gap we have with external services and to So I'll give you some examples of very realistic use cases. So let's say, I mean, we see currently people interacting with Slack, right? So let's say you want, maybe you are, let's use a very specific example. I have Claude Desktop and I use Claude Desktop to interact with the Atropic model. And you are chatting with the model you would like to send some messages to. a Slack channel. If Anthropic doesn't have an integration with Slack, there is no way to do that, right? But if Slack has an MCP server, it's as simple as just plugging in the details of the MCP server and you can easily just send information to your Slack. Now that's for Slack. And an example of, let's say, an application you are building, say you are building a flight booking application, right? and you want people to be able to maybe see available flights or if possible book flights with LLMs, right? You expose some parts of your applications for LLMs to interact with through the MCP standard. And it's as simple as that. I don't know if that's done justice to, you know, I try not to give any textbook definition in this case. Yeah.
Scott Keck-Warren
6:41
Yeah, no, and I think it's like, it's a really interesting like building block in the whole large language model, like piece, because it is like that, that external access that like our, our, um, our, our, our, our large, like, so like, you know, Claude might need to reach out and get some data from like our database or whatever. And that's, that's like a cool, like way for that to like easily do that. So you have a couple of projects that you've, you've worked on that are like involving, uh, AI. And, and one of them is like, this is this, uh, PHP. Oops. I lost this thing. Let me find it again. Official PHP SDK for MCP, which again is a lot of like acronyms, but is, can you talk to us a little bit about like how that kind of has started out?
All right. Yeah, yeah, sure. So when I started out building, because I started out building my own set of components for the MCP protocol. So as at that time, there were many, you know, many people had their attempts at trying to build an SDK for PHP. So when Anthropic launched, there were some official SDKs. I know TypeScript was there. I saw some C#, I saw for Java. So there were some official SDKs, but PHP didn't have any official ones. So many people had their try at it. I did mine because the ones I saw then, um, the interface wasn't something I wanted until I, I, I'm more of I love modern PHP, right? I'm very passionate about PHP if you don't know, but I love modern PHP much more than the older version of PHP, even though I've been doing PHP for over 6 years now. But I prefer the modern API, you know, the whole fluent and the API that relies on the new features of PHP. And most of those I saw then did not satisfy the criteria I had. So I decided to build one. Right? I took some inspiration from the existing components and then built mine, and it turned out people loved it, right? Some of the key features of the version I built, or a lot of the key things that made it stand out, at least for me and for most of the people using it, was there was a lot of steps that we are taking care of behind the scenes. So I don't want to call it magic, but there were a lot of things happening behind the scenes to make it easy to use it. So in most cases, for example, I noticed that not all PHP developers are familiar with the whole JSON schema standard, right? So I don't want to force users to have to go learn that in order to expose their applications to LLMs. So I wanted something that will feel simple, something that feels easy, something that you just, just write PHP as you used to write PHP. And that's all you have to do. So I built that, put it out there, and a couple of people liked it. It relied on PHP attributes. It relied a lot, a lot on reflection to do a lot of things behind the scenes. So people loved it. People started using it. There were other packages and, you know, at some point it felt like we now have the same concept, but then many people doing it. So earlier this, I don't know. I don't know when exactly. Some, some people started speaking up around the need for, you know, one official SDK. You know, that disjoint in the community doesn't, doesn't look good for the PHP community. So some people started bringing up that conversation. I also chimed in, yeah, it'd be nice to have a standard. And then sometime last, actually last few months or so, I got an email from the PHP Foundation. So they sent email to a couple other maintainers within the maintainers that had packages that had usages around the ecosystem. So they sent to me, they sent to Logiscape. I don't know its real name for you, but it's Logiscape. Its GitHub is Logiscape. And Nylon. And then right about that time, Symfony was launching their AI initiative. So the AI initiative is more of, is the initiative to build a lot of components around AI for PHP. So not just MCP, a lot of components to do a lot of stuff in the AI aspect using PHP. So since they launched that initiative, they were also included in the conversation. So with Anthropic and then the people that found that really spearheaded this whole movement were the PHP Foundation through the creative director, Roman Prosinčki. We decided that it would be better if Symfony handles, you know, the whole process of unionizing the whole other packages because Symfony has a good team. Symfony has, I mean, Symfony has the reputation of building wonderful packages. So, I mean, honestly, I was not so happy about that because I don't want to sound selfish, but everybody wants theirs to be the official one. Right. But then Roman did something very wonderful. So he, he, he loved, I mean, I think he's one of the people that loved the API of mine and he found a way to make sure that I was included in the conversation. And, you know, eventually it turned out that mine was the better or mine was the preferred API. So we had to move things over and then, as you said earlier, morph the package into what we have as the original. So Roman made sure that I was included in the team. I was added to the, to the, to the team on GitHub and then, you know, involved in the whole process of unionizing that whole stuff. So yeah, I'm happy. I appreciate the, this revolution for that initiative. And so far the Symfony team is doing a fantastic job. I enjoyed— should have tagged the first release of the official MCP SDK.
Scott Keck-Warren
12:33
Yeah. And so there's, there's like a lot to unpack in that, in that answer. So let me, let me, can we take a little step back? And so I do think that like the thing, the thing that I really like about, about like the structure of the way that you've built like the package is like, it is, it is like, cause I'm looking, I'm looking at like the, the, the GitHub repository and it's essentially like you have like a class and you're just saying, well, this is an MCP tool. And it's this kind of tool. And then you just have to have like some very basic, like setup boilerplate logic that says, well, here's how you access this thing to like, to like, to do, to do the tool. And it seems very, and I haven't tried it. Like I'm, I'm going to have to try it like, um, on an actual application, but it seems like very simple to just like, cause all you're doing is saying like, here's an attribute. Like you put an attribute on something and say, here's how you interact with this thing. Here's how it kind of gets routed. And then, and then it just kind of works after that. There's like, there is a lot of like. You have done a lot of like, make this simple, right? Like you've extracted a lot of the complexity.
Yeah. For me, that was the goal, right? Make it super easy. MCP on its own, it's, it's a very thorough protocol and trying to fit all those rules into something, it can, it can, can get complicated very, very quickly. Right. So my goal was to make it as simple as just, for example, the JSON schema is, is extracted from a couple of things, for example. the PHP definition. So you define the variable as a string or as an integer or as a boolean, and everything happens behind the scenes to convert it to JSON schema. It uses the PHP types. It uses docblocks, which is something we are used to in PHP. It uses, yeah, PHP types, docblocks, and then attributes, which are things that feel normal to PHP developers. And for me, that was the ultimate So all the decisions I made, you know, while trying to design the API was how can we make it just write a PHP class, just write a function, basically write a function and that becomes a tool for an MCP client. It's as simple as that.
Scott Keck-Warren
14:34
Yeah. And I think like one of the things that I've really found fascinating about, especially modern PHP is just like how quickly you can just be like, I need this thing. And then like an attribute will solve that problem, right? Attributes are so good at like, just like going like, here's a thing you need to know about. And it's just like, so I don't know, like to me, the, I'm sure the implementation is always like a challenge, but for my, as like a consumer of, of like people who make attributes, it's just so simple to just be like attribute. And then like, you know, deprecation is my favorite one now where I can just say, well, this is deprecated and then just throw that on there and it just works like perfectly out of the box.
Yeah. For me, when I rank new, um, things that came into PHP, I put attributes really high. Because they solve— so I have a C# background. I've worked with C# in the past. So I was so excited when I heard about, you know, attributes coming to PHP. You just annotate a method or a function or a variable, and then some things can happen behind the scenes. It's, it's really powerful, right? As you mentioned, a lot of things that happen behind the scenes might not be so neat. Uh, they might not be so easy, but then in terms of usage, it makes things really easy. Just append an attribute and you attach a lot of features to maybe a function or a class. You can use it on function level, class level, property level. So yeah, it's, it's, it's exciting stuff for PHP. And I feel like we've not even scratched the surface of what we can do with attributes just yet.
Scott Keck-Warren
16:02
Yeah. Yeah, I think so. And especially like 8.5 is adding like more officially supported attributes, which are really nice too. So like there's all sorts of cool stuff they're doing there. Um, so, so, so like, what is like the basic process? Like I already have a website and I wanna make it MCP aware, I guess is the term. And so like what, like I install the Composer package and then I set up all my pieces and then is it essentially just live to the internet and anyone can access it or do you have to do something extra to get people access to it?
So in the MCP specification, one of the most important aspects besides the whole tools, resources, and prompts is the transport layer. And I think that's the major thing that determines how you deploy your MCP server. So as per specification, there are 2 transports, the standard input/output transport, and then the HTTP transport. So in the SDIO transport, it's more like you are running the server locally. So that means you need PSO. I mean, because when we are talking about MCP, we are talking about both the people building and then the users. So if you are building an MCP server, it's very easy. You install the package, you get the guide is there. You create the server, create, choose a transport you are going to use, and then you start listening on the transport and you are good to go. Right? So if you are using the automatic discovery, that means you are using the attributes. You just annotate with attributes and you are good to go. If not, you can also manually add tools to your server. And tools that you're adding to your server can be, it can be a closure, it can be any callable, it can be an invocable class, it can be the method of any class. It's as simple as that. But the most important differentiator is usually that transport. So if you are using the, the SDIO transport, it means that your server is going to run like, like a, a PHP process. So PHP whatever the path to the file where the, you know, the code for your server is, and then you run. And of course it now means that people that are going to use your server also have to pull down your code as the source code for that server and have PHP installed and then configure whatever client they're using, be it Cloud Code, be it Cloud Desktop, you know, give it the actual command to run, which is PHP, and then the path to the file. So personally, I feel like the power of MCP when it comes to PHP, given that PHP is not necessarily something that everybody has installed on their system, the power of it all is mostly the HTTP side of things. So in the HTTP side of things, if you were using my package, it was very opinionated. So I'm going to explain, right? I used ReactPHP. You know ReactPHP, right? Good. So I used ReactPHP as the server, which simplified things because it runs the actual HTTP process and then listens for connections and then processes. But in the official SDK we are building currently, we decided not to go that route. So the route we are going now, we are relying on the PSR standards. So you send in— the transport can handle a PSR-7 request. And then give out a response. It's as simple as that. So it makes it easy. Of course, it now complicates the process a little bit. Yes, because if you're using PHP-based transport, things are significantly easier because you don't have to worry about the server. And by the server, I mean the HTTP server. But the reason why we went that route is because there are many ways people run PHP. Right? Some people use FrankenPHP, some people use Roadrunner, some people use Swoole, some people use different frameworks. We have Laravel, and Laravel has its own HTTP kernel. We have Symfony and the Foundation. We have SlimPHP. So we wanted something that works for every setup, right? That's one of our goals, something that works for every setup, whether you're using Laravel, Of course, in the end, we might have to create some adapter packages to make it easy to integrate with Laravel. But at the moment, it's as simple as if you are going the HTTP route, you install the package, you create your server, you write the functions or the classes that have to be your tools or resources and annotate them with the attributes. And then you create the transports and process the request that comes in terms of PHP requests. and then emit the response. So it sounds like a lot now that I'm explaining it, but believe me, it's— yeah, yeah, yeah. Believe me, it's going to be very simple, right? It's going to— it's a very straightforward process once you get the hang of it. And the beauty is that that configuration, you know, that whole configuration of setting up the transport is something you do once, right? So once you are done with the whole setting up, it's just as easy as adding the MCP2 attributes to any function in your, your codebase and it automatically becomes a tool for MCP clients. Yeah.
Scott Keck-Warren
21:24
Okay. Well, that's, that's really interesting. So then, so then like, so you might not like necessarily install it. Like you might, it might be like its own like repository within your, your, your environment, right? Like, so you might, it might not necessarily share the entirety of your, your like Laravel codebase, cuz it sounds like It's not like the Laravel routing does not quite work here. Is that, is that what you're saying? Like there's still a piece missing there, but I understand this is still, I mean, there's work to be done always, right, in software.
So. Currently it works with the Laravel routing, right? That was the major challenge. Part of what delayed the official release is getting it to work with everyone. So it works with the Laravel kernel. It works with the Symfony kernel. It works with SlimPHP, works with CodeIgniter, any framework, and then Of course, if you're using vanilla PHP, it works with them all. It's just that there are extra configuration steps. So what we can now do to make it easier in the future is to have, you know, adapter packages that make it easy to just integrate into these frameworks. But the core of it, the core of it is simple. Okay. For example, if you're using Laravel, it's very simple. The typical controller you have in Laravel. You instantiate your server and listen to this transport and you are good to go. It's as simple as that. So you just have a normal Laravel route inside the controller. That's where you put the whole server code and then process the information and you are good to go. It takes care of routing to the, to the correct handler and stuff like that. So yeah, it works with almost all different, provided there is a way to obtain. And that's why I love, I love the PSRs. I think that's one of the best things that has happened to PHP because it standardizes how, you know, things are handled around PHP applications. So the PSRs for request, server request interface and server response interface, provided your framework supports that, it's good to go. If you're not using any framework, you can bring in any PSR-7 implementation like Nylon PSR-7 and you are good to go. Right? So it's, it's not necessarily an issue.
Scott Keck-Warren
23:33
Every app builds up technical debt over time. It's the unfortunate price that we pay for shipping new features and moving fast. When we build up too much of it though, it can start to impact how we work. Team velocity suffers, bugs become more frequent and take longer to fix, and everyone starts to get a little bit frustrated. The key to managing debt is to measure it. A credit score can help you understand how well you're managing your debt, and now there's a credit score for technical debt. Go to php-score.com to get a free technical debt score and monitoring for all of your PHP applications today. Head over to php-score.com and get control over your technical debt. Is there anything that you'd like to direct our listeners to today? Um, obviously like the PHP Foundation, um, hopefully it's going to give you some like funding to help work on this, but is there, is there anything else that like you want to direct our listeners to like your, your LinkedIn or your, uh, Twitter or anything like that?
Yeah, you can check me out at @codewithkirian on Twitter and on GitHub. Besides PHP NCP, I'm also working on some other fantastic projects like Transformers PHP. And if you notice, most of my projects are mostly projects that push PHP outside the regular boundaries of PHP. You know, Transformers is for running machine learning models natively in PHP. And then WeSpark PHP is about running, um, speech-to-text, that is ASR in PHP and so many others. So you can go check them out, you know, experiment, try out new things. I'm also, I'm always excited to get feedback on those packages. I understand that it's not something a lot of the PHP community use, but it's also a field you can explore. So this is me encouraging people to, you know, push boundaries in PHP, you know, step outside PHP. We have native PHP doing wonderful work. And I think we can also get more people to go in that direction. So yeah.
Scott Keck-Warren
25:21
Yeah. And I do have to say thank you again for like everything that you're doing for the community. This is like, I think this is a huge step forward for this like, you know, area. So I'm really interested in trying it out for some of my side projects. So thank you again for your time today.
Okay. Thank you so much, Scott. I enjoyed my time here.
Scott Keck-Warren
25:36
I have to say another heartfelt thank you to Kieran for all of his time as well as yours for listening today. If you're not already a subscriber, make sure you subscribe with whatever your preferred method is and leave us a rating and a comment if at all possible, and make sure you have the downloads turned on, the automatic downloads turned on, as that does help other people find us. Maybe share this post with a coworker as well. This podcast is available both in an audio version on the PHP Architect website, as well as a video version on our YouTube channel. This is Scott Keck Warren for the PHP Architect Community Corner signing off and reminding you to keep listening, keep coding, and keep reading. Thanks, Scott.